forked from xuos/xiuos
add gd32vf103 'README.md'
This commit is contained in:
parent
19bd5a4705
commit
644f2bbf37
|
@ -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]
|
||||

|
||||
|
||||
```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选择单板名称;
|
||||

|
||||
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,连接如下图所示:
|
||||

|
||||
|
@ -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"
|
||||
```
|
||||
结果如下图所示:
|
||||

|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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__
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
|
@ -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*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
|
@ -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 <core_feature_timer.h>
|
||||
|
||||
|
|
|
@ -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 <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "nuclei_sdk_hal.h"
|
||||
|
|
|
@ -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 <xiuos.h>
|
||||
|
|
|
@ -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"
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Reference in New Issue