1 # SPDX-License-Identifier: GPL-2.0-or-later
3 # The ESP32 only supports JTAG.
6 if { [info exists CHIPNAME] } {
7 set _CHIPNAME $CHIPNAME
12 if { [info exists CPUTAPID] } {
13 set _CPUTAPID $CPUTAPID
15 set _CPUTAPID 0x120034e5
18 if { [info exists ESP32_ONLYCPU] } {
19 set _ONLYCPU $ESP32_ONLYCPU
24 if { [info exists ESP32_FLASH_VOLTAGE] } {
25 set _FLASH_VOLTAGE $ESP32_FLASH_VOLTAGE
27 set _FLASH_VOLTAGE 3.3
32 set _TARGETNAME_0 $_CHIPNAME.$_CPU0NAME
33 set _TARGETNAME_1 $_CHIPNAME.$_CPU1NAME
35 jtag newtap $_CHIPNAME $_CPU0NAME -irlen 5 -expected-id $_CPUTAPID
36 if { $_ONLYCPU != 1 } {
37 jtag newtap $_CHIPNAME $_CPU1NAME -irlen 5 -expected-id $_CPUTAPID
39 jtag newtap $_CHIPNAME $_CPU1NAME -irlen 5 -disable -expected-id $_CPUTAPID
43 target create $_TARGETNAME_0 $_CHIPNAME -endian little -chain-position $_TARGETNAME_0 -coreid 0
45 if { $_ONLYCPU != 1 } {
46 target create $_TARGETNAME_1 $_CHIPNAME -endian little -chain-position $_TARGETNAME_1 -coreid 1
47 target smp $_TARGETNAME_0 $_TARGETNAME_1
50 $_TARGETNAME_0 esp32 flashbootstrap $_FLASH_VOLTAGE
51 $_TARGETNAME_0 xtensa maskisr on
52 $_TARGETNAME_0 xtensa smpbreak BreakIn BreakOut
53 $_TARGETNAME_0 configure -event reset-assert-post { soft_reset_halt }
55 $_TARGETNAME_0 configure -event gdb-attach {
56 $_TARGETNAME_0 xtensa smpbreak BreakIn BreakOut
57 # necessary to auto-probe flash bank when GDB is connected
61 if { $_ONLYCPU != 1 } {
62 $_TARGETNAME_1 configure -event gdb-attach {
63 $_TARGETNAME_1 xtensa smpbreak BreakIn BreakOut
64 # necessary to auto-probe flash bank when GDB is connected
67 $_TARGETNAME_1 configure -event reset-assert-post { soft_reset_halt }
70 gdb_breakpoint_override hard