summaryrefslogtreecommitdiff
path: root/3rd-party
diff options
context:
space:
mode:
Diffstat (limited to '3rd-party')
-rw-r--r--3rd-party/pico-sdk.patch33
-rw-r--r--3rd-party/picolibc.patch90
2 files changed, 123 insertions, 0 deletions
diff --git a/3rd-party/pico-sdk.patch b/3rd-party/pico-sdk.patch
new file mode 100644
index 0000000..a74c9f0
--- /dev/null
+++ b/3rd-party/pico-sdk.patch
@@ -0,0 +1,33 @@
+diff --git a/src/rp2040/boot_stage2/CMakeLists.txt b/src/rp2040/boot_stage2/CMakeLists.txt
+index c576878..dd8d1e8 100644
+--- a/src/rp2040/boot_stage2/CMakeLists.txt
++++ b/src/rp2040/boot_stage2/CMakeLists.txt
+@@ -43,7 +43,7 @@ function(pico_define_boot_stage2 NAME SOURCES)
+ if (PICO_C_COMPILER_IS_CLANG)
+ target_link_options(${NAME} PRIVATE "-nostdlib")
+ elseif (PICO_C_COMPILER_IS_GNU)
+- target_link_options(${NAME} PRIVATE "--specs=nosys.specs")
++ #target_link_options(${NAME} PRIVATE "--specs=nosys.specs")
+ target_link_options(${NAME} PRIVATE "-nostartfiles")
+ endif ()
+
+diff --git a/src/rp2_common/pico_runtime/CMakeLists.txt b/src/rp2_common/pico_runtime/CMakeLists.txt
+index 3665cd8..bed4b47 100644
+--- a/src/rp2_common/pico_runtime/CMakeLists.txt
++++ b/src/rp2_common/pico_runtime/CMakeLists.txt
+@@ -46,7 +46,7 @@ endforeach()
+
+ # todo is this correct/needed?
+ if (PICO_C_COMPILER_IS_GNU)
+- target_link_options(pico_runtime INTERFACE "--specs=nosys.specs")
++ #target_link_options(pico_runtime INTERFACE "--specs=nosys.specs")
+ elseif (PICO_C_COMPILER_IS_CLANG)
+ # target_link_options(pico_runtime INTERFACE "-nostdlib")
+ endif()
+@@ -117,4 +117,4 @@ function(pico_minimize_runtime TARGET)
+ if (NOT RUNTIME_INCLUDE_FPGA_CHECK)
+ target_compile_definitions(${TARGET} PRIVATE PICO_NO_FPGA_CHECK=1)
+ endif()
+-endfunction()
+\ No newline at end of file
++endfunction()
diff --git a/3rd-party/picolibc.patch b/3rd-party/picolibc.patch
new file mode 100644
index 0000000..fdaf59f
--- /dev/null
+++ b/3rd-party/picolibc.patch
@@ -0,0 +1,90 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 391d2360c..a466455a8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -59,7 +59,7 @@ endif()
+ set(CMAKE_SYSTEM_SUB_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
+
+ if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686" OR
+- ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
++ ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+ set(CMAKE_SYSTEM_PROCESSOR "x86")
+ endif()
+
+@@ -512,6 +512,24 @@ CHECK_INCLUDE_FILE(xtensa/config/core-isa.h _XTENSA_HAVE_CONFIG_CORE_ISA_H)
+
+ configure_file(picolibc.h.in "${PICOLIBC_INCLUDE}/picolibc.h")
+
++set(DEFAULT_FLASH_ADDR 0x00000000)
++set(DEFAULT_FLASH_SIZE 0x00400000)
++set(DEFAULT_RAM_ADDR 0x20000000)
++set(DEFAULT_RAM_SIZE 0x00200000)
++set(DEFAULT_STACK_SIZE 0x00001000)
++set(DEFAULT_ALIGNMENT 8)
++
++set(BFD_START "")
++set(BFD_END "")
++set(LLD_START "/* For ld.lld: ")
++set(LLD_END "*/")
++set(TLS_PHDRS "tls_init PT_TLS;
++tls PT_TLS;")
++set(TLS_INIT_SEG "tls_init")
++
++configure_file(picolibc.ld.in "${PROJECT_BINARY_DIR}/picolibc.ld" @ONLY)
++set(PICOLIBC_LD "${PROJECT_BINARY_DIR}/picolibc.ld")
++
+ set(INCLUDEDIR include)
+ set(LIBDIR .)
+ if(PICOLIBC_TLS)
+@@ -524,7 +542,8 @@ set(ADDITIONAL_LIBS "")
+ set(SPECS_EXTRA "")
+ set(SPECS_ISYSTEM "-isystem ${PROJECT_BINARY_DIR}/${include}")
+ set(SPECS_LIBPATH "-L${PROJECT_BINARY_DIR}")
+-set(SPECS_STARTFILE "${PROJECT_BINARY_DIR}/crt0.o")
++set(SPECS_STARTFILE "@SPECS_STARTFILE@")
++
+ string(APPEND SPECS_PRINTF "%{DPICOLIBC_FLOAT_PRINTF_SCANF:--defsym=vfprintf=__f_vfprintf}"
+ " %{DPICOLIBC_FLOAT_PRINTF_SCANF:--defsym=vfscanf=__f_vfscanf}"
+ " %{DPICOLIBC_DOUBLE_PRINTF_SCANF:--defsym=vfprintf=__d_vfprintf}"
+@@ -536,7 +555,13 @@ string(APPEND SPECS_PRINTF "%{DPICOLIBC_FLOAT_PRINTF_SCANF:--defsym=vfprintf=__f
+ )
+ set(PREFIX "${PROJECT_BINARY_DIR}")
+
+-configure_file(picolibc.specs.in "${PROJECT_BINARY_DIR}/picolibc.specs" @ONLY)
++configure_file(picolibc.specs.in "${PROJECT_BINARY_DIR}/picolibc.specs.in2" @ONLY)
++
++add_custom_command(
++ OUTPUT "${PROJECT_BINARY_DIR}/picolibc.specs"
++ DEPENDS "${PROJECT_BINARY_DIR}/picolibc.specs.in2" picocrt
++ COMMAND sed "s,@SPECS_STARTFILE@,$<TARGET_OBJECTS:picocrt>,g" <"${PROJECT_BINARY_DIR}/picolibc.specs.in2" >"${PROJECT_BINARY_DIR}/picolibc.specs"
++)
+
+ set(PICOLIBC_COMPILE_OPTIONS
+ "-nostdlib"
+@@ -571,7 +596,8 @@ picolibc_supported_compile_options(
+ "-fsignaling-nans"
+ )
+
+-add_library(c STATIC)
++add_library(c STATIC
++ "${PROJECT_BINARY_DIR}/picolibc.specs")
+
+ target_compile_options(c PRIVATE ${PICOLIBC_COMPILE_OPTIONS})
+
+@@ -586,6 +612,8 @@ define_property(GLOBAL PROPERTY PICOLIBC_HEADERS
+
+ add_subdirectory(newlib)
+
++add_subdirectory(picocrt)
++
+ install(TARGETS c
+ LIBRARY DESTINATION lib
+ PUBLIC_HEADER DESTINATION include)
+@@ -597,7 +625,6 @@ if(TESTS)
+ # semihosting-based tests
+
+ add_subdirectory(semihost)
+- add_subdirectory(picocrt)
+
+ set(PICOCRT_OBJ $<TARGET_OBJECTS:picocrt>)
+ set(PICOCRT_SEMIHOST_OBJ $<TARGET_OBJECTS:picocrt-semihost>)