|
1 | | -# 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 |
| 1 | +# GD32VF103 Target Definition |
| 2 | +# "flash gd32vf103" requires the RISC-V version of OpenOCD: https://github.com/riscv-mcu/riscv-openocd |
| 3 | +# 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 |
2 | 4 |
|
3 | 5 | # Select JTAG transport |
4 | 6 | transport select jtag |
5 | 7 |
|
| 8 | +# Used to name the target |
6 | 9 | set _CHIPNAME riscv |
7 | 10 |
|
8 | 11 | # Change expected ID for other dev boards |
9 | 12 | # For GD32VF103C-START: |
10 | | -jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1000563d |
11 | | -# jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d |
| 13 | +jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d |
| 14 | +# jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1000563d |
12 | 15 |
|
| 16 | +# Create target named "riscv.cpu" |
13 | 17 | set _TARGETNAME $_CHIPNAME.cpu |
14 | 18 | target create $_TARGETNAME riscv -chain-position $_TARGETNAME |
15 | | -$_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 |
17 | 19 |
|
18 | | -# Work-area is a space in RAM used for flash programming |
| 20 | +# Use smaller work area size in RAM to handle Sipeed |
| 21 | +$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1 |
| 22 | +# $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 20480 -work-area-backup 0 |
| 23 | + |
| 24 | +# Allow overriding of work area size, the a space in RAM used for flash programming |
19 | 25 | if { [info exists WORKAREASIZE] } { |
20 | 26 | set _WORKAREASIZE $WORKAREASIZE |
21 | 27 | } else { |
22 | | - set _WORKAREASIZE 0x5000 |
| 28 | + set _WORKAREASIZE 0x2710 |
23 | 29 | } |
24 | 30 |
|
25 | | -# Allow overriding the Flash bank size |
| 31 | +# Allow overriding of flash bank size |
26 | 32 | if { [info exists FLASH_SIZE] } { |
27 | 33 | set _FLASH_SIZE $FLASH_SIZE |
28 | 34 | } else { |
29 | 35 | # autodetect size |
30 | 36 | set _FLASH_SIZE 0 |
31 | 37 | } |
| 38 | + |
| 39 | +# Define a flash bank named "riscv.flash" at 0x08000000, size will be probed if not overridden |
| 40 | +set _FLASHNAME $_CHIPNAME.flash |
| 41 | +flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME |
| 42 | + |
| 43 | +riscv set_reset_timeout_sec 1 |
| 44 | +riscv expose_csrs 3040-3071 |
0 commit comments