diff options
| author | UMRnInside <[email protected]> | 2026-04-26 20:35:54 +0800 |
|---|---|---|
| committer | UMRnInside <[email protected]> | 2026-04-26 20:35:54 +0800 |
| commit | b62ac586501c43c61f21c0fca67dca437ff3a9dc (patch) | |
| tree | 4be9a75d3c87ed3131473b17cdb0d5e5aa5bfaa9 | |
| parent | 4c7fd70e53b34bf63ef9334f2b5624cac48299f1 (diff) | |
Fix CH32V103 hardfault on startup
| -rw-r--r-- | hw/bsp/ch32v10x/family.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/bsp/ch32v10x/family.c b/hw/bsp/ch32v10x/family.c index 72dae7086..9943bf856 100644 --- a/hw/bsp/ch32v10x/family.c +++ b/hw/bsp/ch32v10x/family.c @@ -67,7 +67,10 @@ uint32_t tusb_time_millis_api(void) { #endif void board_init(void) { - __disable_irq(); + /* __disable_irq() in CH32V103 EVT attempts to call + * `csrc mstatus, 0x88` in U-mode, which is allowed ONLY in M-mode. + * Disable this to avoid hard-fault. */ + //__disable_irq(); #if CFG_TUSB_OS == OPT_OS_NONE SysTick_Config(SystemCoreClock / 1000); @@ -123,7 +126,7 @@ void board_init(void) { USART_Init(USART1, &usart); USART_Cmd(USART1, ENABLE); - __enable_irq(); + //__enable_irq(); board_led_write(true); } |
