From 6fff52dcd711e2e4497f19b8ecfa37ed0b6df8fc Mon Sep 17 00:00:00 2001 From: cnlohr <lohr85@gmail.com> Date: Mon, 17 Apr 2023 11:04:55 -0700 Subject: [PATCH] * Only add arch option if GCC > version 9. * Allow for older __riscv__ predefine'd checks. --- ch32v003fun/ch32v003fun.c | 6 ++++-- ch32v003fun/ch32v003fun.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ch32v003fun/ch32v003fun.c b/ch32v003fun/ch32v003fun.c index ad3097e..334fe83 100644 --- a/ch32v003fun/ch32v003fun.c +++ b/ch32v003fun/ch32v003fun.c @@ -764,8 +764,10 @@ void handle_reset() .option norelax\n\ la gp, __global_pointer$\n\ .option pop\n\ - la sp, _eusrstack\n\ -.option arch, +zicsr\n" + la sp, _eusrstack\n" +#if __GNUC__ > 9 +".option arch, +zicsr\n" +#endif // Setup the interrupt vector, processor status and INTSYSCR. " li a0, 0x80\n\ csrw mstatus, a0\n\ diff --git a/ch32v003fun/ch32v003fun.h b/ch32v003fun/ch32v003fun.h index eb4787d..bdef4a4 100644 --- a/ch32v003fun/ch32v003fun.h +++ b/ch32v003fun/ch32v003fun.h @@ -4822,7 +4822,7 @@ extern "C" { #define DELAY_US_TIME (SYSTEM_CORE_CLOCK / 8000000) #define DELAY_MS_TIME (SYSTEM_CORE_CLOCK / 8000) -#if defined(__riscv) +#if defined(__riscv) || defined(__riscv__) void handle_reset() __attribute__((naked)) __attribute((section(".text.handle_reset"))) __attribute__((used)); void DefaultIRQHandler( void ) __attribute__((section(".text.vector_handler"))) __attribute__((naked)) __attribute__((used)); #endif -- GitLab