diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/README.md b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/README.md index ac6520e45..e880c502b 100755 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/README.md +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/README.md @@ -62,31 +62,32 @@ cd kconfig-frontends ### 编译工具链: -RISC-V: riscv-none-embed-,默认安装到Ubuntu的/opt/,下载源码并解压。[下载网址 http://101.36.126.201:8011/gnu-mcu-eclipse.tar.bz2](http://101.36.126.201:8011/gnu-mcu-eclipse.tar.bz2) +RISC-V: riscv-nuclei-elf-,默认安装到Ubuntu的/opt/,下载源码并解压。[下载网址 https://www.nucleisys.com/download.php] +![vscode](img/riscv_gnu.png) ```shell -$ tar -xjf gnu-mcu-eclipse.tar.bz2 -C /opt/ +$ tar -xjf nuclei_riscv_newlibc_prebuilt_linux64_2020.08.tar.bz2 -C /opt/ ``` 将上述解压的编译工具链的路径添加到board/hifive1-rev-B/config.mk文件当中,例如: ``` -export CROSS_COMPILE ?=/opt/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.1-20190425-1021/bin/riscv-none-embed- +export CROSS_COMPILE ?=/opt/Nuclei/gcc/bin/riscv-nuclei-elf- ``` 若已存在`export CROSS_COMPILE ?=xxxx` 应该将原有的语句注释,再写入上面的语句。 -# 在gapuino board 上创建第一个应用 +# 在gd32vf103_rvstar board 上创建第一个应用 -## 1.gapuino board 简介 +## 1.gd32vf103_rvstar board 简介 | 硬件 | 描述 | | -- | -- | -|芯片型号| gap8 | +|芯片型号| gd32vf103 | |架构| RV32IMAC | -|主频| 200+MHz | -|片内SRAM| 512KB | -| 外设 | UART、SPI、I2C | +|主频| 108MHz | +|片内SRAM| 32KB | +| 外设 | Timer(高级16位定时器,通用16位定时器)、U(S)ART、I2C、SPI/I2S、CAN、USBFS、ADC(16路外部通道)、DAC、EXMC、GPIO | XiUOS板级当前支持使用UART。 @@ -108,7 +109,7 @@ XiUOS板级当前支持使用UART。 1.在VScode终端下执行以下命令,生成配置文件 ``` -make BOARD=gapuino menuconfig +make BOARD=gd32vf103_rvstar menuconfig ``` 2.在menuconfig界面配置需要关闭和开启的功能,按回车键进入下级菜单,按Y键选中需要开启的功能,按N键选中需要关闭的功能,配置结束后选择Exit保存并退出 @@ -118,40 +119,38 @@ make BOARD=gapuino menuconfig 3.继续执行以下命令,进行编译 ``` -make BOARD=gapuino +make BOARD=gd32vf103_rvstar ``` -4.如果编译正确无误,build文件夹下会产生XiUOS_gapuino.elf、XiUOS_gapuino.bin文件。 +4.如果编译正确无误,build文件夹下会产生XiUOS_gd32vf103_rvstar.elf、XiUOS_gd32vf103_rvstar.bin文件。 >注:最后可以执行以下命令,清除配置文件和编译生成的文件 ``` -make BOARD=gapuino distclean +make BOARD=gd32vf103_rvstar distclean ``` -## 3. 烧写及执行 +## 3. 烧写及调试执行 -gapuino支持jtag,可以通过jtag进行烧录和调试。 -调试烧写需要下载gap sdk和openocd,下载配置方法参见以下文档: -https://greenwaves-technologies.com/setting-up-sdk/ +rvstar支持openocd,可以通过openocd和gdb进行调试。 +调试需要下载openocd和nuclei sdk,下载配置方法参见以下文档: +https://doc.nucleisys.com/nuclei_sdk/quickstart.html#figure-quickstart-5 -在SDK 和openocd安装完成以后,按照如下步骤进行调试: +openocd安装完成以后,按照如下步骤进行调试: -1、进入sdk目录路径下 +1、进入xiuos目录路径下 ``` -cd ~/gap_sdk +cd ~/xiuos/Ubiquitous/XiUOS ``` -2、在当前终端输入 -``` -source sourceme.sh -``` -出现如下图所示的界面,输入7选择单板名称; -![choose](./img/choose_board.png) +2、编译生成elf文件 -3、先按开发板的复位键,再在当前终端输入 + +3、使用USB先和串口连接好开发板,进入openocd目录下,再在当前终端输入 ``` -gap8-openocd -f interface/ftdi/gapuino_ftdi.cfg -f target/gap8.tcl -f tcl/jtag_boot_entry.tcl +cd ~/Nuclei/openocd/0.10.0-15/bin + +./openocd -f ~/nuclei-sdk/SoC/gd32vf103/Board/gd32vf103v_rvstar/openocd_gd32vf103.cfg ``` 在当前终端连接openocd,连接如下图所示: ![openocd](./img/openocd.png) @@ -164,7 +163,7 @@ screen /dev/ttyUSB0 115200 5、打开一个新的终端,进入编译生成的elf路径,输入例如: ``` -riscv32-unknown-elf-gdb build/XiUOS_gapuino.elf -ex "target remote localhost:3333" +riscv-nuclei-elf-gdb build/XiUOS_gd32vf103_rvstar.elf -ex "target remote localhost:3333" ``` 结果如下图所示: ![gdb](./img/gdb_load.png) diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/board.c b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/board.c index 3e1ee1d3c..0655641fd 100755 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/board.c +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/board.c @@ -12,7 +12,7 @@ /** * @file board.c -* @brief support gap8 init configure and start-up +* @brief support rvstar init configure and start-up * @version 1.0 * @author AIIT XUOS Lab * @date 2021-09-02 diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/board.h b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/board.h index 750debd41..fee208c50 100755 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/board.h +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/board.h @@ -12,7 +12,7 @@ /** * @file board.h -* @brief define gapuino-board init configure and start-up function +* @brief define rvstar-board init configure and start-up function * @version 1.0 * @author AIIT XUOS Lab * @date 2021-09-02 @@ -20,14 +20,14 @@ /************************************************* File name: board.h -Description: define gapuino-board init configure and start-up function +Description: define rvstar-board init configure and start-up function Others: History: 1. Date: 2021-09-02 Author: AIIT XUOS Lab Modification: -1. define gapuino-board InitBoardHardware -2. define gapuino-board data and bss struct +1. define rvstar-board InitBoardHardware +2. define rvstar-board data and bss struct *************************************************/ #ifndef BOARD_H__ #define BOARD_H__ diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/config.mk b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/config.mk index b2ec28c46..203020e6f 100755 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/config.mk +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/config.mk @@ -1,20 +1,4 @@ -# export CFLAGS := -mcmodel=medany -march=rv32imac -mabi=ilp32 -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -O0 -ggdb -fgnu89-inline -Werror -# export AFLAGS := -c -mcmodel=medany -march=rv32imac -mabi=ilp32 -x assembler-with-cpp -ggdb -# export LFLAGS := --specs=nano.specs --specs=nosys.specs -nostartfiles -Wl,--gc-sections,-Map=XiUOS_gd32vf103.map,-cref,-u,_start -T $(BSP_ROOT)/link.lds - -# export APPLFLAGS := -mcmodel=medany -march=rv32imac -mabi=ilp32 -nostartfiles -Wl,--gc-sections,-Map=XiUOS_app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds - -# export CXXFLAGS := -mcmodel=medany -march=rv32imac -mabi=ilp32 -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -O0 -ggdb -Werror - -# export CROSS_COMPILE ?=/opt/Nuclei/gcc/bin/riscv-nuclei-elf- - -# export DEFINES := -DHAVE_CCONFIG_H -DHAVE_SIGINFO - -# export ARCH = risc-v -# export MCU = GD32VF103 - - export CFLAGS := -march=rv32imac -mabi=ilp32 -fno-common -ffunction-sections -fdata-sections -O0 -ggdb -fgnu89-inline -Werror export AFLAGS := -march=rv32imac -mabi=ilp32 -x assembler-with-cpp -ggdb export LFLAGS := -march=rv32imac -mabi=ilp32 -nostartfiles -Wl,--gc-sections,-Map=XiUOS_gd32vf103.map,-cref,-u,_start -T $(BSP_ROOT)/link.lds diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/gd32vf103v_rvstar.c b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/gd32vf103v_rvstar.c index 6d592b002..f60645331 100755 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/gd32vf103v_rvstar.c +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/gd32vf103v_rvstar.c @@ -5,6 +5,15 @@ * \version 2020-02-05, V1.0.0, rvstar board functions for GD32VF103 */ +/** +* @file gd32vf103_rvstar.c +* @brief add from nuclei SDK +* https://github.com/Nuclei-Software/nuclei-sdk +* @version 1.1 +* @author AIIT XUOS Lab +* @date 2021-12-03 +*/ + /* Copyright (c) 2019, GigaDevice Semiconductor Inc. diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/gdb_load.png b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/gdb_load.png new file mode 100644 index 000000000..854815a2d Binary files /dev/null and b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/gdb_load.png differ diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/menuconfig.png b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/menuconfig.png new file mode 100644 index 000000000..183423223 Binary files /dev/null and b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/menuconfig.png differ diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/openocd.png b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/openocd.png new file mode 100644 index 000000000..356b7254d Binary files /dev/null and b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/openocd.png differ diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/riscv_gnu.png b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/riscv_gnu.png new file mode 100644 index 000000000..f065e9f09 Binary files /dev/null and b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/riscv_gnu.png differ diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/terminal.png b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/terminal.png new file mode 100644 index 000000000..602810bd6 Binary files /dev/null and b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/terminal.png differ diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/vscode.jpg b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/vscode.jpg new file mode 100644 index 000000000..b9bacff78 Binary files /dev/null and b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/img/vscode.jpg differ diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/gpio/gd32vf103_gpio.c b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/gpio/gd32vf103_gpio.c index 7e36269a0..ce6c0bb0f 100755 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/gpio/gd32vf103_gpio.c +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/gpio/gd32vf103_gpio.c @@ -32,6 +32,15 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI OF SUCH DAMAGE. */ +/** +* @file gd32vf103_gpio.c +* @brief add from nuclei SDK +* https://github.com/Nuclei-Software/nuclei-sdk +* @version 1.1 +* @author AIIT XUOS Lab +* @date 2021-12-03 +*/ + #include "gd32vf103_gpio.h" #define AFIO_EXTI_SOURCE_MASK ((uint8_t)0x03U) /*!< AFIO exti source selection mask*/ diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/include/connect_uart.h b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/include/connect_uart.h index 1bfa45689..fe141d160 100755 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/include/connect_uart.h +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/include/connect_uart.h @@ -12,10 +12,10 @@ /** * @file connect_uart.h -* @brief define gap8-board uart function and struct +* @brief define rvstar uart function * @version 1.1 * @author AIIT XUOS Lab -* @date 2021-07-27 +* @date 2021-12-03 */ #ifndef CONNECT_UART_H diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/sys_clock/gd32vf103_rcu.c b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/sys_clock/gd32vf103_rcu.c index 49edb5815..edd36af4d 100755 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/sys_clock/gd32vf103_rcu.c +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/sys_clock/gd32vf103_rcu.c @@ -32,6 +32,15 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI OF SUCH DAMAGE. */ +/** +* @file gd32vf103_rcu.c +* @brief add from nuclei SDK +* https://github.com/Nuclei-Software/nuclei-sdk +* @version 1.1 +* @author AIIT XUOS Lab +* @date 2021-12-03 +*/ + #include "gd32vf103_rcu.h" diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/sys_clock/gd32vf103_soc.c b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/sys_clock/gd32vf103_soc.c index f09165fd7..43b90e694 100755 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/sys_clock/gd32vf103_soc.c +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/sys_clock/gd32vf103_soc.c @@ -1,3 +1,12 @@ +/** +* @file gd32vf103_soc.c +* @brief add from nuclei SDK +* https://github.com/Nuclei-Software/nuclei-sdk +* @version 1.1 +* @author AIIT XUOS Lab +* @date 2021-12-03 +*/ + #include "nuclei_sdk_soc.h" #include diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/system_gd32vf103.c b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/system_gd32vf103.c index d3e4a2272..294830816 100644 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/system_gd32vf103.c +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/system_gd32vf103.c @@ -23,6 +23,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/** +* @file system_gd32vf103.c +* @brief add from nuclei SDK +* https://github.com/Nuclei-Software/nuclei-sdk +* @version 1.1 +* @author AIIT XUOS Lab +* @date 2021-12-03 +*/ + #include #include #include "nuclei_sdk_hal.h" diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/uart/connect_uart.c b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/uart/connect_uart.c index 988e6d0e2..7f929ada1 100755 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/uart/connect_uart.c +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/uart/connect_uart.c @@ -12,10 +12,10 @@ /** * @file connect_usart.c -* @brief support gap8-board uart function and register to bus framework +* @brief supportrvstar-board uart function and register to bus framework * @version 1.1 * @author AIIT XUOS Lab -* @date 2021-09-02 +* @date 2021-12-03 */ #include diff --git a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/uart/gd32vf103_usart.c b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/uart/gd32vf103_usart.c index f2c44268b..9269ace87 100755 --- a/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/uart/gd32vf103_usart.c +++ b/Ubiquitous/XiUOS/board/gd32vf103_rvstar/third_party_driver/uart/gd32vf103_usart.c @@ -32,6 +32,15 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI OF SUCH DAMAGE. */ +/** +* @file gd32vf103_usart.c +* @brief add from nuclei SDK +* https://github.com/Nuclei-Software/nuclei-sdk +* @version 1.1 +* @author AIIT XUOS Lab +* @date 2021-12-03 +*/ + #include "gd32vf103_usart.h" /*!