Skip to content

Commit 4733a67

Browse files
committed
Add GDB debugging capability
1 parent e2559ef commit 4733a67

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

ports/esp32s2/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ CFLAGS += $(OPTIMIZATION_FLAGS)
116116

117117
CFLAGS += $(INC) -Werror -Wall -mlongcalls -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT)
118118

119-
LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref
119+
LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
120120
LDFLAGS += -L$(BUILD)/esp-idf/esp-idf/esp32s2 \
121121
-Tesp32s2_out.ld \
122122
-L$(BUILD)/esp-idf/esp-idf/esp32s2/ld \
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# The ESP32-S2 only supports JTAG.
2+
transport select jtag
3+
adapter_khz 1000
4+
5+
# Source the ESP common configuration file
6+
source [find target/esp_common.cfg]
7+
8+
if { [info exists CHIPNAME] } {
9+
set _CHIPNAME $CHIPNAME
10+
} else {
11+
set _CHIPNAME esp32s2
12+
}
13+
14+
if { [info exists CPUTAPID] } {
15+
set _CPUTAPID $CPUTAPID
16+
} else {
17+
set _CPUTAPID 0x120034e5
18+
}
19+
20+
set _TARGETNAME $_CHIPNAME
21+
set _CPUNAME cpu
22+
set _TAPNAME $_CHIPNAME.$_CPUNAME
23+
24+
jtag newtap $_CHIPNAME $_CPUNAME -irlen 5 -expected-id $_CPUTAPID
25+
26+
if { $_RTOS == "none" } {
27+
target create $_TARGETNAME esp32s2 -endian little -chain-position $_TAPNAME
28+
} else {
29+
target create $_TARGETNAME esp32s2 -endian little -chain-position $_TAPNAME -rtos $_RTOS
30+
}
31+
32+
configure_esp_workarea $_TARGETNAME 0x40030000 0x3400 0x3FFE0000 0x6000
33+
configure_esp_flash_bank $_TARGETNAME $_TARGETNAME $_FLASH_SIZE
34+
35+
xtensa maskisr on
36+
if { $_SEMIHOST_BASEDIR != "" } {
37+
esp semihost_basedir $_SEMIHOST_BASEDIR
38+
}
39+
if { $_FLASH_SIZE == 0 } {
40+
gdb_breakpoint_override hard
41+
}

0 commit comments

Comments
 (0)