From 2fb5920348bdf47b2dc1b258192279f2a29116f2 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 20 Mar 2024 11:55:48 +0100 Subject: [PATCH] updates coremark portable part to match BSP --- benchmarks/coremark/tgc/core_portme.c | 1 + benchmarks/coremark/tgc/core_portme.mak | 4 ++-- benchmarks/coremark/tgc/ee_printf.c | 23 +++++++++++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/benchmarks/coremark/tgc/core_portme.c b/benchmarks/coremark/tgc/core_portme.c index 56639c7..e986425 100644 --- a/benchmarks/coremark/tgc/core_portme.c +++ b/benchmarks/coremark/tgc/core_portme.c @@ -186,6 +186,7 @@ portable_init(core_portable *p, int *argc, char *argv[]) ee_printf("ERROR! Please define ee_u32 to a 32b unsigned type!\n"); } p->portable_id = 1; + ee_printf("portable_init finished.\n"); } /* Function : portable_fini Target specific final code diff --git a/benchmarks/coremark/tgc/core_portme.mak b/benchmarks/coremark/tgc/core_portme.mak index 8f08ae7..80032cc 100755 --- a/benchmarks/coremark/tgc/core_portme.mak +++ b/benchmarks/coremark/tgc/core_portme.mak @@ -42,7 +42,7 @@ AS = $(TRIPLET)-as # Flag : CFLAGS # Use this flag to define compiler options. Note, you can add compiler options from the command line using XCFLAGS="other flags" PORT_CFLAGS = -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -O3 -DCLOCKS_PER_SEC=10000000 -nostdlib -nostartfiles -nodefaultlibs \ - -funroll-loops -fpeel-loops -fgcse-sm -fgcse-las -flto + -funroll-loops -fpeel-loops -fgcse-sm -fgcse-las -flto -g FLAGS_STR = "$(PORT_CFLAGS) $(XCFLAGS) $(XLFLAGS) $(LFLAGS_END)" CFLAGS = $(PORT_CFLAGS) -I$(PORT_DIR) -I. -DFLAGS_STR=\"$(FLAGS_STR)\" -I$(BSP_BASE)/env/$(BOARD) #Flag : LFLAGS_END @@ -52,7 +52,7 @@ SEPARATE_COMPILE=1 # Flag : SEPARATE_COMPILE # You must also define below how to create an object file, and how to link. OBJOUT = -o -LFLAGS = -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) +LFLAGS = -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -g #--specs=nano.specs -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) ASFLAGS = OFLAG = -o diff --git a/benchmarks/coremark/tgc/ee_printf.c b/benchmarks/coremark/tgc/ee_printf.c index 062388f..fc9e506 100644 --- a/benchmarks/coremark/tgc/ee_printf.c +++ b/benchmarks/coremark/tgc/ee_printf.c @@ -16,7 +16,6 @@ limitations under the License. #include #include -#include "../../../bare-metal-bsp/libwrap/sys/write.c" #define ZEROPAD (1 << 0) /* Pad with zero */ #define SIGN (1 << 1) /* Unsigned/signed long */ @@ -660,10 +659,30 @@ ee_vsprintf(char *buf, const char *fmt, va_list args) return str - buf; } +#include + void uart_send_char(char c) { - write(STDOUT_FILENO, &c, 1); +#if defined(BOARD_ehrenberg) + while (get_uart_rx_tx_reg_tx_free(uart)==0) ; + uart_write(uart, c); + if (c == '\n') { + while (get_uart_rx_tx_reg_tx_free(uart)==0) ; + uart_write(uart, '\r'); + } +#elif defined(BOARD_iss) + *((uint32_t*) 0xFFFF0000) = c; +#elif defined(BOARD_TGCP) + //TODO: implement +#else + while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ; + UART0_REG(UART_REG_TXFIFO) = c; + if (c == '\n') { + while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ; + UART0_REG(UART_REG_TXFIFO) = '\r'; + } +#endif } int