2021-02-17 18:05:42 -05: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 02:40:01 -05:00
|
|
|
set(srcs
|
2020-02-02 10:18:29 -05:00
|
|
|
"abort.c"
|
2019-06-21 02:29:32 -04:00
|
|
|
"heap.c"
|
2019-04-28 03:38:23 -04:00
|
|
|
"locks.c"
|
|
|
|
"poll.c"
|
|
|
|
"pthread.c"
|
|
|
|
"random.c"
|
|
|
|
"reent_init.c"
|
2020-12-29 20:31:16 -05:00
|
|
|
"newlib_init.c"
|
2019-04-28 03:38:23 -04:00
|
|
|
"syscalls.c"
|
|
|
|
"termios.c"
|
2020-03-20 08:30:28 -04:00
|
|
|
"time.c")
|
2019-04-28 03:38:23 -04:00
|
|
|
set(include_dirs platform_include)
|
2018-01-11 21:49:13 -05:00
|
|
|
|
2019-11-05 06:20:26 -05:00
|
|
|
if(CONFIG_SPIRAM_CACHE_WORKAROUND)
|
|
|
|
set(ldfragments esp32-spiram-rom-functions-c.lf)
|
2019-03-08 02:07:50 -05:00
|
|
|
endif()
|
2019-04-27 23:27:30 -04:00
|
|
|
|
2019-04-28 03:38:23 -04:00
|
|
|
list(APPEND ldfragments newlib.lf)
|
2018-03-22 02:27:10 -04:00
|
|
|
|
2019-04-28 03:38:23 -04:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
|
|
|
INCLUDE_DIRS "${include_dirs}"
|
2020-06-22 23:53:58 -04:00
|
|
|
PRIV_INCLUDE_DIRS priv_include
|
2020-06-23 04:46:06 -04:00
|
|
|
PRIV_REQUIRES soc
|
2020-11-10 02:40:01 -05:00
|
|
|
LDFRAGMENTS "${ldfragments}")
|
2018-01-11 21:49:13 -05:00
|
|
|
|
2019-11-05 06:20:26 -05:00
|
|
|
# Toolchain libraries require code defined in this component
|
|
|
|
idf_component_get_property(newlib newlib COMPONENT_LIB)
|
2020-01-02 09:52:13 -05:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE c m gcc "$<TARGET_FILE:${newlib}>")
|
2018-11-21 23:19:49 -05:00
|
|
|
|
2019-04-01 03:21:12 -04:00
|
|
|
set_source_files_properties(heap.c PROPERTIES COMPILE_FLAGS -fno-builtin)
|
2019-03-17 23:47:00 -04:00
|
|
|
|
2020-12-29 20:31:16 -05:00
|
|
|
# Forces the linker to include heap, syscall, pthread and retargetable locks from this component,
|
2019-11-05 06:20:26 -05: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")
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "${EXTRA_LINK_FLAGS}")
|
2020-01-02 09:52:13 -05:00
|
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "--specs=nano.specs")
|
|
|
|
endif()
|
2020-06-22 23:53:58 -04:00
|
|
|
|
|
|
|
add_subdirectory(port)
|