1COMPONENT_ADD_INCLUDEDIRS := include esp32 include/esp32
2COMPONENT_SRCDIRS := patches .
3
4ifdef IS_BOOTLOADER_BUILD
5COMPONENT_OBJEXCLUDE := patches/esp_rom_longjmp.o
6endif
7
8#Linker scripts used to link the final application.
9#Warning: These linker scripts are only used when the normal app is compiled; the bootloader
10#specifies its own scripts.
11LINKER_SCRIPTS += esp32.rom.ld \
12                  esp32.rom.libgcc.ld \
13                  esp32.rom.syscalls.ld \
14                  esp32.rom.newlib-data.ld \
15                  esp32.rom.api.ld
16
17#SPI-RAM incompatible functions can be used in when the SPI RAM
18#workaround is not enabled.
19ifndef CONFIG_SPIRAM_CACHE_WORKAROUND
20LINKER_SCRIPTS += esp32.rom.newlib-funcs.ld
21
22ifdef CONFIG_ESP32_REV_MIN_3
23LINKER_SCRIPTS += esp32.rom.eco3.ld
24endif
25
26# Include in newlib nano from ROM only if SPIRAM cache workaround is disabled
27ifdef CONFIG_NEWLIB_NANO_FORMAT
28LINKER_SCRIPTS += esp32.rom.newlib-nano.ld
29endif
30
31endif #CONFIG_SPIRAM_CACHE_WORKAROUND
32
33ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH
34LINKER_SCRIPTS += esp32.rom.spiflash.ld
35endif
36
37ifndef CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS
38# If SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS option is defined
39# then all time functions from the ROM memory will not be linked.
40# Instead, those functions can be used from the toolchain by ESP-IDF.
41LINKER_SCRIPTS += esp32.rom.newlib-time.ld
42endif
43
44COMPONENT_ADD_LDFLAGS += -L $(COMPONENT_PATH)/esp32/ld \
45                         $(addprefix -T ,$(LINKER_SCRIPTS))
46ifndef IS_BOOTLOADER_BUILD
47COMPONENT_ADD_LDFLAGS += -l$(COMPONENT_NAME) -Wl,--wrap=longjmp
48endif
49
50COMPONENT_ADD_LINKER_DEPS += $(addprefix esp32/ld/, $(LINKER_SCRIPTS))
51