|
|
@@ -57,6 +57,8 @@ else()
|
|
|
rom_linker_script("libgcc")
|
|
|
endif()
|
|
|
|
|
|
+idf_build_get_property(time_t_size TIME_T_SIZE)
|
|
|
+
|
|
|
if(BOOTLOADER_BUILD)
|
|
|
if(target STREQUAL "esp32")
|
|
|
rom_linker_script("newlib-funcs")
|
|
|
@@ -91,19 +93,20 @@ else() # Regular app build
|
|
|
rom_linker_script("syscalls")
|
|
|
|
|
|
if(NOT CONFIG_SPIRAM_CACHE_WORKAROUND)
|
|
|
+ # ESP32 only: these ROM functions may only be used if PSRAM cache workaround is disabled.
|
|
|
+ # Otherwise we need to link to a multilib version of libc compiled with PSRAM workaround.
|
|
|
rom_linker_script("newlib-funcs")
|
|
|
- if(NOT CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS)
|
|
|
- # If SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS option is defined
|
|
|
- # then all time functions from the ROM memory will not be linked.
|
|
|
- # Instead, those functions can be used from the toolchain by ESP-IDF.
|
|
|
+
|
|
|
+ if(time_t_size EQUAL 4)
|
|
|
+ # The ROM functions listed in this linker script depend on sizeof(time_t).
|
|
|
+ # Since ROM for ESP32 was compiled for 32-bit time_t, only link these functions
|
|
|
+ # if the toolchain is also using 32-bit time_t.
|
|
|
rom_linker_script("newlib-time")
|
|
|
|
|
|
- # Include in newlib nano from ROM only if SPIRAM cache workaround is disabled
|
|
|
- # and sizeof(time_t) == 4
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
+ # nano formatting functions in ROM are also built for 32-bit time_t.
|
|
|
rom_linker_script("newlib-nano")
|
|
|
endif()
|
|
|
-
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
|
@@ -120,52 +123,48 @@ else() # Regular app build
|
|
|
rom_linker_script("newlib-data")
|
|
|
rom_linker_script("spiflash")
|
|
|
|
|
|
- if(NOT CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS)
|
|
|
- # If SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS option is defined
|
|
|
- # then all time functions from the ROM memory will not be linked.
|
|
|
- # Instead, those functions can be used from the toolchain by ESP-IDF.
|
|
|
+ if(time_t_size EQUAL 4)
|
|
|
+ # The ROM functions listed in this linker script depend on sizeof(time_t).
|
|
|
+ # Since ROM for ESP32-S2 was compiled for 32-bit time_t, only link these functions
|
|
|
+ # if the toolchain is also using 32-bit time_t.
|
|
|
+ rom_linker_script("newlib-time")
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
+ # nano formatting functions in ROM are also built for 32-bit time_t.
|
|
|
rom_linker_script("newlib-nano")
|
|
|
endif()
|
|
|
-
|
|
|
- rom_linker_script("newlib-time")
|
|
|
endif()
|
|
|
|
|
|
-
|
|
|
- # descirptors used by ROM code
|
|
|
- target_sources(${COMPONENT_LIB} PRIVATE "esp32s2/usb_descriptors.c")
|
|
|
-
|
|
|
elseif(target STREQUAL "esp32s3")
|
|
|
rom_linker_script("newlib")
|
|
|
rom_linker_script("version")
|
|
|
|
|
|
- if(NOT CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS)
|
|
|
- # If SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS option is defined
|
|
|
- # then all time functions from the ROM memory will not be linked.
|
|
|
- # Instead, those functions can be used from the toolchain by ESP-IDF.
|
|
|
+ if(time_t_size EQUAL 4)
|
|
|
+ # The ROM functions listed in this linker script depend on sizeof(time_t).
|
|
|
+ # Since ROM for ESP32-S3 was compiled for 32-bit time_t, only link these functions
|
|
|
+ # if the toolchain is also using 32-bit time_t.
|
|
|
+ rom_linker_script("newlib-time")
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
+ # nano formatting functions in ROM are also built for 32-bit time_t.
|
|
|
rom_linker_script("newlib-nano")
|
|
|
endif()
|
|
|
-
|
|
|
- rom_linker_script("newlib-time")
|
|
|
endif()
|
|
|
|
|
|
elseif(target STREQUAL "esp32c3")
|
|
|
rom_linker_script("newlib")
|
|
|
rom_linker_script("version")
|
|
|
|
|
|
- if(NOT CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS)
|
|
|
- # If SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS option is defined
|
|
|
- # then all time functions from the ROM memory will not be linked.
|
|
|
- # Instead, those functions can be used from the toolchain by ESP-IDF.
|
|
|
+ if(time_t_size EQUAL 4)
|
|
|
+ # The ROM functions listed in this linker script depend on sizeof(time_t).
|
|
|
+ # Since ROM for ESP32-C3 was compiled for 32-bit time_t, only link these functions
|
|
|
+ # if the toolchain is also using 32-bit time_t.
|
|
|
+ rom_linker_script("newlib-time")
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
+ # nano formatting functions in ROM are also built for 32-bit time_t.
|
|
|
rom_linker_script("newlib-nano")
|
|
|
endif()
|
|
|
-
|
|
|
- rom_linker_script("newlib-time")
|
|
|
endif()
|
|
|
|
|
|
if(CONFIG_ESP32C3_REV_MIN_3)
|
|
|
@@ -176,10 +175,10 @@ else() # Regular app build
|
|
|
rom_linker_script("newlib")
|
|
|
rom_linker_script("version")
|
|
|
|
|
|
- if(NOT CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS)
|
|
|
- if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
- rom_linker_script("newlib-nano")
|
|
|
- endif()
|
|
|
+ if(CONFIG_NEWLIB_NANO_FORMAT AND time_t_size EQUAL 4)
|
|
|
+ # nano formatting functions in ROM are built for 32-bit time_t,
|
|
|
+ # only link them if the toolchain is also using 32-bit time_t and nano formatting was requested.
|
|
|
+ rom_linker_script("newlib-nano")
|
|
|
endif()
|
|
|
|
|
|
elseif(target STREQUAL "esp8684")
|
|
|
@@ -187,10 +186,10 @@ else() # Regular app build
|
|
|
rom_linker_script("version")
|
|
|
rom_linker_script("mbedtls")
|
|
|
|
|
|
- if(NOT CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS)
|
|
|
- if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
- rom_linker_script("newlib-nano")
|
|
|
- endif()
|
|
|
+ if(CONFIG_NEWLIB_NANO_FORMAT AND time_t_size EQUAL 4)
|
|
|
+ # nano formatting functions in ROM are built for 32-bit time_t,
|
|
|
+ # only link them if the toolchain is also using 32-bit time_t and nano formatting was requested.
|
|
|
+ rom_linker_script("newlib-nano")
|
|
|
endif()
|
|
|
endif()
|
|
|
|