diff --git a/ch32v003fun/ch32v003fun.c b/ch32v003fun/ch32v003fun.c index ad3097e34b52c94b9b3c88703c337a3d257bd42b..334fe83eed984a6dac2dba47cb8b14b601695cd5 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 eb4787d3aabd1b370d74320f8703f45178ed3937..bdef4a4e24f0aa676a122c52500f78e63e37ac9b 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