Embedded Software & Hardware


allpcb.com - World's Fastest PCB Manufacturing allpcb_logo

GD32V RISC-V


GigaDevice GD32VF103VBT6

GD32VF103 RISC-V 32-bit MCU Datasheet


https://github.com/riscv-mcu/GD32VF103_Firmware_Library


SeeedStudio GD32V RISC-V Dev Board

gd32v_board

GD32V PlatformIO

GD32VF103VBT6 + JTAG-lock-pick Tiny + PlatformIO



LED D48 - PB5
LED D50 - PB1
LED D49 - PB0

KEY 1 - PA0
KEY 2 - PC13

SDA - PB7
SCL - PB6



DFU Tools (seeedstudio.com)



Gigadevice DFU Tool



retro.v - very simplistic implementation of RISC-V architecture RV32I
https://gitlab.com/nedopc/npc5/-/blob/master/Verilog/Retro-V-v1_0_0/retro.v

picorv32 - A Size-Optimized RISC-V CPU

https://github.com/kunalg123/picorv32



... the GD-LINK uses the CMSIS-DAP interface



Info : JTAG tap: riscv.cpu tap/device found: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
Info : JTAG tap: auto0.tap tap/device found: 0x790007a3 (mfg: 0x3d1 (GigaDevice Semiconductor (Beijing)), part: 0x9000, ver: 0x7)


run jlink GDB server:

"C:\Program Files (x86)\SEGGER\JLink_V672a\JLinkGDBServerCL" -singlerun -select USB -port 2331 -device GD32VF103VBT6


GBD connect to jlink

Start GDB from xPack GNU RISC-V Embedded (github)
riscv-none-embed-gdb.exe firmware.elf

or GDB from platformio

riscv-nuclei-elf-gdb.exe firmware.elf

(gdb) target remote localhost:2331


(gdb) load

Loading section .init, size 0x236 lma 0x8000000
Loading section .text, size 0x30a2 lma 0x8000240
Loading section .sdata2.COM_CLK, size 0x8 lma 0x80032e4
Loading section .sdata2.COM_GPIO_CLK, size 0x8 lma 0x80032ec
Loading section .sdata2.COM_GPIO_PORT, size 0x8 lma 0x80032f4
Loading section .sdata2.COM_RX_PIN, size 0x8 lma 0x80032fc
Loading section .sdata2.COM_TX_PIN, size 0x8 lma 0x8003304
Loading section .sdata2._global_impure_ptr, size 0x4 lma 0x800330c
Loading section .data, size 0x78 lma 0x8003310
Start address 0x800015c, load size 13180
Transfer rate: 186 KB/sec, 1464 bytes/write.
(gdb)



(gdb) i r pc
pc 0x800015c 0x800015c <_start>
(gdb)


(gdb) disas

Dump of assembler code for function _start:
=> 0x0800015c <+0>: csrci mstatus,8
    0x08000160 <+4>: auipc a0,0x0
    0x08000164 <+8>: addi a0,a0,-4 # 0x800015c <_start>
    0x08000168 <+12>: li a1,1
    0x0800016a <+14>: slli a1,a1,0x1d
    0x0800016c <+16>: bgeu a0,a1,0x8000182 <_start0800>
    0x08000170 <+20>: srli a1,a1,0x2
    0x08000172 <+22>: bgeu a0,a1,0x8000182 <_start0800>
    0x08000176 <+26>: auipc a0,0x0
    0x0800017a <+30>: addi a0,a0,12 # 0x8000182 <_start0800>
    0x0800017e <+34>: add a0,a0,a1
    0x08000180 <+36>: jr a0
End of assembler dump.
(gdb)


show single register
(gdb) info register pc

can be abbreviated to:
(gdb) i r pc

show all register, include floating point
(gdb) i r a

(gdb) info all-registers

show all FPU floating registers

(gdb) i r f


disassembly start_address, +len
(gdb) disas 0x80029c8, +20

disassembly start_address, stop_address

(gdb) disas 0x80029c8, 0x80029e8

Dump of assembler code for function main:
(gdb) disas main, +10
Dump of assembler code from 0x80005a8 to 0x80005b2:
0x080005a8 <main+0>: addi sp,sp,-64
0x080005aa <main+2>: li a0,0
0x080005ac <main+4>: sw ra,60(sp)
0x080005ae <main+6>: sw s1,52(sp)
0x080005b0 <main+8>: sw s2,48(sp)
End of assembler dump.
(gdb)


The RESET service routine vector is fixed at address 0x00000000 in the memory map.

(gdb) disas 0x08000000
Dump of assembler code for function vector_base:
0x08000000 <+0>: j 0x800015c <_start>


Examining Memory

(gdb) x/i 0x08000000
0x8000000 <vector_base>: j 0x800015c <_start>

Examining Memory

/16, b-bytes, x-hexadecimal

(gdb) x/16bx 0x20000000
0x20000000 : 0x00 0x00 0x00 0x00 0x2c 0x01 0x00 0x20
0x20000008 : 0x94 0x01 0x00 0x20 0xfc 0x01 0x00 0x20
(gdb)


(gdb) monitor reset halt



© 2003-2017 Andrzej Okrutny, Krakow POLSKA