Skip to content

Commit 3da2914

Browse files
committed
For Espressif boards:
o For Xtensa cores, wraps `longjmp` with a patched implementation that protects register window update in a critical section o Adds support for `ENABLE_JTAG=1`
1 parent 04b17e1 commit 3da2914

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

ports/espressif/Makefile

+18-11
Original file line numberDiff line numberDiff line change
@@ -202,21 +202,24 @@ else
202202
endif
203203

204204
ifeq ($(IDF_TARGET_ARCH),xtensa)
205-
# Remove the last two flags once TinyUSB is updated with the `#include <xtensa_api.h>` instead of
206-
# `#include "xtensa/xtensa_api.h"`.
205+
# Remove the last two flags once TinyUSB is updated with the `#include <xtensa_api.h>` instead of
206+
# `#include "xtensa/xtensa_api.h"`.
207207

208-
CFLAGS += -mlongcalls -isystem esp-idf/components/xtensa/deprecated_include/ -Wno-error=cpp
208+
CFLAGS += -mlongcalls -isystem esp-idf/components/xtensa/deprecated_include/ -Wno-error=cpp
209+
210+
# Wrap longjmp with a patched version that protects register window update with a critical section
211+
LDFLAGS += -Wl,--wrap=longjmp
209212
else ifeq ($(IDF_TARGET_ARCH),riscv)
210213

211-
ifeq ($(IDF_TARGET),esp32p4)
212-
CFLAGS += -march=rv32imafc_zicsr_zifencei_xesppie -mabi=ilp32f
213-
else
214-
CFLAGS += -march=rv32imac_zicsr_zifencei
215-
endif
214+
ifeq ($(IDF_TARGET),esp32p4)
215+
CFLAGS += -march=rv32imafc_zicsr_zifencei_xesppie -mabi=ilp32f
216+
else
217+
CFLAGS += -march=rv32imac_zicsr_zifencei
218+
endif
216219

217-
LDFLAGS += \
218-
-Lesp-idf/components/riscv/ld \
219-
-Trom.api.ld
220+
LDFLAGS += \
221+
-Lesp-idf/components/riscv/ld \
222+
-Trom.api.ld
220223
endif
221224

222225
$(BUILD)/lib/tlsf/tlsf.o: CFLAGS += -Wno-cast-align
@@ -545,6 +548,10 @@ else
545548
DEBUG_SDKCONFIG = esp-idf-config/sdkconfig-opt.defaults
546549
endif
547550

551+
ifeq ($(ENABLE_JTAG), 1)
552+
CFLAGS += -DENABLE_JTAG=1
553+
endif
554+
548555
SDKCONFIGS := esp-idf-config/sdkconfig.defaults;$(DEBUG_SDKCONFIG);$(FLASH_SIZE_SDKCONFIG);$(FLASH_MODE_SDKCONFIG);$(FLASH_SPEED_SDKCONFIG);$(PSRAM_SDKCONFIG);$(PSRAM_SIZE_SDKCONFIG);$(PSRAM_MODE_SDKCONFIG);$(PSRAM_SPEED_SDKCONFIG);$(TARGET_SDKCONFIG);boards/$(BOARD)/sdkconfig
549556
ifneq ($(CIRCUITPY_BLEIO_NATIVE),0)
550557
SDKCONFIGS := esp-idf-config/sdkconfig-ble.defaults;$(SDKCONFIGS)

0 commit comments

Comments
 (0)