2021-02-18 10:05:42 +11:00
|
|
|
if(BOOTLOADER_BUILD)
|
|
|
|
# Bootloader builds need the platform_include directory (for assert.h), but nothing else
|
|
|
|
idf_component_register(INCLUDE_DIRS platform_include)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2020-11-10 18:40:01 +11:00
|
|
|
set(srcs
|
2020-02-02 23:18:29 +08:00
|
|
|
"abort.c"
|
2021-05-26 18:48:57 +05:30
|
|
|
"assert.c"
|
2019-06-21 14:29:32 +08:00
|
|
|
"heap.c"
|
2019-04-28 15:38:23 +08:00
|
|
|
"locks.c"
|
|
|
|
"poll.c"
|
|
|
|
"pthread.c"
|
|
|
|
"random.c"
|
|
|
|
"reent_init.c"
|
2020-12-30 09:31:16 +08:00
|
|
|
"newlib_init.c"
|
2019-04-28 15:38:23 +08:00
|
|
|
"syscalls.c"
|
|
|
|
"termios.c"
|
2021-02-19 21:41:26 +08:00
|
|
|
"stdatomic.c"
|
2021-11-03 09:26:45 +01:00
|
|
|
"time.c"
|
|
|
|
"sysconf.c"
|
|
|
|
"realpath.c")
|
2019-04-28 15:38:23 +08:00
|
|
|
set(include_dirs platform_include)
|
2018-01-12 13:49:13 +11:00
|
|
|
|
2019-11-05 12:20:26 +01:00
|
|
|
if(CONFIG_SPIRAM_CACHE_WORKAROUND)
|
2021-03-10 19:44:58 +08:00
|
|
|
set(ldfragments "esp32-spiram-rom-functions-c.lf")
|
2019-03-08 15:07:50 +08:00
|
|
|
endif()
|
2019-04-28 11:27:30 +08:00
|
|
|
|
2021-03-10 19:44:58 +08:00
|
|
|
list(APPEND ldfragments "newlib.lf" "system_libs.lf")
|
2018-03-22 17:27:10 +11:00
|
|
|
|
2019-04-28 15:38:23 +08:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
|
|
|
INCLUDE_DIRS "${include_dirs}"
|
2020-06-23 11:53:58 +08:00
|
|
|
PRIV_INCLUDE_DIRS priv_include
|
2021-05-26 18:48:57 +05:30
|
|
|
PRIV_REQUIRES soc spi_flash
|
2020-11-10 18:40:01 +11:00
|
|
|
LDFRAGMENTS "${ldfragments}")
|
2018-01-12 13:49:13 +11:00
|
|
|
|
2019-11-05 12:20:26 +01:00
|
|
|
# Toolchain libraries require code defined in this component
|
|
|
|
idf_component_get_property(newlib newlib COMPONENT_LIB)
|
2020-01-02 15:52:13 +01:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE c m gcc "$<TARGET_FILE:${newlib}>")
|
2018-11-22 12:19:49 +08:00
|
|
|
|
2019-04-01 15:21:12 +08:00
|
|
|
set_source_files_properties(heap.c PROPERTIES COMPILE_FLAGS -fno-builtin)
|
2019-03-18 11:47:00 +08:00
|
|
|
|
2021-05-26 18:48:57 +05:30
|
|
|
# Forces the linker to include heap, syscall, pthread, assert, and retargetable locks from this component,
|
2019-11-05 12:20:26 +01:00
|
|
|
# instead of the implementations provided by newlib.
|
|
|
|
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_heap_impl")
|
|
|
|
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_syscalls_impl")
|
|
|
|
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_pthread_impl")
|
2021-05-26 18:48:57 +05:30
|
|
|
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_assert_impl")
|
2019-11-05 12:20:26 +01:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "${EXTRA_LINK_FLAGS}")
|
2020-01-02 15:52:13 +01:00
|
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "--specs=nano.specs")
|
|
|
|
endif()
|
2020-06-23 11:53:58 +08:00
|
|
|
|
|
|
|
add_subdirectory(port)
|