summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt30
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)