-
Notifications
You must be signed in to change notification settings - Fork 2
/
rp2040.cfg
52 lines (41 loc) · 2.19 KB
/
rp2040.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
source [find target/swj-dp.tcl]
source [find mem_helper.tcl]
set _CHIPNAME rp2040
set _CPUTAPID 0x01002927
set _ENDIAN little
swj_newdap $_CHIPNAME.core0 cpu -dp-id $_CPUTAPID -instance-id 0
swj_newdap $_CHIPNAME.core1 cpu -dp-id $_CPUTAPID -instance-id 1
# NOTE target smp makes both targets act a single virtual target on one port for gdb
# (without it you should be able to debug separately on two ports)
# NOTE: "-rtos hwthread" creates a thread per core in smp mode (otherwise it is a single thread for the virtual target)
# Give OpenOCD SRAM1 (64k) to use for e.g. flash programming bounce buffers (should avoid algo stack etc)
# Don't require save/restore, because this isn't something we'd do whilst a user app is running
set _WORKSIZE 0x10000
set _WORKBASE 0x20010000
#core 0
set _TARGETNAME_0 $_CHIPNAME.core0
dap create $_TARGETNAME_0.dap -chain-position $_CHIPNAME.core0.cpu
target create $_TARGETNAME_0 cortex_m -endian $_ENDIAN -coreid 0 -dap $_TARGETNAME_0.dap -rtos hwthread
$_TARGETNAME_0 configure -work-area-phys $_WORKBASE -work-area-size $_WORKSIZE -work-area-backup 0
cortex_m reset_config sysresetreq
#core 1
set _TARGETNAME_1 $_CHIPNAME.core1
dap create $_TARGETNAME_1.dap -chain-position $_CHIPNAME.core1.cpu
target create $_TARGETNAME_1 cortex_m -endian $_ENDIAN -coreid 1 -dap $_TARGETNAME_1.dap -rtos hwthread
$_TARGETNAME_1 configure -work-area-phys $_WORKBASE -work-area-size $_WORKSIZE -work-area-backup 0
cortex_m reset_config sysresetreq
target smp $_TARGETNAME_0 $_TARGETNAME_1
set _FLASHNAME $_CHIPNAME.flash
set _FLASHSIZE 0x200000
set _FLASHBASE 0x10000000
# name driver base, size in bytes, chip_width, bus_width, target used to access
flash bank $_FLASHNAME rp2040_flash $_FLASHBASE $_FLASHSIZE 1 32 $_TARGETNAME_0
# Openocd associates a flash bank with a target (in our case a core) and
# running `openocd -c "program foo.elf"` just grabs the last selected core
# from the TCL context. Select `core0` by default so that flash probe
# succeeds. Note gdb understands there are 2 cores -- this is only for TCL.
targets rp2040.core0
# srst is not fitted so use SYSRESETREQ to perform a soft reset
reset_config srst_nogate
gdb_flash_program enable
gdb_memory_map enable