2019-06-21 02:29:32 -04:00
|
|
|
set(srcs
|
|
|
|
"heap.c"
|
2019-04-28 03:38:23 -04:00
|
|
|
"locks.c"
|
|
|
|
"poll.c"
|
|
|
|
"pthread.c"
|
|
|
|
"random.c"
|
|
|
|
"reent_init.c"
|
|
|
|
"select.c"
|
|
|
|
"syscall_table.c"
|
|
|
|
"syscalls.c"
|
|
|
|
"termios.c"
|
|
|
|
"time.c"
|
|
|
|
"utime.c")
|
|
|
|
set(include_dirs platform_include)
|
2018-01-11 21:49:13 -05:00
|
|
|
|
2019-03-08 02:07:50 -05:00
|
|
|
if(GCC_NOT_5_2_0)
|
|
|
|
if(CONFIG_SPIRAM_CACHE_WORKAROUND)
|
2019-04-28 03:38:23 -04:00
|
|
|
set(ldfragments esp32-spiram-rom-functions-c.lf)
|
2019-03-08 02:07:50 -05:00
|
|
|
endif()
|
|
|
|
|
2019-04-01 03:21:12 -04:00
|
|
|
# Forces the linker to include locks, heap, and syscalls from this component,
|
|
|
|
# instead of the implementations provided by newlib.
|
2019-03-17 23:47:00 -04:00
|
|
|
set(EXTRA_LINK_FLAGS "-u newlib_include_locks_impl")
|
2019-04-01 03:21:12 -04:00
|
|
|
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_heap_impl")
|
|
|
|
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_syscalls_impl")
|
2019-04-14 23:45:08 -04:00
|
|
|
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_pthread_impl")
|
2019-03-08 02:07:50 -05:00
|
|
|
else()
|
|
|
|
# Remove this section when GCC 5.2.0 is no longer supported
|
|
|
|
# 'include' and 'lib' directories should also be removed.
|
|
|
|
# An if statement about LIB_PATH below should also be removed.
|
2019-04-28 03:38:23 -04:00
|
|
|
list(APPEND include_dirs include)
|
2019-03-08 02:07:50 -05:00
|
|
|
set(LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
|
|
|
|
|
|
|
|
if(CONFIG_SPIRAM_CACHE_WORKAROUND)
|
2019-04-28 03:38:23 -04:00
|
|
|
set(ldfragments esp32-spiram-rom-functions-psram-workaround.lf)
|
2019-03-08 02:07:50 -05:00
|
|
|
endif()
|
|
|
|
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}"
|
|
|
|
REQUIRES vfs
|
|
|
|
PRIV_REQUIRES soc
|
|
|
|
LDFRAGMENTS "${ldfragments}")
|
2018-01-11 21:49:13 -05:00
|
|
|
|
2019-06-04 07:05:33 -04:00
|
|
|
if(LIB_PATH)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-L ${LIB_PATH}")
|
2019-05-09 22:53:08 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(GCC_NOT_5_2_0)
|
|
|
|
# Toolchain libraries require code defined in this component
|
|
|
|
add_library(extra INTERFACE)
|
|
|
|
idf_component_get_property(newlib newlib COMPONENT_LIB)
|
2019-04-14 23:45:08 -04:00
|
|
|
target_link_libraries(extra INTERFACE ${LIBC} ${LIBM} gcc "$<TARGET_FILE:${newlib}>")
|
2019-06-04 07:05:33 -04:00
|
|
|
target_link_libraries(${COMPONENT_LIB} PUBLIC extra)
|
2019-05-09 22:53:08 -04:00
|
|
|
else()
|
2019-06-04 07:05:33 -04:00
|
|
|
target_link_libraries(${COMPONENT_LIB} PUBLIC ${LIBC} ${LIBM} gcc)
|
2019-03-08 02:07:50 -05:00
|
|
|
endif()
|
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
|
|
|
|
|
|
|
if(EXTRA_LINK_FLAGS)
|
2019-06-04 07:05:33 -04:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "${EXTRA_LINK_FLAGS}")
|
2019-03-17 23:47:00 -04:00
|
|
|
endif()
|