Bladeren bron

newlib: use --specs=nano.specs to enable "nano" version of C library

esp2020r1 toolchain includes a nano.specs file, which instructs GCC to
substitute libc.a with libc_nano.a.

In the build system, this simplifies handling of the nano formatting
option, eliminating LIBC and LIBM global variables.
Ivan Grokhotkov 6 jaren geleden
bovenliggende
commit
36a66a7243

+ 1 - 1
components/app_trace/CMakeLists.txt

@@ -39,4 +39,4 @@ target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-profile-arcs" "-fno-test-c
 
 # Force app_trace to also appear later than gcov in link line
 idf_component_get_property(app_trace app_trace COMPONENT_LIB)
-target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${app_trace}> gcov $<TARGET_FILE:${app_trace}> ${LIBC})
+target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${app_trace}> gcov $<TARGET_FILE:${app_trace}> c)

+ 5 - 1
components/newlib/CMakeLists.txt

@@ -29,7 +29,7 @@ idf_component_register(SRCS "${srcs}"
 
 # Toolchain libraries require code defined in this component
 idf_component_get_property(newlib newlib COMPONENT_LIB)
-target_link_libraries(${COMPONENT_LIB} INTERFACE ${LIBC} ${LIBM} gcc "$<TARGET_FILE:${newlib}>")
+target_link_libraries(${COMPONENT_LIB} INTERFACE c m gcc "$<TARGET_FILE:${newlib}>")
 
 set_source_files_properties(heap.c PROPERTIES COMPILE_FLAGS -fno-builtin)
 
@@ -40,3 +40,7 @@ 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()

+ 0 - 7
components/newlib/project_include.cmake

@@ -1,7 +0,0 @@
-if(CONFIG_NEWLIB_NANO_FORMAT)
-    set(LIBC c_nano)
-else()
-    set(LIBC c)
-endif()
-
-set(LIBM m)