From dafdb8df7269a9e083a04245e1e65ccf12c6ea4f Mon Sep 17 00:00:00 2001 From: Stafford Horne Date: Thu, 4 Oct 2018 23:07:48 +0900 Subject: [PATCH 1/2] Fix compiler warnings from GCC 8.1 Fix these 2 warnings: litex/build/sim/core/libdylib.c:42:5: warning: 'strncpy' specified bound 2048 equals destination size [-Wstringop-truncation] strncpy(last_err, s, ERR_MAX_SIZE); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function 'set_last_error', litex/soc/software/libbase/exception.c:28:13: warning: function declaration isn't a prototype [-Wstrict-prototypes] static char emerg_getc() --- litex/build/sim/core/libdylib.c | 2 +- litex/soc/software/libbase/exception.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litex/build/sim/core/libdylib.c b/litex/build/sim/core/libdylib.c index ba8cdb6a0..aaf082288 100644 --- a/litex/build/sim/core/libdylib.c +++ b/litex/build/sim/core/libdylib.c @@ -39,7 +39,7 @@ static void set_last_error(const char *s) if (!s) s = "NULL error"; last_err_set = 1; - strncpy(last_err, s, ERR_MAX_SIZE); + strncpy(last_err, s, ERR_MAX_SIZE-1); } static dylib_ref dylib_ref_alloc (void *handle, const char *path) diff --git a/litex/soc/software/libbase/exception.c b/litex/soc/software/libbase/exception.c index b758e58ee..09b26399a 100644 --- a/litex/soc/software/libbase/exception.c +++ b/litex/soc/software/libbase/exception.c @@ -25,7 +25,7 @@ static void emerg_printf(const char *fmt, ...) } } -static char emerg_getc() +static char emerg_getc(void) { while(uart_rxempty_read()); char c = uart_rxtx_read(); From ff6de429f0225430e64a6a983f224be312bffbe3 Mon Sep 17 00:00:00 2001 From: Stafford Horne Date: Thu, 4 Oct 2018 23:09:49 +0900 Subject: [PATCH 2/2] Fix help for or1k builds The help said cpu-type could be mor1kx, which is correct but you must pass or1k to get mor1kx. Fix the message to properly represent what needs to be passed to the commandline. --- litex/soc/integration/soc_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/soc/integration/soc_core.py b/litex/soc/integration/soc_core.py index 11e08a3fc..c8cdc1794 100644 --- a/litex/soc/integration/soc_core.py +++ b/litex/soc/integration/soc_core.py @@ -384,7 +384,7 @@ class SoCCore(Module): def soc_core_args(parser): parser.add_argument("--cpu-type", default=None, - help="select CPU: lm32, mor1kx, picorv32, vexriscv, minerva") + help="select CPU: lm32, or1k, picorv32, vexriscv, minerva") parser.add_argument("--cpu-variant", default=None, help="select CPU variant") parser.add_argument("--integrated-rom-size", default=None, type=int,