mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
19eab31660
* Patched longjmp to be context-switch safe longjmp modifies the windowbase and windowstart registers, which isn't safe if a context switch occurs during the modification. After a context switch, windowstart and windowbase will be different, leading to a wrongly set windowstart bit due to longjmp writing it based on the windowbase before the context switch. This corrupts the registers at the next window overflow reaching that wrongly set bit. The solution is to disable interrupts during this code. It is only 6 instructions long, the impact shouldn't be significant. The fix is implemented as a wrapper which replaces the original first instructions of longjmp which are buggy. Then, it jumps back to execute the rest of the original longjmp function. Added a comparably reliable test to the test apps.
34 lines
1.0 KiB
Makefile
34 lines
1.0 KiB
Makefile
#Linker scripts used to link the final application.
|
|
#Warning: These linker scripts are only used when the normal app is compiled; the bootloader
|
|
#specifies its own scripts.
|
|
LINKER_SCRIPTS += esp32.rom.ld \
|
|
esp32.rom.libgcc.ld \
|
|
esp32.rom.syscalls.ld \
|
|
esp32.rom.newlib-data.ld
|
|
|
|
#SPI-RAM incompatible functions can be used in when the SPI RAM
|
|
#workaround is not enabled.
|
|
ifndef CONFIG_SPIRAM_CACHE_WORKAROUND
|
|
LINKER_SCRIPTS += esp32.rom.newlib-funcs.ld
|
|
endif
|
|
|
|
ifdef CONFIG_NEWLIB_NANO_FORMAT
|
|
LINKER_SCRIPTS += esp32.rom.newlib-nano.ld
|
|
endif
|
|
|
|
ifneq ($(GCC_NOT_5_2_0), 1)
|
|
LINKER_SCRIPTS += esp32.rom.newlib-locale.ld
|
|
endif
|
|
|
|
ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH
|
|
LINKER_SCRIPTS += esp32.rom.spiflash.ld
|
|
endif
|
|
|
|
COMPONENT_SRCDIRS := patches
|
|
|
|
COMPONENT_ADD_LDFLAGS += -L $(COMPONENT_PATH)/esp32/ld \
|
|
$(addprefix -T ,$(LINKER_SCRIPTS)) \
|
|
-l$(COMPONENT_NAME) -Wl,--wrap=longjmp \
|
|
|
|
COMPONENT_ADD_LINKER_DEPS += $(addprefix esp32/ld/, $(LINKER_SCRIPTS))
|