integration/software: Remane BIOS console options/flags.

This commit is contained in:
Florent Kermarrec 2022-08-29 19:45:00 +02:00
parent 6f5412e9d0
commit ece86a7673
5 changed files with 32 additions and 27 deletions

View File

@ -110,7 +110,6 @@ class Builder:
# BIOS.
self.bios_lto = bios_lto
self.bios_console = bios_console
print(bios_console)
# Documentation.
self.generate_doc = generate_doc
@ -163,7 +162,13 @@ class Builder:
# Define BIOS variables.
define("LTO", f"{self.bios_lto:d}")
assert self.bios_console in ["TERM_FULL", "TERM_NO_HIST", "TERM_NO_COMPLETE", "TERM_MINI", "NO_TERM"]
assert self.bios_console in [
"BIOS_CONSOLE_FULL",
"BIOS_CONSOLE_NO_HISTORY",
"BIOS_CONSOLE_NO_AUTOCOMPLETE",
"BIOS_CONSOLE_LITE",
"BIOS_CONSOLE_DISABLE"
]
define(self.bios_console, "1")
return "\n".join(variables_contents)
@ -403,7 +408,7 @@ def builder_args(parser):
builder_group.add_argument("--doc", action="store_true", help="Generate SoC Documentation.")
bios_group = parser.add_argument_group(title="BIOS options") # FIXME: Move?
bios_group.add_argument("--bios-lto", action="store_true", help="Enable BIOS LTO (Link Time Optimization) compilation.")
bios_group.add_argument("--bios-console", default="full" , help="Select BIOS console config.", choices=["full", "history", "autocomplete", "min", "none"])
bios_group.add_argument("--bios-console", default="full" , help="Select BIOS console config.", choices=["full", "no-history", "no-autocomplete", "lite", "disable"])
def builder_argdict(args):
return {
@ -422,10 +427,10 @@ def builder_argdict(args):
"generate_doc" : args.doc,
"bios_lto" : args.bios_lto,
"bios_console" : { # FIXME: Move?
"full" : "TERM_FULL",
"history" : "TERM_NO_COMPLETE",
"autocomplete" : "TERM_NO_HIST",
"minimal" : "TERM_MINI",
"none" : "NO_TERM",
"full" : "BIOS_CONSOLE_FULL",
"no-history" : "BIOS_CONSOLE_NO_AUTOCOMPLETE",
"no-autocomplete" : "BIOS_CONSOLE_NO_HISTORY",
"lite" : "BIOS_CONSOLE_LITE",
"disable" : "BIOS_CONSOLE_DISABLE",
}[args.bios_console],
}

View File

@ -21,22 +21,22 @@ OBJECTS = boot-helper.o \
sim_debug.o \
main.o
ifneq "$(or $(TERM_NO_COMPLETE),$(TERM_MINI))" ""
CFLAGS += -DTERM_NO_COMPLETE
ifneq "$(or $(BIOS_CONSOLE_NO_AUTOCOMPLETE),$(BIOS_CONSOLE_LITE))" ""
CFLAGS += -DBIOS_CONSOLE_NO_AUTOCOMPLETE
else
OBJECTS += complete.o
endif
ifdef TERM_NO_HIST
CFLAGS += -DTERM_NO_HIST
ifdef BIOS_CONSOLE_NO_HISTORY
CFLAGS += -DBIOS_CONSOLE_NO_HISTORY
endif
ifdef NO_TERM
CFLAGS += -DNO_TERM
ifdef BIOS_CONSOLE_DISABLE
CFLAGS += -DBIOS_CONSOLE_DISABLE
endif
ifdef TERM_MINI
CFLAGS += -DTERM_MINI
ifdef BIOS_CONSOLE_LITE
CFLAGS += -DBIOS_CONSOLE_LITE
OBJECTS += readline_simple.o
else
OBJECTS += readline.o

View File

@ -32,7 +32,7 @@ struct command_struct {
extern struct command_struct *const __bios_cmd_start[];
extern struct command_struct *const __bios_cmd_end[];
#ifdef NO_TERM
#ifdef BIOS_CONSOLE_BIOS_CONSOLE_DISABLE
#define define_command(cmd_name, handler, help_txt, group_id)
#else
#define define_command(cmd_name, handler, help_txt, group_id) \

View File

@ -80,7 +80,7 @@ static void boot_sequence(void)
__attribute__((__used__)) int main(int i, char **c)
{
#ifndef NO_TERM
#ifndef BIOS_CONSOLE_DISABLE
char buffer[CMD_LINE_BUFFER_SIZE];
char *params[MAX_PARAM];
char *command;
@ -208,12 +208,12 @@ __attribute__((__used__)) int main(int i, char **c)
}
#endif
#ifdef NO_TERM
/* Console */
#ifdef BIOS_CONSOLE_DISABLE
printf("--======= \e[1mDone (No Console) \e[0m ==========--\n");
#else
/* Console */
printf("--============= \e[1mConsole\e[0m ================--\n");
#if !defined(TERM_MINI) && !defined(TERM_NO_HIST)
#if !defined(BIOS_CONSOLE_LITE) && !defined(BIOS_CONSOLE_NO_HISTORY)
hist_init();
#endif
printf("\n%s", PROMPT);

View File

@ -16,7 +16,7 @@
#include "readline.h"
#include "complete.h"
#ifndef TERM_NO_HIST
#ifndef BIOS_CONSOLE_NO_HISTORY
static int hist_max = 0;
static int hist_add_idx = 0;
static int hist_cur = 0;
@ -76,7 +76,7 @@ static int read_key(void)
return c;
}
#ifndef TERM_NO_HIST
#ifndef BIOS_CONSOLE_NO_HISTORY
static void cread_add_to_hist(char *line)
{
strcpy(&hist_lines[hist_add_idx][0], line);
@ -189,7 +189,7 @@ int readline(char *buf, int len)
int insert = 1;
unsigned char ichar;
#ifndef TERM_NO_COMPLETE
#ifndef BIOS_CONSOLE_NO_AUTOCOMPLETE
char tmp;
int reprint, i;
char *completestr;
@ -204,7 +204,7 @@ int readline(char *buf, int len)
switch (ichar) {
case '\t':
#ifndef TERM_NO_COMPLETE
#ifndef BIOS_CONSOLE_NO_AUTOCOMPLETE
buf[eol_num] = 0;
tmp = buf[num];
@ -306,7 +306,7 @@ int readline(char *buf, int len)
case KEY_UP:
case KEY_DOWN:
{
#ifndef TERM_NO_HIST
#ifndef BIOS_CONSOLE_NO_HISTORY
char * hline;
if (ichar == KEY_UP)
hline = hist_prev();
@ -343,7 +343,7 @@ int readline(char *buf, int len)
len = eol_num;
buf[eol_num] = '\0';
#ifndef TERM_NO_HIST
#ifndef BIOS_CONSOLE_NO_HISTORY
if (buf[0] && buf[0] != CREAD_HIST_CHAR)
cread_add_to_hist(buf);
hist_cur = hist_add_idx;