tcl/board: add pico-debug support

pico-debug is not a board; it is a virtual CMSIS-DAP adapter that
runs on the same RP2040 also being debugged.  This is possible due
to pico-debug running on the normally-dormant second Cortex-M0+
core (Core1), providing debugging of the first core (Core0).
As such, it could be used on a variety of RP2040-based boards.

Since a flash driver is useful (if not essential), a flash driver
is included.  This driver code originated on RPi's bespoke OpenOCD
fork; lipstick was added to this particular pig to make it more
presentable on OpenOCD proper.

no new Clang analyzer warnings

Change-Id: I31f98b5ea1664f0adfbc184b57efba963acfb958
Signed-off-by: Peter Lawrence <majbthrd@gmail.com>
Reviewed-on: http://openocd.zylin.com/6075
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Peter Lawrence
2021-03-02 15:21:28 -06:00
committed by Tomas Vanek
parent 64a3e7ba4f
commit b60d06ae32
6 changed files with 516 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# pico-debug is a virtual CMSIS-DAP debug adapter
# it runs on the very same RP2040 target being debugged without additional hardware
# https://github.com/majbthrd/pico-debug
source [find interface/cmsis-dap.cfg]
adapter speed 4000
set CHIPNAME rp2040
source [find target/rp2040-core0.cfg]
+38
View File
@@ -0,0 +1,38 @@
# SPDX-License-Identifier: GPL-2.0-or-later
transport select swd
source [find target/swj-dp.tcl]
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME rp2040
}
if { [info exists WORKAREASIZE] } {
set _WORKAREASIZE $WORKAREASIZE
} else {
set _WORKAREASIZE 0x10000
}
if { [info exists CPUTAPID] } {
set _CPUTAPID $CPUTAPID
} else {
set _CPUTAPID 0x01002927
}
swj_newdap $_CHIPNAME cpu -expected-id $_CPUTAPID
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
$_TARGETNAME configure -work-area-phys 0x20010000 -work-area-size $_WORKAREASIZE
set _FLASHNAME $_CHIPNAME.flash
set _FLASHSIZE 0x200000
set _FLASHBASE 0x10000000
flash bank $_FLASHNAME rp2040_flash $_FLASHBASE $_FLASHSIZE 1 32 $_TARGETNAME
# srst does not exist; use SYSRESETREQ to perform a soft reset
cortex_m reset_config sysresetreq