From 619be720d3f1686b6cad4a1e0781c67f995a2a64 Mon Sep 17 00:00:00 2001 From: Stanislaw Kaushanski Date: Mon, 16 Oct 2023 13:04:11 +0200 Subject: [PATCH] tohost is not required in hifive1 env --- bare-metal-bsp/env/hifive1/link.lds | 2 +- bare-metal-bsp/env/iss/platform.h | 1 + bare-metal-bsp/libwrap/sys/_exit.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bare-metal-bsp/env/hifive1/link.lds b/bare-metal-bsp/env/hifive1/link.lds index 76a2e14..1781076 100644 --- a/bare-metal-bsp/env/hifive1/link.lds +++ b/bare-metal-bsp/env/hifive1/link.lds @@ -5,7 +5,7 @@ ENTRY( _start ) MEMORY { flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 512M - ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 512K + ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 1M } PHDRS diff --git a/bare-metal-bsp/env/iss/platform.h b/bare-metal-bsp/env/iss/platform.h index 59e6fd5..0407391 100644 --- a/bare-metal-bsp/env/iss/platform.h +++ b/bare-metal-bsp/env/iss/platform.h @@ -6,6 +6,7 @@ // Some things missing from the official encoding.h #define MCAUSE_INT 0x80000000 #define MCAUSE_CAUSE 0x7FFFFFFF +#define USE_TOHOST 1 #include "rtl/const.h" /**************************************************************************** diff --git a/bare-metal-bsp/libwrap/sys/_exit.c b/bare-metal-bsp/libwrap/sys/_exit.c index 7dab930..1f5afa9 100644 --- a/bare-metal-bsp/libwrap/sys/_exit.c +++ b/bare-metal-bsp/libwrap/sys/_exit.c @@ -16,7 +16,9 @@ void __wrap__exit(int code) write(STDERR_FILENO, message, sizeof(message) - 1); write_hex(STDERR_FILENO, code); write(STDERR_FILENO, "\n", 1); +#ifdef USE_TOHOST tohost = code+1; +#endif write(STDERR_FILENO, "\x04", 1); for (;;); }