Developing with GigaDevice's RISC-V 32 Bits MCU Development Board
Development Environment
-
My host is an Arch Linux (x86_64) system. The target chip is a RISC-V 32 bits MCU. Therefore, install the riscv64-elf-
toolchain packages:
- riscv64-elf-binutils
- riscv64-elf-gcc
- riscv64-elf-newlib
- riscv64-elf-gdb
Here lists the supported architectures:
-
I prefer the Makefile tool. So, make is installed, too.
-
Also, need OpenOCD to flash and debug. I use the master
branch now.
- Nuclei SDK
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
- Schematic
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
- The MCU is GigaDevice's GD32VF103CBT6, or GD32VF103C8T6. It is according to the chip version on the board.
- RISC-V Microcontroller has GD32VF103_Firmware_Library. However, it suggests Nuclei SDK!?
Developing with Nuclei SDK
Prepare
I have some modification to use the bare-metal toolchain riscv64-elf-
:
- Use common RISC-V 64 bare-metal toolchain
- Set ISA spec version as 2.2 to support extension zicsr
- Use mainline OpenOCD's gd32vf103.cfg as the config. Besides, I use FTDI FT232HQ board as the the JTAG interface. So, use um232h.cfg as the config.
Have an LED application
I add the LED application.
- Get into the led app:
cd application/baremetal/led
- Disable the optimization for GDB with
-O0
.
- Build:
make SOC=gd32vf103 BOARD=gd32vf103c_longan_nano all
- Flash:
make SOC=gd32vf103 BOARD=gd32vf103c_longan_nano upload
- It will light RGB LEDs in order periodically.
Debugging
Debug with GDB via OpenOCD and FT232H as JTAG interface.
- Connect the
TCK
, TDO
, TDI
, TMS
and GND
pins between FT232H and the Sipeed Longan Nano board.
- Start the gdb server with FT232H as JTAG interface and GD32VF103 as the target configs:
It shows that the gdb server is listening on port 3333.
- Have the gdb client connecting to the gdb server to debug the
led.elf
flashed on the MCU chip GD32VF103C8T6:
Reference