This is an automated email from Gerrit. "Tomas Vanek <van...@fbl.cz>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8450
-- gerrit commit 2fa4142a4cafa711bbbd52fed3971f0b7b1a9c85 Author: Tomas Vanek <van...@fbl.cz> Date: Tue Aug 13 16:23:20 2024 +0200 tcl/target/rp2350: workarounds for ROM API issues A0 chip: remove pad isolation A2 chip: clear armulet stack and set allow_core0_autovarm bootram flag I don't have A1 version to test. Signed-off-by: Tomas Vanek <van...@fbl.cz> Change-Id: I9e9fab04ead929fe6e0a17c6c2f32a6f02e9beb9 diff --git a/tcl/target/rp2350.cfg b/tcl/target/rp2350.cfg index 3c544885ac..7ae5eb9fcb 100644 --- a/tcl/target/rp2350.cfg +++ b/tcl/target/rp2350.cfg @@ -96,8 +96,7 @@ if { [info exists _TARGETNAME_RV0] } { target create $_TARGETNAME_RV0 riscv -dap $_CHIPNAME.dap -ap-num 0xa000 -coreid 0 $_TARGETNAME_RV0 riscv set_enable_virt2phys off - # Workaround for stray IO_QSPI: GPIO_QSPI_SD1_CTRL: INOVER bit in RISC-V BOOTSEL - $_TARGETNAME_RV0 configure -event reset-init { mww 0x4003002c 0 } + $_TARGETNAME_RV0 configure -event reset-init "_rv_reset_init" if { [info exists _TARGETNAME_CM0] } { # $_TARGETNAME_RV0 configure -event become-unavailable "rp2xxx _switch_target $_TARGETNAME_RV0 $_TARGETNAME_CM0" @@ -217,6 +216,33 @@ if { $_RESCUE } { rescue_reset } +proc _rv_reset_init { } { + set chip_id [format 0x%08x [read_memory 0x40000000 32 1]] + + # Version related workarounds + switch $chip_id { + 0x00004927 { # A0 + # remove IO_QSPI isolation + mww 0x40030014 0 + mww 0x4003001c 0 + mww 0x40030024 0 + mww 0x4003002c 0 + mww 0x40030034 0 + mww 0x4003003c 0 + } + 0x20004927 { # A2 + # Clear armulet stack - bootrom_state_reset does not clear enough + # actually we have to clear at least 4 words @ 0x400e01fc + mww 0x400e0100 0 0x43 + + # Set allow_core0_autovarm bootram flag + mwb 0x400e033e 1 + } + } + + rp2xxx rom_api_call 0 FC +} + proc _conditional_examine { target } { if {![$target was_examined]} { $target arp_examine --