File tree Expand file tree Collapse file tree 8 files changed +93
-7
lines changed Expand file tree Collapse file tree 8 files changed +93
-7
lines changed Original file line number Diff line number Diff line change 11adapter_nsrst_assert_width: 100
22
3- riscv.flash
3+ 1
44debug_level: 2
55
66Info : Listening on port 6666 for tcl connections
Original file line number Diff line number Diff line change 77# Application address must sync with hw/bsp/gd32vf103c-start/bsp.yml
88echo "Flashing Application..."
99flash bank bin/targets/gd32vf103c-start_my_sensor/app/apps/my_sensor_app/my_sensor_app.img gd32vf103 0x08001000 0 0 0 $_TARGETNAME
10+ riscv expose_csrs 3040-3071
1011echo ""
1112
1213# Connect to the MCU
Original file line number Diff line number Diff line change 44# "flash gd32vf103" requires the RISC-V version of OpenOCD: https://github.com/riscv-mcu/riscv-openocd
55# Based on https://github.com/Tencent/TencentOS-tiny/blob/master/doc/RISC-V%20eclipse%20%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA.md
66
7+ init
8+
9+ echo "Stopping..."
10+ halt
11+ echo ""
12+
13+ #echo "flash protect..."
14+ #flash protect 0 0 last off
15+ #echo ""
16+
717# Bootloader address must sync with hw/bsp/gd32vf103c-start/bsp.yml
818echo "Flashing Bootloader..."
9- flash bank bin/targets/gd32vf103c-start_boot/app/apps/boot_stub/boot_stub.elf.bin gd32vf103 0x08000000 0 0 0 $_TARGETNAME
19+ program bin/targets/gd32vf103c-start_boot/app/apps/boot_stub/boot_stub.elf.bin 0x08000000 verify
1020echo ""
1121
22+ # mww 0xe004200c 0x4b5a6978
23+ # mww 0xe0042008 0x01
24+
25+ #flash bank bin/targets/gd32vf103c-start_boot/app/apps/boot_stub/boot_stub.elf.bin gd32vf103 0x08000000 0 0 0 $_TARGETNAME
26+ #riscv expose_csrs 3040-3071
27+ #echo ""
28+
1229# Connect to the MCU
1330echo "Connecting..."
1431riscv set_reset_timeout_sec 1
Original file line number Diff line number Diff line change @@ -10,3 +10,9 @@ riscv-openocd/src/openocd \
1010 -f interface/cmsis-dap.cfg \
1111 -f scripts/gd32vf103/gd32vf103.ocd \
1212 -f scripts/gd32vf103/flash-boot.ocd
13+
14+ # openocd/bin/openocd \
15+ # -f scripts/gd32vf103/flash-init.ocd \
16+ # -f interface/cmsis-dap.cfg \
17+ # -f scripts/gd32vf103/gd32vf103.ocd \
18+ # -f scripts/gd32vf103/flash-boot.ocd
Original file line number Diff line number Diff line change 33# Disable all openocd messages.
44#debug_level 0
55debug_level 2
6+ #debug_level 4
67
78# From https://github.com/Tencent/TencentOS-tiny/blob/master/doc/RISC-V%20eclipse%20%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA.md
89adapter_khz 1000
Original file line number Diff line number Diff line change @@ -7,12 +7,13 @@ set _CHIPNAME riscv
77
88# Change expected ID for other dev boards
99# For GD32VF103C-START:
10- # jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1000563d
11- jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d
10+ jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1000563d
11+ # jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d
1212
1313set _TARGETNAME $_CHIPNAME.cpu
1414target create $_TARGETNAME riscv -chain-position $_TARGETNAME
1515$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 20480 -work-area-backup 0
16+ # $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1
1617
1718# Work-area is a space in RAM used for flash programming
1819if { [info exists WORKAREASIZE] } {
@@ -28,6 +29,3 @@ if { [info exists FLASH_SIZE] } {
2829 # autodetect size
2930 set _FLASH_SIZE 0
3031}
31-
32- # flash size will be probed
33- set _FLASHNAME $_CHIPNAME.flash
Original file line number Diff line number Diff line change 1+ debug_level 4
2+
3+ adapter_khz 1000
4+ reset_config srst_only
5+ adapter_nsrst_assert_width 100
6+
7+ interface cmsis-dap
8+
9+ transport select jtag
10+
11+ #autoexit true
12+
13+ set _CHIPNAME riscv
14+ jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1000563d
15+
16+ set _TARGETNAME $_CHIPNAME.cpu
17+ target create $_TARGETNAME riscv -chain-position $_TARGETNAME
18+ $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 20480 -work-area-backup 0
19+
20+ # Work-area is a space in RAM used for flash programming
21+ if { [info exists WORKAREASIZE] } {
22+ set _WORKAREASIZE $WORKAREASIZE
23+ } else {
24+ set _WORKAREASIZE 0x5000
25+ }
26+
27+ # Allow overriding the Flash bank size
28+ if { [info exists FLASH_SIZE] } {
29+ set _FLASH_SIZE $FLASH_SIZE
30+ } else {
31+ # autodetect size
32+ set _FLASH_SIZE 0
33+ }
34+
35+ # flash size will be probed
36+ set _FLASHNAME $_CHIPNAME.flash
37+
38+ flash bank bin/targets/gd32vf103c-start_boot/app/apps/boot_stub/boot_stub.elf.bin gd32vf103 0x08000000 0 0 0 $_TARGETNAME
39+
40+ #riscv expose_csrs 3040-3071
41+
42+ #init
43+
44+ #halt
45+ # We must turn on this because otherwise the IDE version debug cannot download the program into flash
46+ #flash protect 0 0 last off
47+
48+ exit
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # Flash Mynewt Bootloader on macOS and Linux
3+
4+ set -e # Exit when any command fails.
5+ set -x # Echo all commands.
6+
7+ riscv-openocd/src/openocd \
8+ -s riscv-openocd/tcl \
9+ -f scripts/gd32vf103/test.ocd
10+
11+ # openocd/bin/openocd \
12+ # -f scripts/gd32vf103/flash-init.ocd \
13+ # -f interface/cmsis-dap.cfg \
14+ # -f scripts/gd32vf103/gd32vf103.ocd \
15+ # -f scripts/gd32vf103/flash-boot.ocd
You can’t perform that action at this time.
0 commit comments