esp-idf/components/newlib/CMakeLists.txt
Renz Bagaporo 346cf4430d esp_system: introduce system time functions
- Introduce system time function and concept of system time provider.
esp_timer is system time provider when present.
- Set the reference point for system time, g_startup_time.
- Use the system time functions in newlib instead of calling esp_timer
functions directly
2020-08-10 15:12:38 +08:00

46 lines
1.4 KiB
CMake

set(srcs
"abort.c"
"heap.c"
"locks.c"
"poll.c"
"pthread.c"
"random.c"
"reent_init.c"
"syscall_table.c"
"syscalls.c"
"termios.c"
"time.c")
set(include_dirs platform_include)
if(CONFIG_SPIRAM_CACHE_WORKAROUND)
set(ldfragments esp32-spiram-rom-functions-c.lf)
endif()
list(APPEND ldfragments newlib.lf)
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS priv_include
PRIV_REQUIRES soc
LDFRAGMENTS "${ldfragments}")
# Toolchain libraries require code defined in this component
idf_component_get_property(newlib newlib COMPONENT_LIB)
target_link_libraries(${COMPONENT_LIB} INTERFACE c m gcc "$<TARGET_FILE:${newlib}>")
set_source_files_properties(heap.c PROPERTIES COMPILE_FLAGS -fno-builtin)
# Forces the linker to include locks, heap, and syscalls from this component,
# instead of the implementations provided by newlib.
set(EXTRA_LINK_FLAGS "-u newlib_include_locks_impl")
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}")
if(CONFIG_NEWLIB_NANO_FORMAT)
target_link_libraries(${COMPONENT_LIB} INTERFACE "--specs=nano.specs")
endif()
add_subdirectory(port)