Merge pull request #1409 from cklarhorst/bios_no_console

integration/builder: Make bios console configurable + add no console option
This commit is contained in:
enjoy-digital 2022-08-29 18:51:31 +02:00 committed by GitHub
commit e2a3cd57bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 14 deletions

View File

@ -117,7 +117,6 @@ class Builder:
# List software packages and libraries.
self.software_packages = []
self.software_libraries = []
for name in soc_software_packages:
self.add_software_package(name)
self.add_software_library(name)
@ -164,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)
@ -398,6 +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", "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.")
@ -415,6 +415,7 @@ def builder_argdict(args):
"compile_software" : (not args.no_compile) and (not args.no_compile_software),
"compile_gateware" : (not args.no_compile) and (not args.no_compile_gateware),
"lto" : args.lto,
"bios_options" : args.bios_console,
"csr_csv" : args.csr_csv,
"csr_json" : args.csr_json,
"csr_svd" : args.csr_svd,

View 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

View File

@ -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

View File

@ -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;
}