From 4c63055289b0c99d3889d7f1e8a0057c6973a6a6 Mon Sep 17 00:00:00 2001 From: Huaqi Fang <578567190@qq.com> Date: Fri, 15 Oct 2021 17:38:50 +0800 Subject: [PATCH] [bsp][nuclei] change hbird_eval bsp to nuclei_fpga_eval we no longer use hbird_eval to stand for board using by nuclei fpga development boards, we are now using nuclei_fpga_eval to stand for it. nowadays the fpga bitstream cpu freq is 16MHz, and uart tx/rx both works at 115200bps, so we change the baudrate to 115200bps Signed-off-by: Huaqi Fang <578567190@qq.com> --- bsp/nuclei/README.md | 2 +- .../{hbird => demosoc}/HAL_Drivers/SConscript | 0 .../HAL_Drivers/drv_config.h | 0 .../{hbird => demosoc}/HAL_Drivers/drv_uart.c | 7 +-- .../{hbird => demosoc}/HAL_Drivers/drv_uart.h | 0 .../{hbird_eval => nuclei_fpga_eval}/.config | 2 +- .../{hbird_eval => nuclei_fpga_eval}/Kconfig | 2 +- .../README.md | 46 +++++++++---------- .../SConscript | 0 .../SConstruct | 0 .../applications/SConscript | 0 .../applications/main.c | 0 .../board/Kconfig | 0 .../board/SConscript | 0 .../board/board.c | 0 .../board/board.h | 0 .../rtconfig.h | 2 +- .../rtconfig.py | 19 +++++--- 18 files changed, 43 insertions(+), 37 deletions(-) rename bsp/nuclei/libraries/{hbird => demosoc}/HAL_Drivers/SConscript (100%) rename bsp/nuclei/libraries/{hbird => demosoc}/HAL_Drivers/drv_config.h (100%) rename bsp/nuclei/libraries/{hbird => demosoc}/HAL_Drivers/drv_uart.c (96%) rename bsp/nuclei/libraries/{hbird => demosoc}/HAL_Drivers/drv_uart.h (100%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/.config (99%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/Kconfig (95%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/README.md (79%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/SConscript (100%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/SConstruct (100%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/applications/SConscript (100%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/applications/main.c (100%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/board/Kconfig (100%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/board/SConscript (100%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/board/board.c (100%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/board/board.h (100%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/rtconfig.h (99%) rename bsp/nuclei/{hbird_eval => nuclei_fpga_eval}/rtconfig.py (74%) diff --git a/bsp/nuclei/README.md b/bsp/nuclei/README.md index 8892c73bdb..5aab50c8d8 100644 --- a/bsp/nuclei/README.md +++ b/bsp/nuclei/README.md @@ -6,7 +6,7 @@ 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.rvmcu.com/quickstart-doc-u-rvstar.html) | -| [hbird_eval](hbird_eval) | [Nuclei HummingBird FPGA Evaluation Development Board](https://nucleisys.com/developboard.php#ddr200t) | +| [nuclei_fpga_eval](nuclei_fpga_eval) | [Nuclei FPGA Evaluation Development Board](https://nucleisys.com/developboard.php#ddr200t) | **If you want to learn more about Nuclei Processors, please click the following links:** diff --git a/bsp/nuclei/libraries/hbird/HAL_Drivers/SConscript b/bsp/nuclei/libraries/demosoc/HAL_Drivers/SConscript similarity index 100% rename from bsp/nuclei/libraries/hbird/HAL_Drivers/SConscript rename to bsp/nuclei/libraries/demosoc/HAL_Drivers/SConscript diff --git a/bsp/nuclei/libraries/hbird/HAL_Drivers/drv_config.h b/bsp/nuclei/libraries/demosoc/HAL_Drivers/drv_config.h similarity index 100% rename from bsp/nuclei/libraries/hbird/HAL_Drivers/drv_config.h rename to bsp/nuclei/libraries/demosoc/HAL_Drivers/drv_config.h diff --git a/bsp/nuclei/libraries/hbird/HAL_Drivers/drv_uart.c b/bsp/nuclei/libraries/demosoc/HAL_Drivers/drv_uart.c similarity index 96% rename from bsp/nuclei/libraries/hbird/HAL_Drivers/drv_uart.c rename to bsp/nuclei/libraries/demosoc/HAL_Drivers/drv_uart.c index 038ed0f0e9..3d1c0e8454 100644 --- a/bsp/nuclei/libraries/hbird/HAL_Drivers/drv_uart.c +++ b/bsp/nuclei/libraries/demosoc/HAL_Drivers/drv_uart.c @@ -187,9 +187,10 @@ void eclic_irq20_handler(void) #endif -/* For HBird Uart, when CPU freq is lower than 8M - The uart read will only work on baudrate <= 57600 */ -#define DRV_UART_BAUDRATE BAUD_RATE_57600 +/* For Nuclei demosoc Uart, when CPU freq is lower than 8M + The uart read will only work on baudrate <= 57600. + Nowadays, we usually distribute FPGA bitsteam with CPU Freq 16MHz */ +#define DRV_UART_BAUDRATE BAUD_RATE_115200 int rt_hw_uart_init(void) { diff --git a/bsp/nuclei/libraries/hbird/HAL_Drivers/drv_uart.h b/bsp/nuclei/libraries/demosoc/HAL_Drivers/drv_uart.h similarity index 100% rename from bsp/nuclei/libraries/hbird/HAL_Drivers/drv_uart.h rename to bsp/nuclei/libraries/demosoc/HAL_Drivers/drv_uart.h diff --git a/bsp/nuclei/hbird_eval/.config b/bsp/nuclei/nuclei_fpga_eval/.config similarity index 99% rename from bsp/nuclei/hbird_eval/.config rename to bsp/nuclei/nuclei_fpga_eval/.config index 4ffe820b8e..ae4579836b 100644 --- a/bsp/nuclei/hbird_eval/.config +++ b/bsp/nuclei/nuclei_fpga_eval/.config @@ -660,7 +660,7 @@ CONFIG_PKG_NUCLEI_SDK_VER="latest" # # Hardware Drivers Config # -CONFIG_SOC_HUMMINGBIRD=y +CONFIG_SOC_DEMOSOC=y # # Onboard Peripheral Drivers diff --git a/bsp/nuclei/hbird_eval/Kconfig b/bsp/nuclei/nuclei_fpga_eval/Kconfig similarity index 95% rename from bsp/nuclei/hbird_eval/Kconfig rename to bsp/nuclei/nuclei_fpga_eval/Kconfig index d41c1b45a2..0527005641 100644 --- a/bsp/nuclei/hbird_eval/Kconfig +++ b/bsp/nuclei/nuclei_fpga_eval/Kconfig @@ -19,7 +19,7 @@ source "$RTT_DIR/Kconfig" source "$PKGS_DIR/Kconfig" source "board/Kconfig" -config SOC_HUMMINGBIRD +config SOC_DEMOSOC bool select ARCH_RISCV select PKG_USING_NUCLEI_SDK diff --git a/bsp/nuclei/hbird_eval/README.md b/bsp/nuclei/nuclei_fpga_eval/README.md similarity index 79% rename from bsp/nuclei/hbird_eval/README.md rename to bsp/nuclei/nuclei_fpga_eval/README.md index 4d87066959..cb2254c322 100644 --- a/bsp/nuclei/hbird_eval/README.md +++ b/bsp/nuclei/nuclei_fpga_eval/README.md @@ -1,14 +1,14 @@ -# 芯来科技蜂鸟FPGA评估板 +# 芯来科技FPGA评估板 ## 简介 -**蜂鸟FPGA系列评估板** 是由芯来科技公司推出的用于一系列测试评估芯来RISC-V内核处理器的FPGA评估板。 +**芯来科技FPGA系列板** 是由芯来科技公司推出的用于一系列测试评估芯来RISC-V内核处理器的FPGA评估板。 -更多关于 **蜂鸟FPGA评估板** 开发板的详细资料请参见: +更多关于 **芯来科技FPGA评估板** 开发板的详细资料请参见: * [Nuclei DDR200T开发板](https://nucleisys.com/developboard.php#ddr200t) * [Nuclei MCU200T开发板](https://nucleisys.com/developboard.php#mcu200t) -* [蜂鸟开发板](https://nucleisys.com/developboard.php#hbird100t) +* [蜂鸟开发板](https://nucleisys.com/developboard.php#demosoc100t) ### 板载资源 @@ -16,7 +16,7 @@ | --- | --- | | 内核 | Nuclei RISC-V N/NX/UX 内核 | | 架构 | RV32 or RV64 | -| 主频 | 8MHz or uncertain freq | +| 主频 | 16MHz or uncertain freq | **注意**: 这个上面烧写的是FPGA bitstream文件,所以处理器内核版本根据型号来定,通过修改**rtconfig.py**中的**NUCLEI_SDK_CORE**. @@ -33,28 +33,28 @@ #### Windows -假设工具安装在 **D:\Software\Nuclei**目录下, 则可以修改系统环境变量**PATH**, -将**D:\Software\Nuclei\gcc\bin;D:\Software\Nuclei\openocd\bin;**增加到**PATH**中。 +假设工具安装在 **D:\NucleiStudio\toolchain**目录下, 则可以修改系统环境变量**PATH**, +将**D:\NucleiStudio\toolchain\gcc\bin;D:\NucleiStudio\toolchain\openocd\bin;**增加到**PATH**中。 或者在ENV工具命令行中运行 ~~~cmd -set PATH=D:\Software\Nuclei\gcc\bin;D:\Software\Nuclei\openocd\bin;%PATH% +set PATH=D:\NucleiStudio\toolchain\gcc\bin;D:\NucleiStudio\toolchain\openocd\bin;%PATH% ~~~ #### Linux -假设工具安装在 **~/Software/Nuclei**目录下, 通过在Linux的``.bashrc``增加如下一行代码 +假设工具安装在 **~/NucleiStudio/toolchain**目录下, 通过在Linux的``.bashrc``增加如下一行代码 来添加环境变量。 ~~~bash -export PATH=~/Software/Nuclei/gcc/bin:~/Software/Nuclei/openocd/bin:$PATH +export PATH=~/NucleiStudio/toolchain/gcc/bin:~/NucleiStudio/toolchain/openocd/bin:$PATH ~~~ 或者在ENV工具命令行中运行 ~~~bash -export PATH=~/Software/Nuclei/gcc/bin:~/Software/Nuclei/openocd/bin:$PATH +export PATH=~/NucleiStudio/toolchain/gcc/bin:~/NucleiStudio/toolchain/openocd/bin:$PATH ~~~ **注意**: 对应的RISC-V GCC和OPENOCD的路径请替换成自己安装的路径。 @@ -69,7 +69,7 @@ export PATH=~/Software/Nuclei/gcc/bin:~/Software/Nuclei/openocd/bin:$PATH 下载好[RT-Thread](https://github.com/RT-Thread/rt-thread)的代码和[ENV工具](https://www.rt-thread.org/document/site/tutorial/env-video/)以后。 -按照ENV工具的教程, 在**rt-thread\bsp\nuclei\hbird_eval**目录打开ENV工具命令行。 +按照ENV工具的教程, 在**rt-thread\bsp\nuclei\nuclei_fpga_eval**目录打开ENV工具命令行。 **注意**: 请确保Nuclei GCC和Nuclei OpenOCD的路径设置正确无误。 @@ -91,9 +91,9 @@ export PATH=~/Software/Nuclei/gcc/bin:~/Software/Nuclei/openocd/bin:$PATH ~~~ scons: Reading SConscript files ... -Supported downloaded modes for board hbird_eval are ('ilm', 'flash', 'flashxip'), chosen downloaded mode is ilm +Supported downloaded modes for board nuclei_fpga_eval are ('ilm', 'flash', 'flashxip'), chosen downloaded mode is ilm Upload application rtthread.elf using openocd and gdb -riscv-nuclei-elf-gdb rtthread.elf -ex "set remotetimeout 240" -ex "target remote | openocd --pipe -f D:/workspace/Sourcecode/rt-thread/bsp/nuclei/hbird_eval/packages/nuclei_sdk-latest/SoC/hbird/Board/hbird_eval/openocd_hbird.cfg" +riscv-nuclei-elf-gdb rtthread.elf -ex "set remotetimeout 240" -ex "target remote | openocd --pipe -f D:/workspace/Sourcecode/rt-thread/bsp/nuclei/nuclei_fpga_eval/packages/nuclei_sdk-latest/SoC/demosoc/Board/nuclei_fpga_eval/openocd_demosoc.cfg" --batch -ex "monitor halt" -ex "monitor flash protect 0 0 last off" -ex "load" -ex "monitor resume" -ex "monitor shutdown" -ex "quit" D:\Software\Nuclei\gcc\bin\riscv-nuclei-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory. Nuclei OpenOCD, i386 Open On-Chip Debugger 0.10.0+dev-g11f0cf429 (2020-07-15-04:09) @@ -119,11 +119,9 @@ Quit anyway? (y or n) [answered Y; input not from terminal] [Inferior 1 (Remote target) detached] ~~~ -下载程序之后, 连接**串口(57600-N-8-1)**, 可以看到 RT-Thread 的输出信息: +下载程序之后, 连接**串口(115200-N-8-1)**, 可以看到 RT-Thread 的输出信息: -> 由于FPGA评估的Nuclei RISC-V内核主频一般在8MHz左右, 而评估SoC串口 -> 在8MHz主频下,工作大于在115200 bps时,串口读取工作不正常,因此这里设置 -> 波特率为57600bps,特此说明. +> 最新发布出去的评估Bit一般都是16MHz, 串口工作在115200bps下串口读取可以正常工作. ``` initialize rti_board_start:0 done @@ -161,9 +159,9 @@ msh /> ~~~ scons: Reading SConscript files ... -Supported downloaded modes for board hbird_eval are ('ilm', 'flash', 'flashxip'), chosen downloaded mode is ilm +Supported downloaded modes for board nuclei_fpga_eval are ('ilm', 'flash', 'flashxip'), chosen downloaded mode is ilm Debug application rtthread.elf using openocd and gdb -riscv-nuclei-elf-gdb rtthread.elf -ex "set remotetimeout 240" -ex "target remote | openocd --pipe -f D:/workspace/Sourcecode/rt-thread/bsp/nuclei/hbird_eval/packages/nuclei_sdk-latest/SoC/hbird/Board/hbird_eval/openocd_hbird.cfg" +riscv-nuclei-elf-gdb rtthread.elf -ex "set remotetimeout 240" -ex "target remote | openocd --pipe -f D:/workspace/Sourcecode/rt-thread/bsp/nuclei/nuclei_fpga_eval/packages/nuclei_sdk-latest/SoC/demosoc/Board/nuclei_fpga_eval/openocd_demosoc.cfg" D:\Software\Nuclei\gcc\bin\riscv-nuclei-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory. GNU gdb (GDB) 8.3.0.20190516-git Copyright (C) 2019 Free Software Foundation, Inc. @@ -181,7 +179,7 @@ Find the GDB manual and other documentation resources online at: For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from rtthread.elf... -Remote debugging using | openocd --pipe -f D:/workspace/Sourcecode/rt-thread/bsp/nuclei/hbird_eval/packages/nuclei_sdk-latest/SoC/hbird/Board/hbird_eval/openocd_hbird.cfg +Remote debugging using | openocd --pipe -f D:/workspace/Sourcecode/rt-thread/bsp/nuclei/nuclei_fpga_eval/packages/nuclei_sdk-latest/SoC/demosoc/Board/nuclei_fpga_eval/openocd_demosoc.cfg Nuclei OpenOCD, i386 Open On-Chip Debugger 0.10.0+dev-g11f0cf429 (2020-07-15-04:09) Licensed under GNU GPL v2 For bug reports, read @@ -215,7 +213,7 @@ Continuing. * https://doc.nucleisys.com/nuclei_sdk/quickstart.html#debug-application 为了更方便的进行调试, 也可以下载**Nuclei Studio**集成开发环境, 创建一个Debug Configuration, 选择编译好的 -ELF文件, 然后配置OPENOCD和GDB即可, OPENOCD配置文件路径为**bsp\nuclei\hbird_eval\packages\nuclei_sdk-latest\SoC\hbird\Board\hbird_eval\openocd_hbird.cfg** +ELF文件, 然后配置OPENOCD和GDB即可, OPENOCD配置文件路径为**bsp\nuclei\nuclei_fpga_eval\packages\nuclei_sdk-latest\SoC\demosoc\Board\nuclei_fpga_eval\openocd_demosoc.cfg** ## 驱动支持情况 @@ -226,9 +224,9 @@ ELF文件, 然后配置OPENOCD和GDB即可, OPENOCD配置文件路径为**bsp\nu **注:** -- 适配RT-Thread的驱动框架的代码在 [../libraries/hbird/HAL_Drivers](../libraries/hbird/HAL_Drivers)目录下。 +- 适配RT-Thread的驱动框架的代码在 [../libraries/demosoc/HAL_Drivers](../libraries/demosoc/HAL_Drivers)目录下。 - 如果有开发者想适配更多的驱动, 请在对应目录下增加驱动适配支持。 -- 目前串口读取功能在主频为8MHz情况下需要工作在57600bps +- 目前串口读取功能在主频为8MHz情况下需要工作在57600bps, 目前发布的Bit一般都是16Mhz - 目前串口读取没有采用中断的方式进行,而是采用单独的任务来读取,等中断信号接入后可以直接中断方式读取 ## 联系人信息 diff --git a/bsp/nuclei/hbird_eval/SConscript b/bsp/nuclei/nuclei_fpga_eval/SConscript similarity index 100% rename from bsp/nuclei/hbird_eval/SConscript rename to bsp/nuclei/nuclei_fpga_eval/SConscript diff --git a/bsp/nuclei/hbird_eval/SConstruct b/bsp/nuclei/nuclei_fpga_eval/SConstruct similarity index 100% rename from bsp/nuclei/hbird_eval/SConstruct rename to bsp/nuclei/nuclei_fpga_eval/SConstruct diff --git a/bsp/nuclei/hbird_eval/applications/SConscript b/bsp/nuclei/nuclei_fpga_eval/applications/SConscript similarity index 100% rename from bsp/nuclei/hbird_eval/applications/SConscript rename to bsp/nuclei/nuclei_fpga_eval/applications/SConscript diff --git a/bsp/nuclei/hbird_eval/applications/main.c b/bsp/nuclei/nuclei_fpga_eval/applications/main.c similarity index 100% rename from bsp/nuclei/hbird_eval/applications/main.c rename to bsp/nuclei/nuclei_fpga_eval/applications/main.c diff --git a/bsp/nuclei/hbird_eval/board/Kconfig b/bsp/nuclei/nuclei_fpga_eval/board/Kconfig similarity index 100% rename from bsp/nuclei/hbird_eval/board/Kconfig rename to bsp/nuclei/nuclei_fpga_eval/board/Kconfig diff --git a/bsp/nuclei/hbird_eval/board/SConscript b/bsp/nuclei/nuclei_fpga_eval/board/SConscript similarity index 100% rename from bsp/nuclei/hbird_eval/board/SConscript rename to bsp/nuclei/nuclei_fpga_eval/board/SConscript diff --git a/bsp/nuclei/hbird_eval/board/board.c b/bsp/nuclei/nuclei_fpga_eval/board/board.c similarity index 100% rename from bsp/nuclei/hbird_eval/board/board.c rename to bsp/nuclei/nuclei_fpga_eval/board/board.c diff --git a/bsp/nuclei/hbird_eval/board/board.h b/bsp/nuclei/nuclei_fpga_eval/board/board.h similarity index 100% rename from bsp/nuclei/hbird_eval/board/board.h rename to bsp/nuclei/nuclei_fpga_eval/board/board.h diff --git a/bsp/nuclei/hbird_eval/rtconfig.h b/bsp/nuclei/nuclei_fpga_eval/rtconfig.h similarity index 99% rename from bsp/nuclei/hbird_eval/rtconfig.h rename to bsp/nuclei/nuclei_fpga_eval/rtconfig.h index 8b2faff9fd..604545bfe5 100644 --- a/bsp/nuclei/hbird_eval/rtconfig.h +++ b/bsp/nuclei/nuclei_fpga_eval/rtconfig.h @@ -227,7 +227,7 @@ /* Hardware Drivers Config */ -#define SOC_HUMMINGBIRD +#define SOC_DEMOSOC /* Onboard Peripheral Drivers */ diff --git a/bsp/nuclei/hbird_eval/rtconfig.py b/bsp/nuclei/nuclei_fpga_eval/rtconfig.py similarity index 74% rename from bsp/nuclei/hbird_eval/rtconfig.py rename to bsp/nuclei/nuclei_fpga_eval/rtconfig.py index 62e20033cb..d1871e3b31 100644 --- a/bsp/nuclei/hbird_eval/rtconfig.py +++ b/bsp/nuclei/nuclei_fpga_eval/rtconfig.py @@ -1,4 +1,5 @@ import os +import platform # toolchains options ARCH='risc-v' @@ -10,17 +11,23 @@ if os.getenv('RTT_CC'): if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' - EXEC_PATH = 'D:/Software/Nuclei/gcc/bin' + if platform.system().lower() == "windows": + EXEC_PATH = 'D:/NucleiStudio/toolchain/gcc/bin' + else: + EXEC_PATH = '~/NucleiStudio/toolchain/gcc/bin' + if os.path.exists(EXEC_PATH) == False: + print("Warning: Toolchain path %s doesn't exist, assume it is already in PATH" % EXEC_PATH) + EXEC_PATH = '' # Don't set path if not exist else: - print("CROSS_TOOL = {} not yet supported" % CROSS_TOOL) + print("CROSS_TOOL = %s not yet supported" % CROSS_TOOL) -# if os.getenv('RTT_EXEC_PATH'): -# EXEC_PATH = os.getenv('RTT_EXEC_PATH') +if os.getenv('RTT_EXEC_PATH'): + EXEC_PATH = os.getenv('RTT_EXEC_PATH') BUILD = 'debug' # Fixed configurations below -NUCLEI_SDK_SOC = "hbird" -NUCLEI_SDK_BOARD = "hbird_eval" +NUCLEI_SDK_SOC = "demosoc" +NUCLEI_SDK_BOARD = "nuclei_fpga_eval" # Configurable options below # DOWNLOAD: https://doc.nucleisys.com/nuclei_sdk/develop/buildsystem.html#download NUCLEI_SDK_DOWNLOAD = "ilm"