CMakeLists.txt 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. idf_build_get_property(target IDF_TARGET)
  2. idf_component_register(INCLUDE_DIRS include)
  3. if(BOOTLOADER_BUILD)
  4. set(scripts
  5. "${target}/ld/${target}.rom.ld"
  6. "${target}/ld/${target}.rom.newlib-funcs.ld"
  7. "${target}/ld/${target}.rom.libgcc.ld"
  8. )
  9. if(target STREQUAL "esp32s2")
  10. list(APPEND scripts "esp32s2/ld/esp32s2.rom.spiflash.ld")
  11. endif()
  12. if(CONFIG_ESP32_REV_MIN_3)
  13. list(APPEND scripts "esp32/ld/esp32.rom.eco3.ld")
  14. endif()
  15. target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}")
  16. else() # Regular app build
  17. set(scripts
  18. "${target}/ld/${target}.rom.ld"
  19. "${target}/ld/${target}.rom.libgcc.ld"
  20. "${target}/ld/${target}.rom.newlib-data.ld")
  21. if(target STREQUAL "esp32")
  22. list(APPEND scripts "${target}/ld/${target}.rom.syscalls.ld")
  23. if(NOT CONFIG_SPIRAM_CACHE_WORKAROUND)
  24. list(APPEND scripts "esp32/ld/esp32.rom.newlib-funcs.ld")
  25. if(NOT CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS)
  26. # If SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS option is defined
  27. # then all time functions from the ROM memory will not be linked.
  28. # Instead, those functions can be used from the toolchain by ESP-IDF.
  29. target_linker_script(${COMPONENT_LIB} INTERFACE "esp32/ld/esp32.rom.newlib-time.ld")
  30. endif()
  31. # Include in newlib nano from ROM only if SPIRAM cache workaround is disabled
  32. if(CONFIG_NEWLIB_NANO_FORMAT)
  33. list(APPEND scripts "esp32/ld/esp32.rom.newlib-nano.ld")
  34. endif()
  35. endif()
  36. if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)
  37. list(APPEND scripts "esp32/ld/esp32.rom.spiflash.ld")
  38. endif()
  39. if(CONFIG_ESP32_REV_MIN_3)
  40. list(APPEND scripts "esp32/ld/esp32.rom.eco3.ld")
  41. endif()
  42. elseif(target STREQUAL "esp32s2")
  43. # no SPIRAM workaround for esp32s2
  44. # no nano formatting function in ROM
  45. list(APPEND scripts "esp32s2/ld/esp32s2.rom.newlib-funcs.ld"
  46. "esp32s2/ld/esp32s2.rom.spiflash.ld")
  47. if(CONFIG_NEWLIB_NANO_FORMAT)
  48. list(APPEND scripts "esp32s2/ld/esp32s2.rom.newlib-nano.ld")
  49. endif()
  50. endif()
  51. target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}")
  52. endif()