Disabled fast interrupt for open source toolchain.

This commit is contained in:
imi415 2022-03-29 15:05:50 +08:00
parent 2afc177bc4
commit b5badc857a
Signed by untrusted user: imi415
GPG Key ID: 885EC2B5A8A6F8A7
6 changed files with 34 additions and 9 deletions

View File

@ -348,7 +348,11 @@ handle_reset:
csrw 0xbc0, t0
/* Enable nested and hardware stack */
li t0, 0x1f
/* li t0, 0x1f */ /* For MRS proprietary GCC compilers */
/* Enable nested interrupt, disable hardware stack */
li t0, 0x1e /* Refer to RISC-V4 PFIC manual */
csrw 0x804, t0
/* Enable floating point and interrupt */

View File

@ -368,7 +368,11 @@ handle_reset:
csrw 0xbc0, t0
/* Enable nested and hardware stack */
li t0, 0x1f
/* li t0, 0x1f */ /* For MRS proprietary GCC compilers */
/* Enable nested interrupt, disable hardware stack */
li t0, 0x1e /* Refer to RISC-V4 PFIC manual */
csrw 0x804, t0
/* Enable floating point and interrupt */

View File

@ -47,6 +47,7 @@ set(TARGET_C_SOURCES
"BSP/Peripheral/src/ch32v30x_wwdg.c"
"src/ch32v30x_it.c"
"src/main.c"
"src/syscalls.c"
"src/system_ch32v30x.c"
)

View File

@ -9,8 +9,8 @@
*******************************************************************************/
#include "ch32v30x_it.h"
void NMI_Handler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
void HardFault_Handler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
void NMI_Handler(void) __attribute__((interrupt()));
void HardFault_Handler(void) __attribute__((interrupt()));
/*********************************************************************
* @fn NMI_Handler

View File

@ -1,6 +1,15 @@
// SPDX-License-Identifier: MIT
#include <stdio.h>
#include <debug.h>
int main(void) {
USART_Printf_Init(115200);
printf("Hello world?\r\n");
for(;;) {
//
}

7
src/syscalls.c Normal file
View File

@ -0,0 +1,7 @@
#include <sys/stat.h>
int _fstat(int file, struct stat *st) {
st->st_mode = S_IFCHR;
return 0;
}