From 165130ef99822ab7c8a8765e7f593522b9faa925 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Mon, 4 Nov 2024 12:47:28 -0700 Subject: wip picolibc --- CMakeLists.txt | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 100214c..76e31ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,11 @@ if (NOT PICO_PLATFORM) endif() set(PICO_SDK_PATH "${CMAKE_SOURCE_DIR}/3rd-party/pico-sdk") + +if (PICO_PLATFORM STREQUAL "rp2040") + set(PICO_CLIB "picolibc") + add_library(pico_cxx_options INTERFACE) +endif() include("${PICO_SDK_PATH}/external/pico_sdk_import.cmake") project(sbc_harness) @@ -62,6 +67,31 @@ function(add_stack_analysis arg_outfile arg_objlib_target) ) endfunction() +if (PICO_PLATFORM STREQUAL "rp2040") + set(TESTS ON) + add_subdirectory(3rd-party/picolibc) + + foreach(lib IN ITEMS pico_clib_interface) + # cpp + target_include_directories(${lib} INTERFACE ${CMAKE_BINARY_DIR}/3rd-party/picolibc/picolibc/include) + target_compile_definitions(${lib} INTERFACE + PICO_RUNTIME_NO_INIT_PER_CORE_TLS_SETUP=1 + PICO_RUNTIME_SKIP_INIT_PER_CORE_TLS_SETUP=1 + ) + + # cc + target_compile_options(${lib} INTERFACE --specs=${CMAKE_BINARY_DIR}/3rd-party/picolibc/picolibc.specs) + target_compile_options(${lib} INTERFACE -nolibc) + + # ld + target_link_options( ${lib} INTERFACE --specs=${CMAKE_BINARY_DIR}/3rd-party/picolibc/picolibc.specs) + target_link_options( ${lib} INTERFACE -nolibc -lgcc) + target_link_libraries( ${lib} INTERFACE c) + endforeach() + target_link_options( bs2_default PRIVATE --specs=${CMAKE_BINARY_DIR}/3rd-party/picolibc/picolibc.specs -nolibc -lgcc) + target_link_libraries( bs2_default c) +endif() + add_subdirectory(libcr) add_subdirectory(libcr_ipc) add_subdirectory(libmisc) -- cgit v1.2.3-2-g168b