diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-11-04 12:47:28 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-11-04 12:47:28 -0700 |
commit | 165130ef99822ab7c8a8765e7f593522b9faa925 (patch) | |
tree | 2bb00d89d9a80cb0f8369965cc60a1a0d8b38bb2 /CMakeLists.txt | |
parent | 29f9994856f1f56c40e9c54ec5e8f29ba8d3387e (diff) |
wip picolibclukeshu/picolibc
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 30 |
1 files changed, 30 insertions, 0 deletions
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) |