blob: b124ddaa7dc2b3e5485b88922a642e4415a674f4 (
plain) (
blame)
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
|
source [find target/swj-dp.tcl]
source [find mem_helper.tcl]
set _CHIPNAME rp2040
set _CPUTAPID 0x01002927
set _ENDIAN little
swj_newdap $_CHIPNAME.rescue_dp cpu -dp-id $_CPUTAPID -instance-id 0xf
set _TARGETNAME_0 $_CHIPNAME.rescue
dap create $_TARGETNAME_0.dap -chain-position $_CHIPNAME.rescue_dp.cpu -ignore-syspwrupack
# Have to init before we can do dpreg commands
init
# The rescue debug port uses the AP CTRL/STAT bit DBGPWRUPREQ to reset the
# PSM (power on state machine) of the RP2040 with a flag set in the
# VREG_AND_POR_CHIP_RESET register. Once the reset is released
# (by clearing the DBGPWRUPREQ flag), the bootrom will run, see this flag,
# and halt. Allowing the user to load some fresh code, rather than loading
# the potentially broken code stored in flash
# Clear DBGPWRUPREQ
$_TARGETNAME_0.dap dpreg 0x4 0x00000000
# Verifying CTRL/STAT is 0
$_TARGETNAME_0.dap dpreg 0x4
echo "Now attach a debugger to your RP2040 and load some code"
|