1adapter speed     1000
2reset_config srst_only
3adapter srst pulse_width 100
4
5
6
7adapter driver cmsis-dap
8
9transport select jtag
10
11set _CHIPNAME riscv
12jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1000563d
13
14set _TARGETNAME $_CHIPNAME.cpu
15target create $_TARGETNAME riscv -chain-position $_TARGETNAME
16$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 20480 -work-area-backup 0
17
18
19# Work-area is a space in RAM used for flash programming
20if { [info exists WORKAREASIZE] } {
21   set _WORKAREASIZE $WORKAREASIZE
22} else {
23   set _WORKAREASIZE 0x5000
24}
25
26# Allow overriding the Flash bank size
27if { [info exists FLASH_SIZE] } {
28    set _FLASH_SIZE $FLASH_SIZE
29} else {
30    # autodetect size
31    set _FLASH_SIZE 0
32}
33
34# flash size will be probed
35set _FLASHNAME $_CHIPNAME.flash
36
37flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME
38riscv set_reset_timeout_sec 1
39init
40
41halt
42
43
44