integration/builder Add no bios console option
This allows to deactivate the cmd_handlers and the serial parsing code to reduce the bios size.
This commit is contained in:
parent
b010455415
commit
9e4df3c1d2
|
@ -163,7 +163,7 @@ class Builder:
|
|||
# Define Compile/BIOS Options.
|
||||
define("LTO", f"{self.lto:d}")
|
||||
for bios_option in self.bios_options:
|
||||
assert bios_option in ["TERM_NO_HIST", "TERM_MINI", "TERM_NO_COMPLETE"]
|
||||
assert bios_option in ["TERM_NO_HIST", "TERM_MINI", "TERM_NO_COMPLETE", "NO_TERM"]
|
||||
define(bios_option, "1")
|
||||
|
||||
return "\n".join(variables_contents)
|
||||
|
@ -397,7 +397,7 @@ def builder_args(parser):
|
|||
builder_group.add_argument("--no-compile-software", action="store_true", help="Disable Software compilation only.")
|
||||
builder_group.add_argument("--no-compile-gateware", action="store_true", help="Disable Gateware compilation only.")
|
||||
builder_group.add_argument("--lto", action="store_true", help="Enable LTO (Link Time Optimization) for Software compilation.")
|
||||
builder_group.add_argument("--bios-console", default=[], help="Select bios options.", choices=["TERM_NO_HIST", "TERM_MINI", "TERM_NO_COMPLETE"], nargs=1)
|
||||
builder_group.add_argument("--bios-console", default=[], help="Select bios options.", choices=["TERM_NO_HIST", "TERM_MINI", "TERM_NO_COMPLETE", "NO_TERM"], nargs=1)
|
||||
builder_group.add_argument("--csr-csv", default=None, help="Write SoC mapping to the specified CSV file.")
|
||||
builder_group.add_argument("--csr-json", default=None, help="Write SoC mapping to the specified JSON file.")
|
||||
builder_group.add_argument("--csr-svd", default=None, help="Write SoC mapping to the specified SVD file.")
|
||||
|
|
|
@ -31,6 +31,10 @@ ifdef TERM_NO_HIST
|
|||
CFLAGS += -DTERM_NO_HIST
|
||||
endif
|
||||
|
||||
ifdef NO_TERM
|
||||
CFLAGS += -DNO_TERM
|
||||
endif
|
||||
|
||||
ifdef TERM_MINI
|
||||
CFLAGS += -DTERM_MINI
|
||||
OBJECTS += readline_simple.o
|
||||
|
|
|
@ -32,17 +32,20 @@ struct command_struct {
|
|||
extern struct command_struct *const __bios_cmd_start[];
|
||||
extern struct command_struct *const __bios_cmd_end[];
|
||||
|
||||
#define define_command(cmd_name, handler, help_txt, group_id) \
|
||||
struct command_struct s_##cmd_name = { \
|
||||
.func = (cmd_handler)handler, \
|
||||
.name = #cmd_name, \
|
||||
.help = help_txt, \
|
||||
.group = group_id, \
|
||||
}; \
|
||||
const struct command_struct *__bios_cmd_##cmd_name __attribute__((__used__)) \
|
||||
__attribute__((__section__(".bios_cmd"))) = &s_##cmd_name
|
||||
#ifdef NO_TERM
|
||||
#define define_command(cmd_name, handler, help_txt, group_id)
|
||||
#else
|
||||
#define define_command(cmd_name, handler, help_txt, group_id) \
|
||||
struct command_struct s_##cmd_name = { \
|
||||
.func = (cmd_handler)handler, \
|
||||
.name = #cmd_name, \
|
||||
.help = help_txt, \
|
||||
.group = group_id, \
|
||||
}; \
|
||||
const struct command_struct *__bios_cmd_##cmd_name __attribute__((__used__)) \
|
||||
__attribute__((__section__(".bios_cmd"))) = &s_##cmd_name
|
||||
|
||||
struct command_struct *command_dispatcher(char *command, int nb_params, char **params);
|
||||
|
||||
struct command_struct *command_dispatcher(char *command, int nb_params, char **params);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
|
@ -80,11 +80,13 @@ static void boot_sequence(void)
|
|||
|
||||
__attribute__((__used__)) int main(int i, char **c)
|
||||
{
|
||||
#ifndef NO_TERM
|
||||
char buffer[CMD_LINE_BUFFER_SIZE];
|
||||
char *params[MAX_PARAM];
|
||||
char *command;
|
||||
struct command_struct *cmd;
|
||||
int nb_params;
|
||||
#endif
|
||||
int sdr_ok;
|
||||
|
||||
#ifdef CONFIG_CPU_HAS_INTERRUPT
|
||||
|
@ -206,6 +208,9 @@ __attribute__((__used__)) int main(int i, char **c)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef NO_TERM
|
||||
printf("--============= \e[1mBuild without Console!\e[0m ================--\n");
|
||||
#else
|
||||
/* Console */
|
||||
printf("--============= \e[1mConsole\e[0m ================--\n");
|
||||
#if !defined(TERM_MINI) && !defined(TERM_NO_HIST)
|
||||
|
@ -223,5 +228,6 @@ __attribute__((__used__)) int main(int i, char **c)
|
|||
}
|
||||
printf("\n%s", PROMPT);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue