diff --git a/targets/riscv_nuclei_gd32vf103_soc_gcc/GCC/liteos_m.mk b/targets/riscv_nuclei_gd32vf103_soc_gcc/GCC/liteos_m.mk index ea0580bb..f540b08f 100644 --- a/targets/riscv_nuclei_gd32vf103_soc_gcc/GCC/liteos_m.mk +++ b/targets/riscv_nuclei_gd32vf103_soc_gcc/GCC/liteos_m.mk @@ -15,6 +15,12 @@ C_INCLUDES += -I$(LITEOSTOPDIR)/utils \ -I$(LITEOSTOPDIR)/components/backtrace \ -I$(LITEOSTOPDIR)/components/bounds_checking_function/include +#third party related +C_INCLUDES += -I$(LITEOSTOPDIR)/third_party/bounds_checking_function/include \ + -I$(LITEOSTOPDIR)/third_party/bounds_checking_function/src + +C_SOURCES += $(wildcard $(LITEOSTOPDIR)/third_party/bounds_checking_function/src/*.c) + # NMSIS related C_INCLUDES += -I$(LITEOSTOPDIR)/kernel/arch/risc-v/nuclei/gcc/nmsis/Core/Include \ -I$(LITEOSTOPDIR)/kernel/arch/risc-v/nuclei/gcc/nmsis/DSP/Include \ diff --git a/targets/riscv_nuclei_gd32vf103_soc_gcc/OS_CONFIG/target_config.h b/targets/riscv_nuclei_gd32vf103_soc_gcc/OS_CONFIG/target_config.h index 75482ddc..011edc46 100644 --- a/targets/riscv_nuclei_gd32vf103_soc_gcc/OS_CONFIG/target_config.h +++ b/targets/riscv_nuclei_gd32vf103_soc_gcc/OS_CONFIG/target_config.h @@ -43,12 +43,16 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ +#include "nuclei_sdk_soc.h" + /*============================================================================= System clock module configuration =============================================================================*/ -#define OS_SYS_CLOCK (108000000) +#define OS_SYS_CLOCK (SOC_TIMER_FREQ) #define LOSCFG_BASE_CORE_TICK_PER_SECOND (1000UL) #define LOSCFG_BASE_CORE_TICK_HW_TIME 0 +#define LOSCFG_BASE_CORE_TICK_WTIMER 1 +#define LOSCFG_BASE_CORE_SCHED_SLEEP 1 /*============================================================================= Hardware interrupt module configuration =============================================================================*/ @@ -63,7 +67,8 @@ extern "C" { #define LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE (0x200U) #define LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE (0x130U) #define LOSCFG_BASE_CORE_TIMESLICE 1 -#define LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT 10 +#define LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT 20000 +#define LOSCFG_BASE_CORE_TICK_RESPONSE_MAX 0xFFFFFF /*============================================================================= Semaphore module configuration =============================================================================*/ diff --git a/targets/riscv_nuclei_gd32vf103_soc_gcc/README.md b/targets/riscv_nuclei_gd32vf103_soc_gcc/README.md index 3b12ee86..cf31ff30 100644 --- a/targets/riscv_nuclei_gd32vf103_soc_gcc/README.md +++ b/targets/riscv_nuclei_gd32vf103_soc_gcc/README.md @@ -134,6 +134,8 @@ RV-STAR是一款基于GD32VF103 MCU的RISC-V评估开发板,提供了板载调 ### 编译源码 +使用`git clone`复制代码到任意目录下,打开进入到工程根目录下,输入`git submodule update --init --recursive`下载更新子模块。 + 编译前请在当前控制台中配置`NUCLEI_TOOL_ROOT`路径,假设`Nuclei`文件夹所在路径为`/home/Nuclei`,输入`export NUCLEI_TOOL_ROOT=/home/Nuclei` 。或者使用时make选项增加`NUCLEI_TOOL_ROOT=/home/Nuclei`。 配置路径后打开至代码根目录下的/target/riscv_nuclei_gd32vf103_soc_gcc/GCC位置,输入如下指令开始编译: diff --git a/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Board/gd32vf103v_rvstar/Include/gd32vf103v_rvstar.h b/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Board/gd32vf103v_rvstar/Include/gd32vf103v_rvstar.h index 60f1b0d5..25a6a9b7 100644 --- a/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Board/gd32vf103v_rvstar/Include/gd32vf103v_rvstar.h +++ b/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Board/gd32vf103v_rvstar/Include/gd32vf103v_rvstar.h @@ -117,7 +117,7 @@ uint8_t gd_key_state_get(key_typedef_enum keynum); /* configure COM port */ void gd_com_init(uint32_t usart_periph); -/* Defines for LED functio/* Defines for LED / Key functions to new / general API */ +/* Defines for LED functions Defines for LED / Key functions to new / general API */ #define gd_rvstar_led_init gd_led_init #define gd_rvstar_led_on gd_led_on #define gd_rvstar_led_off gd_led_off diff --git a/targets/riscv_nuclei_gd32vf103_soc_gcc/Src/main.c b/targets/riscv_nuclei_gd32vf103_soc_gcc/Src/main.c index 16c8fdf3..b6e58777 100644 --- a/targets/riscv_nuclei_gd32vf103_soc_gcc/Src/main.c +++ b/targets/riscv_nuclei_gd32vf103_soc_gcc/Src/main.c @@ -20,6 +20,7 @@ #include "nuclei_sdk_hal.h" #include "task_sample.h" #include "target_config.h" + void user_key_exti_config() { /* enable the AF clock */ @@ -38,12 +39,11 @@ void user_key_exti_config() */ int main(void) { - /* USER CODE BEGIN Init */ - gd_rvstar_key_init(WAKEUP_KEY_GPIO_PORT,KEY_MODE_EXTI); - user_key_exti_config(); - RunTaskSample(); - while (1) - { - } + /* USER CODE BEGIN Init */ + gd_rvstar_key_init(WAKEUP_KEY_GPIO_PORT, KEY_MODE_EXTI); + user_key_exti_config(); + RunTaskSample(); + while (1) { + } } -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ +/************************ (C) COPYRIGHT Nuclei *****END OF FILE****/ diff --git a/targets/riscv_nuclei_gd32vf103_soc_gcc/Src/task_sample.c b/targets/riscv_nuclei_gd32vf103_soc_gcc/Src/task_sample.c index 631df971..bb9fca31 100644 --- a/targets/riscv_nuclei_gd32vf103_soc_gcc/Src/task_sample.c +++ b/targets/riscv_nuclei_gd32vf103_soc_gcc/Src/task_sample.c @@ -52,23 +52,23 @@ UINT8 __attribute__ ((aligned (8))) g_memStart[OS_SYS_MEM_SIZE]; VOID TaskSampleEntry2(VOID) { while (1) { - LOS_TaskDelay(10000); /* 10 Seconds */ printf("TaskSampleEntry2 running...\n"); + LOS_TaskDelay(10000); /* 10 Seconds */ } } VOID TaskSampleEntry1(VOID) { while (1) { - LOS_TaskDelay(2000); /* 2 Seconds */ printf("TaskSampleEntry1 running...\n"); + LOS_TaskDelay(2000); /* 2 Seconds */ } } VOID EXTI0_IRQHandler(VOID) { - if (RESET != exti_interrupt_flag_get(WAKEUP_KEY_PIN)){ - if(RESET == gd_rvstar_key_state_get(KEY_WAKEUP)){ + if (RESET != exti_interrupt_flag_get(WAKEUP_KEY_PIN)) { + if (RESET == gd_rvstar_key_state_get(KEY_WAKEUP)) { HalDisplayTaskInfo(); } } @@ -101,7 +101,7 @@ VOID TaskSample(VOID) } HalHwiInit(); - HalHwiCreate(EXTI0_IRQn,9,ECLIC_NON_VECTOR_INTERRUPT,EXTI0_IRQHandler,ECLIC_LEVEL_TRIGGER); + HalHwiCreate(EXTI0_IRQn, 9, ECLIC_NON_VECTOR_INTERRUPT, EXTI0_IRQHandler, ECLIC_LEVEL_TRIGGER); } VOID RunTaskSample(VOID)