diff --git a/litex/soc/integration/builder.py b/litex/soc/integration/builder.py index de711012b..ae3bc58e3 100644 --- a/litex/soc/integration/builder.py +++ b/litex/soc/integration/builder.py @@ -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.") diff --git a/litex/soc/software/bios/Makefile b/litex/soc/software/bios/Makefile index 3dd797933..729b2b51f 100755 --- a/litex/soc/software/bios/Makefile +++ b/litex/soc/software/bios/Makefile @@ -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 diff --git a/litex/soc/software/bios/command.h b/litex/soc/software/bios/command.h index 5124d24c8..effcb83d9 100644 --- a/litex/soc/software/bios/command.h +++ b/litex/soc/software/bios/command.h @@ -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 \ No newline at end of file diff --git a/litex/soc/software/bios/main.c b/litex/soc/software/bios/main.c index d92694b9b..6da53fea9 100644 --- a/litex/soc/software/bios/main.c +++ b/litex/soc/software/bios/main.c @@ -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; }