Merge pull request #3145 from tyustli/gd32

[bsp] [gd32vf103] explicit call clock init
This commit is contained in:
Bernard Xiong 2019-10-22 12:01:53 +08:00 committed by GitHub
commit d1b318644d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 11 deletions

View File

@ -48,6 +48,8 @@ void *__wrap_memset(void *s, int c, size_t n)
} }
void rt_hw_board_init(void) { void rt_hw_board_init(void) {
extern void riscv_clock_init(void);
riscv_clock_init();
systick_config(TMR_FREQ / RT_TICK_PER_SECOND); systick_config(TMR_FREQ / RT_TICK_PER_SECOND);
#ifdef RT_USING_HEAP #ifdef RT_USING_HEAP

View File

@ -7,6 +7,13 @@
#include "n22_func.h" #include "n22_func.h"
void _init() { void _init() {
}
void _fini() {
}
void riscv_clock_init(void) {
SystemInit(); SystemInit();
//ECLIC init //ECLIC init
@ -14,15 +21,4 @@ void _init() {
eclic_mode_enable(); eclic_mode_enable();
set_csr(mstatus, MSTATUS_MIE); set_csr(mstatus, MSTATUS_MIE);
//printf("After ECLIC mode enabled, the mtvec value is %x \n\n\r", read_csr(mtvec));
// // It must be NOTED:
// // * In the RISC-V arch, if user mode and PMP supported, then by default if PMP is not configured
// // with valid entries, then user mode cannot access any memory, and cannot execute any instructions.
// // * So if switch to user-mode and still want to continue, then you must configure PMP first
//pmp_open_all_space();
//switch_m2u_mode();
}
void _fini() {
} }