From a85193fc759ae1b7e692025f12ae59637232a730 Mon Sep 17 00:00:00 2001 From: WKJay <1931048074@qq.com> Date: Fri, 11 Dec 2020 14:58:20 +0800 Subject: [PATCH 1/7] [FIX] fix build problem in drv_crypto.c --- bsp/stm32/libraries/HAL_Drivers/drv_crypto.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_crypto.c b/bsp/stm32/libraries/HAL_Drivers/drv_crypto.c index a6723f8a70..b093516ca5 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_crypto.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_crypto.c @@ -9,6 +9,7 @@ * 2020-10-14 Dozingfiretruck Porting for stm32wbxx * 2020-11-26 thread-liu add hash * 2020-11-26 thread-liu add cryp + * 2020-12-11 WKJay fix build problem */ #include @@ -628,6 +629,7 @@ static void _crypto_reset(struct rt_hwcrypto_ctx *ctx) } } +#if defined(HASH2_IN_DMA_INSTANCE) void HASH2_DMA_IN_IRQHandler(void) { extern DMA_HandleTypeDef hdma_hash_in; @@ -640,7 +642,9 @@ void HASH2_DMA_IN_IRQHandler(void) /* leave interrupt */ rt_interrupt_leave(); } +#endif +#if defined(CRYP2_IN_DMA_INSTANCE) void CRYP2_DMA_IN_IRQHandler(void) { extern DMA_HandleTypeDef hdma_cryp_in; @@ -653,7 +657,9 @@ void CRYP2_DMA_IN_IRQHandler(void) /* leave interrupt */ rt_interrupt_leave(); } +#endif +#if defined (CRYP2_OUT_DMA_INSTANCE) void CRYP2_DMA_OUT_IRQHandler(void) { extern DMA_HandleTypeDef hdma_cryp_out; @@ -666,6 +672,7 @@ void CRYP2_DMA_OUT_IRQHandler(void) /* leave interrupt */ rt_interrupt_leave(); } +#endif static const struct rt_hwcrypto_ops _ops = { From e7ed7642540ba97045cd0c717d503431d4eea371 Mon Sep 17 00:00:00 2001 From: Prry <445395670@qq.com> Date: Sat, 19 Dec 2020 12:23:37 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0TOF=E4=BC=A0=E6=84=9F?= =?UTF-8?q?=E5=99=A8=E6=8F=8F=E8=BF=B0=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/sensors/sensor.c | 3 ++- components/drivers/sensors/sensor.h | 1 + components/drivers/sensors/sensor_cmd.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/drivers/sensors/sensor.c b/components/drivers/sensors/sensor.c index eb5c97a574..07999c73b3 100644 --- a/components/drivers/sensors/sensor.c +++ b/components/drivers/sensors/sensor.c @@ -35,7 +35,8 @@ static char *const sensor_name_str[] = "forc_", /* Force sensor */ "dust_", /* Dust sensor */ "eco2_", /* eCO2 sensor */ - "gnss_" /* GPS/GNSS sensor */ + "gnss_", /* GPS/GNSS sensor */ + "tof_" /* TOF sensor */ }; /* Sensor interrupt correlation function */ diff --git a/components/drivers/sensors/sensor.h b/components/drivers/sensors/sensor.h index 5a069edc25..b180e36a73 100755 --- a/components/drivers/sensors/sensor.h +++ b/components/drivers/sensors/sensor.h @@ -48,6 +48,7 @@ extern "C" { #define RT_SENSOR_CLASS_DUST (14) /* Dust sensor */ #define RT_SENSOR_CLASS_ECO2 (15) /* eCO2 sensor */ #define RT_SENSOR_CLASS_GNSS (16) /* GPS/GNSS sensor */ +#define RT_SENSOR_CLASS_TOF (17) /* TOF sensor */ /* Sensor vendor types */ diff --git a/components/drivers/sensors/sensor_cmd.c b/components/drivers/sensors/sensor_cmd.c index 284db75cf6..09887d4b5f 100755 --- a/components/drivers/sensors/sensor_cmd.c +++ b/components/drivers/sensors/sensor_cmd.c @@ -50,6 +50,7 @@ static void sensor_show_data(rt_size_t num, rt_sensor_t sensor, struct rt_sensor LOG_I("num:%3d, light:%5d lux, timestamp:%5d", num, sensor_data->data.light, sensor_data->timestamp); break; case RT_SENSOR_CLASS_PROXIMITY: + case RT_SENSOR_CLASS_TOF: LOG_I("num:%3d, distance:%5d, timestamp:%5d", num, sensor_data->data.proximity, sensor_data->timestamp); break; case RT_SENSOR_CLASS_HR: From a38e7768ac9037b6c530dabdea90747e6dbd2a88 Mon Sep 17 00:00:00 2001 From: Prry <445395670@qq.com> Date: Sun, 20 Dec 2020 22:23:28 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E7=BC=A9=E8=BF=9B=E7=94=B1=E2=80=9CTAB?= =?UTF-8?q?=E9=94=AE=E2=80=9D=E6=94=B9=E7=94=A8=E4=B8=BA=E2=80=9C=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/sensors/sensor.c | 2 +- components/drivers/sensors/sensor_cmd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/drivers/sensors/sensor.c b/components/drivers/sensors/sensor.c index 07999c73b3..bbfcea97be 100644 --- a/components/drivers/sensors/sensor.c +++ b/components/drivers/sensors/sensor.c @@ -36,7 +36,7 @@ static char *const sensor_name_str[] = "dust_", /* Dust sensor */ "eco2_", /* eCO2 sensor */ "gnss_", /* GPS/GNSS sensor */ - "tof_" /* TOF sensor */ + "tof_" /* TOF sensor */ }; /* Sensor interrupt correlation function */ diff --git a/components/drivers/sensors/sensor_cmd.c b/components/drivers/sensors/sensor_cmd.c index 09887d4b5f..cbf7d233c6 100755 --- a/components/drivers/sensors/sensor_cmd.c +++ b/components/drivers/sensors/sensor_cmd.c @@ -50,7 +50,7 @@ static void sensor_show_data(rt_size_t num, rt_sensor_t sensor, struct rt_sensor LOG_I("num:%3d, light:%5d lux, timestamp:%5d", num, sensor_data->data.light, sensor_data->timestamp); break; case RT_SENSOR_CLASS_PROXIMITY: - case RT_SENSOR_CLASS_TOF: + case RT_SENSOR_CLASS_TOF: LOG_I("num:%3d, distance:%5d, timestamp:%5d", num, sensor_data->data.proximity, sensor_data->timestamp); break; case RT_SENSOR_CLASS_HR: From e765c36bbbcba5893056b5093e26819f5ce300b5 Mon Sep 17 00:00:00 2001 From: Huaqi Fang <578567190@qq.com> Date: Mon, 21 Dec 2020 16:27:44 +0800 Subject: [PATCH 4/7] bsp/nuclei: Fix scons --run=upload command output message not match issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although the program elf is uploaded successfully, the upload message is still "Remote communication error.“, but actually upload works. After fix, it will be "[Inferior 1 (Remote target) detached]" By the way, I also checked latest nuclei-sdk 0.3.0 release with latest rt-thread source code Signed-off-by: Huaqi Fang <578567190@qq.com> --- bsp/nuclei/README.md | 12 ++++++------ bsp/nuclei/gd32vf103_rvstar/README.md | 4 ++-- bsp/nuclei/gd32vf103_rvstar/SConstruct | 2 +- bsp/nuclei/hbird_eval/README.md | 16 +++++++++++----- bsp/nuclei/hbird_eval/SConstruct | 2 +- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/bsp/nuclei/README.md b/bsp/nuclei/README.md index cd043b1527..8892c73bdb 100644 --- a/bsp/nuclei/README.md +++ b/bsp/nuclei/README.md @@ -1,12 +1,12 @@ # Nuclei RISC-V Processor Support Package -This directory provided support for [Nuclei RISC-V Processor](https://nucleisys.com/) based board, +This directory provided support for [Nuclei RISC-V Processor](https://nucleisys.com/) based boards, currently we mainly provided the following board support packages. -| **BSP** | **Development Board Name** | -| :----------------------------------- | :-------------------------------------------------------------------------------------------------------------------------- | -| [gd32vf103_rvstar](gd32vf103_rvstar) | [Nuclei RV-STAR Arduino Compatible Development Board](https://www.riscv-mcu.com/quickstart-quickstart-index-u-RV_STAR.html) | -| [hbird_eval](hbird_eval) | [Nuclei HummingBird FPGA Evaluation Development Board](https://nucleisys.com/developboard.php) | +| **BSP** | **Development Board Name** | +| :----------------------------------- | :--------------------------------------------------------------------------------------------------------- | +| [gd32vf103_rvstar](gd32vf103_rvstar) | [Nuclei RV-STAR Arduino Compatible Development Board](https://www.rvmcu.com/quickstart-doc-u-rvstar.html) | +| [hbird_eval](hbird_eval) | [Nuclei HummingBird FPGA Evaluation Development Board](https://nucleisys.com/developboard.php#ddr200t) | **If you want to learn more about Nuclei Processors, please click the following links:** @@ -16,6 +16,6 @@ currently we mainly provided the following board support packages. * [RISC-V MCU Open Source Software Organization in Github](https://github.com/riscv-mcu/) * [RISC-V MCU Open Source Software Organization in Gitee](https://gitee.com/riscv-mcu/) * [Professional Nuclei Processor Development Boards](https://nucleisys.com/developboard.php) -* [Comprehensive Documents and Development Tools](https://nucleisys.com/download.php) +* [Comprehensive Documents and Development Tools](https://nucleisys.com/download.php#tools) * [Active RISC-V IP and MCU Community](https://www.rvmcu.com/) * [Professional University Program](https://nucleisys.com/campus.php) diff --git a/bsp/nuclei/gd32vf103_rvstar/README.md b/bsp/nuclei/gd32vf103_rvstar/README.md index 5b8c61804a..6b3548e705 100644 --- a/bsp/nuclei/gd32vf103_rvstar/README.md +++ b/bsp/nuclei/gd32vf103_rvstar/README.md @@ -4,7 +4,7 @@ **RVSTAR开发板** 是由[芯来科技Nuclei](https://nucleisys.com/)公司推出的基于采用芯来科技RISC-V架构处理器芯片的GD32VF103的开发板。 -更多关于 **RVSTAR开发板** 开发板的详细资料请参见 [RVSTAR开发板快速入门](https://www.rvmcu.com/quickstart-quickstart-index-u-RV_STAR.html) +更多关于 **RVSTAR开发板** 开发板的详细资料请参见 [RVSTAR开发板快速入门](https://www.rvmcu.com/quickstart-doc-u-rvstar.html) ### 板载资源 @@ -103,7 +103,7 @@ A debugging session is active. Inferior 1 [Remote target] will be detached. Quit anyway? (y or n) [answered Y; input not from terminal] -Remote communication error. Target disconnected.: Success. +[Inferior 1 (Remote target) detached] ~~~ 下载程序之后, 连接串口(115200-N-8-1), 可以看到 RT-Thread 的输出信息: diff --git a/bsp/nuclei/gd32vf103_rvstar/SConstruct b/bsp/nuclei/gd32vf103_rvstar/SConstruct index 58c5d745d7..11e4a3ee3c 100644 --- a/bsp/nuclei/gd32vf103_rvstar/SConstruct +++ b/bsp/nuclei/gd32vf103_rvstar/SConstruct @@ -75,7 +75,7 @@ if run_target in SUPPORT_RUN_TARGETS: upload_cmd = '{} {} -ex "set remotetimeout 240" \ -ex "target remote | openocd --pipe -f {}" \ --batch -ex "monitor halt" -ex "monitor flash protect 0 0 last off" -ex "load" \ - -ex "monitor resume" -ex "monitor shutdown" -ex "quit"'.format(GDB, TARGET, openocd_cfg) + -ex "monitor resume" -ex "quit"'.format(GDB, TARGET, openocd_cfg) print("Upload application {} using openocd and gdb".format(TARGET)) print(upload_cmd) os.system(upload_cmd) diff --git a/bsp/nuclei/hbird_eval/README.md b/bsp/nuclei/hbird_eval/README.md index 6664ed5a32..4d87066959 100644 --- a/bsp/nuclei/hbird_eval/README.md +++ b/bsp/nuclei/hbird_eval/README.md @@ -1,10 +1,14 @@ -# 芯来科技蜂鸟FPGA评估板 # +# 芯来科技蜂鸟FPGA评估板 ## 简介 -**蜂鸟FPGA评估板** 是由芯来科技公司推出的用于测试评估芯来RISC-V内核处理器的FPGA评估板。 +**蜂鸟FPGA系列评估板** 是由芯来科技公司推出的用于一系列测试评估芯来RISC-V内核处理器的FPGA评估板。 -更多关于 **蜂鸟FPGA评估板** 开发板的详细资料请参见 [蜂鸟FPGA评估板](https://nucleisys.com/developboard.php) +更多关于 **蜂鸟FPGA评估板** 开发板的详细资料请参见: + +* [Nuclei DDR200T开发板](https://nucleisys.com/developboard.php#ddr200t) +* [Nuclei MCU200T开发板](https://nucleisys.com/developboard.php#mcu200t) +* [蜂鸟开发板](https://nucleisys.com/developboard.php#hbird100t) ### 板载资源 @@ -57,7 +61,9 @@ export PATH=~/Software/Nuclei/gcc/bin:~/Software/Nuclei/openocd/bin:$PATH ## 烧写及执行 -### [驱动设置](https://nucleisys.com/developboard.php) +### 驱动设置 + +驱动安装设置,请参考[Nuclei FPGA开发板介绍](https://nucleisys.com/upload/files/fpga/doc/Nuclei_FPGA_DebugKit_Intro_202012.pdf) ### 编译程序 @@ -110,7 +116,7 @@ A debugging session is active. Inferior 1 [Remote target] will be detached. Quit anyway? (y or n) [answered Y; input not from terminal] -Remote communication error. Target disconnected.: Success. +[Inferior 1 (Remote target) detached] ~~~ 下载程序之后, 连接**串口(57600-N-8-1)**, 可以看到 RT-Thread 的输出信息: diff --git a/bsp/nuclei/hbird_eval/SConstruct b/bsp/nuclei/hbird_eval/SConstruct index 58c5d745d7..11e4a3ee3c 100644 --- a/bsp/nuclei/hbird_eval/SConstruct +++ b/bsp/nuclei/hbird_eval/SConstruct @@ -75,7 +75,7 @@ if run_target in SUPPORT_RUN_TARGETS: upload_cmd = '{} {} -ex "set remotetimeout 240" \ -ex "target remote | openocd --pipe -f {}" \ --batch -ex "monitor halt" -ex "monitor flash protect 0 0 last off" -ex "load" \ - -ex "monitor resume" -ex "monitor shutdown" -ex "quit"'.format(GDB, TARGET, openocd_cfg) + -ex "monitor resume" -ex "quit"'.format(GDB, TARGET, openocd_cfg) print("Upload application {} using openocd and gdb".format(TARGET)) print(upload_cmd) os.system(upload_cmd) From 76b6d7f90d07bb81a32953aae0f5b4c42e02c7a1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Dec 2020 10:35:26 +0800 Subject: [PATCH 5/7] fix scheduler bug in simulator. --- libcpu/sim/win32/cpu_port.c | 22 ++++++++++++++++++++++ libcpu/sim/win32/cpu_port.h | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/libcpu/sim/win32/cpu_port.c b/libcpu/sim/win32/cpu_port.c index 6bf3c79cf7..6caaa063aa 100644 --- a/libcpu/sim/win32/cpu_port.c +++ b/libcpu/sim/win32/cpu_port.c @@ -27,6 +27,8 @@ * The context switch is managed by the threads.So the task stack does not have to be managed directly, * although the stack stack is still used to hold an WinThreadState structure this is the only thing it * will be ever hold. +* YieldEvent used to make sure the thread does not execute before asynchronous SuspendThread() operation +* actually being performed. * the structure indirectly maps the task handle to a thread handle ********************************************************************************************************* */ @@ -35,6 +37,7 @@ typedef struct void *Param; //Thread param void (*Entry)(void *); //Thread entry void (*Exit)(void); //Thread exit + HANDLE YieldEvent; HANDLE ThreadHandle; DWORD ThreadID; }win_thread_t; @@ -171,6 +174,11 @@ rt_uint8_t* rt_hw_stack_init(void *pEntry,void *pParam,rt_uint8_t *pStackAddr,vo pWinThread->ThreadHandle = NULL; pWinThread->ThreadID = 0; + pWinThread->YieldEvent = CreateEvent(NULL, + FALSE, + FALSE, + NULL); + /* Create the winthread */ pWinThread->ThreadHandle = CreateThread(NULL, 0, @@ -277,6 +285,19 @@ void rt_hw_context_switch(rt_uint32_t from, //trigger YIELD exception(cause contex switch) TriggerSimulateInterrupt(CPU_INTERRUPT_YIELD); + // make sure the event is not already signaled + WinThread = (win_thread_t *)rt_interrupt_from_thread; + ResetEvent(WinThread->YieldEvent); + + /* + * enable interrupt in advance so that scheduler can be executed.please note that interrupt + * maybe disable twice before. + */ + rt_hw_interrupt_enable(0); + rt_hw_interrupt_enable(0); + + // wait to suspend. + WaitForSingleObject(WinThread->YieldEvent, INFINITE); } /*** rt_hw_context_switch ***/ /* @@ -578,6 +599,7 @@ void RegisterSimulateInterrupt(rt_uint32_t IntIndex,rt_uint32_t (*IntHandler)(vo if ((WinThreadFrom != NULL) && (WinThreadFrom->ThreadHandle != NULL)) { SuspendThread(WinThreadFrom->ThreadHandle); + SetEvent(WinThreadFrom->YieldEvent); } ResumeThread(WinThreadTo->ThreadHandle); diff --git a/libcpu/sim/win32/cpu_port.h b/libcpu/sim/win32/cpu_port.h index 8ab8ae23bd..cccdd48d42 100644 --- a/libcpu/sim/win32/cpu_port.h +++ b/libcpu/sim/win32/cpu_port.h @@ -17,8 +17,8 @@ * CPU INTERRUPT PRIORITY ********************************************************************************************************* */ -#define CPU_INTERRUPT_YIELD 0x00 -#define CPU_INTERRUPT_TICK 0x01 +#define CPU_INTERRUPT_YIELD 0x01 // should be set to the lowest priority. +#define CPU_INTERRUPT_TICK 0x00 From 82ae97e24898253c344a90ac21e4df04690304a4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Dec 2020 11:13:46 +0800 Subject: [PATCH 6/7] fix build error --- libcpu/sim/win32/cpu_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpu/sim/win32/cpu_port.c b/libcpu/sim/win32/cpu_port.c index 6caaa063aa..cc8ad9a25c 100644 --- a/libcpu/sim/win32/cpu_port.c +++ b/libcpu/sim/win32/cpu_port.c @@ -286,7 +286,7 @@ void rt_hw_context_switch(rt_uint32_t from, TriggerSimulateInterrupt(CPU_INTERRUPT_YIELD); // make sure the event is not already signaled - WinThread = (win_thread_t *)rt_interrupt_from_thread; + win_thread_t *WinThread = (win_thread_t *)rt_interrupt_from_thread; ResetEvent(WinThread->YieldEvent); /* From 9626515787f0f7adf26f807f96a241777adba232 Mon Sep 17 00:00:00 2001 From: DUXin-ece Date: Wed, 23 Dec 2020 14:50:47 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=AD=A3stm32f746-disco=E5=92=8CF?= =?UTF-8?q?PU=E7=9B=B8=E5=85=B3=E7=9A=84flag=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/stm32f746-st-disco/rtconfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/stm32/stm32f746-st-disco/rtconfig.py b/bsp/stm32/stm32f746-st-disco/rtconfig.py index 32cb0dd9d4..de934eeac7 100644 --- a/bsp/stm32/stm32f746-st-disco/rtconfig.py +++ b/bsp/stm32/stm32f746-st-disco/rtconfig.py @@ -42,7 +42,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' STRIP = PREFIX + 'strip' - DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' + DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' CFLAGS = DEVICE + ' -g -Wall' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'