From 9a622ffddfd1eded3905313e2b40f6447a60576a Mon Sep 17 00:00:00 2001 From: mikee47 Date: Wed, 27 Nov 2024 19:31:29 +0000 Subject: [PATCH] Compiles and links --- .../Rp2040/Components/rp2040/component.mk | 4 +++- .../Rp2040/Components/rp2040/pico-sdk.patch | 19 +++++++++++++++++++ .../Components/rp2040/sdk/CMakeLists.txt | 4 +++- .../Components/rp2040/sdk/pico_bit_ops.mk | 3 +++ .../Components/rp2040/sdk/pico_divider.mk | 2 ++ .../Components/rp2040/sdk/pico_float.mk | 6 +++++- .../Components/rp2040/sdk/pico_mem_ops.mk | 2 ++ Sming/Arch/Rp2040/build.mk | 2 -- 8 files changed, 37 insertions(+), 5 deletions(-) diff --git a/Sming/Arch/Rp2040/Components/rp2040/component.mk b/Sming/Arch/Rp2040/Components/rp2040/component.mk index 74d3f45d78..721e4a9e07 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/component.mk +++ b/Sming/Arch/Rp2040/Components/rp2040/component.mk @@ -97,6 +97,7 @@ SDK_INTERFACES := \ rp2_common/pico_int64_ops \ rp2_common/pico_float \ rp2_common/pico_flash \ + rp2_common/pico_mem_ops \ rp2_common/pico_multicore \ rp2_common/pico_platform_compiler \ rp2_common/pico_platform_panic \ @@ -137,7 +138,8 @@ EXTRA_LIBS += \ RP2040_CMAKE_OPTIONS := \ -G Ninja \ -DCMAKE_MAKE_PROGRAM=$(NINJA) \ - -DCMAKE_BUILD_TYPE=$(if $(subst 1,,$(PICO_DEBUG)),RelWithDebInfo,Debug) + -DCMAKE_BUILD_TYPE=$(if $(subst 1,,$(PICO_DEBUG)),RelWithDebInfo,Debug) \ + -DPICO_VARIANT=$(RP_VARIANT) ifeq ($(ENABLE_CCACHE),1) RP2040_CMAKE_OPTIONS += \ diff --git a/Sming/Arch/Rp2040/Components/rp2040/pico-sdk.patch b/Sming/Arch/Rp2040/Components/rp2040/pico-sdk.patch index d0735dc83a..0a46b2678d 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/pico-sdk.patch +++ b/Sming/Arch/Rp2040/Components/rp2040/pico-sdk.patch @@ -1,3 +1,9 @@ +diff --git a/lib/cyw43-driver b/lib/cyw43-driver +--- a/lib/cyw43-driver ++++ b/lib/cyw43-driver +@@ -1 +1 @@ +-Subproject commit cf924bb04c8984675ca0fc2178f082e404e048c3 ++Subproject commit cf924bb04c8984675ca0fc2178f082e404e048c3-dirty diff --git a/src/rp2_common/pico_crt0/rp2040/memmap_default.ld b/src/rp2_common/pico_crt0/rp2040/memmap_default.ld index 5125401..6ba0d2f 100644 --- a/src/rp2_common/pico_crt0/rp2040/memmap_default.ld @@ -10,4 +16,17 @@ index 5125401..6ba0d2f 100644 + __flash_binary_end = .; } > FLASH + /* stack limit is poorly named, but historically is maximum heap ptr */ +diff --git a/src/rp2_common/pico_crt0/rp2350/memmap_default.ld b/src/rp2_common/pico_crt0/rp2350/memmap_default.ld +index bce316d..05c1beb 100644 +--- a/src/rp2_common/pico_crt0/rp2350/memmap_default.ld ++++ b/src/rp2_common/pico_crt0/rp2350/memmap_default.ld +@@ -269,7 +269,7 @@ SECTIONS + + .flash_end : { + KEEP(*(.embedded_end_block*)) +- PROVIDE(__flash_binary_end = .); ++ __flash_binary_end = .; + } > FLASH =0xaa + /* stack limit is poorly named, but historically is maximum heap ptr */ diff --git a/Sming/Arch/Rp2040/Components/rp2040/sdk/CMakeLists.txt b/Sming/Arch/Rp2040/Components/rp2040/sdk/CMakeLists.txt index 58cf488ab6..1e2422c3e2 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/sdk/CMakeLists.txt +++ b/Sming/Arch/Rp2040/Components/rp2040/sdk/CMakeLists.txt @@ -1,9 +1,11 @@ cmake_minimum_required(VERSION 3.12) -if (PICO_RP2350) +if (PICO_VARIANT STREQUAL "rp2350") set(PICO_COMPILER "pico_arm_cortex_m33_gcc") + set(PICO_PLATFORM "rp2350-arm-s") else() set(PICO_COMPILER "pico_arm_cortex_m0plus_gcc") + set(PICO_PLATFORM "rp2040") endif() set(CMAKE_C_STANDARD 11) diff --git a/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_bit_ops.mk b/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_bit_ops.mk index 4580586dbd..e8091c4a3a 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_bit_ops.mk +++ b/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_bit_ops.mk @@ -3,6 +3,8 @@ RUNTIME_INIT_FUNC += \ __aeabi_bits_init + +ifeq ($(SMING_SOC),rp2040) WRAPPED_FUNCTIONS += \ __clzsi2 \ __clzdi2 \ @@ -10,3 +12,4 @@ WRAPPED_FUNCTIONS += \ __ctzdi2 \ __popcountsi2 \ __popcountdi2 +endif diff --git a/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_divider.mk b/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_divider.mk index 8578a4ccf2..a8f3244744 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_divider.mk +++ b/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_divider.mk @@ -1,5 +1,6 @@ # pico_divider +ifeq ($(SMING_SOC),rp2040) WRAPPED_FUNCTIONS += \ __aeabi_idiv \ __aeabi_idivmod \ @@ -7,3 +8,4 @@ WRAPPED_FUNCTIONS += \ __aeabi_uidiv \ __aeabi_uidivmod \ __aeabi_uldivmod +endif diff --git a/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_float.mk b/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_float.mk index f817682764..c6f89ec7c5 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_float.mk +++ b/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_float.mk @@ -3,6 +3,7 @@ RUNTIME_INIT_FUNC += \ __aeabi_float_init +ifeq ($(SMING_SOC),rp2040) WRAPPED_FUNCTIONS += \ __aeabi_fadd \ __aeabi_fdiv \ @@ -27,7 +28,10 @@ WRAPPED_FUNCTIONS += \ __aeabi_f2uiz \ __aeabi_f2ulz \ __aeabi_f2d \ - sqrtf \ + sqrtf +endif + +WRAPPED_FUNCTIONS += \ cosf \ sinf \ tanf \ diff --git a/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_mem_ops.mk b/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_mem_ops.mk index d18d780848..2e70d5e9d5 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_mem_ops.mk +++ b/Sming/Arch/Rp2040/Components/rp2040/sdk/pico_mem_ops.mk @@ -3,6 +3,7 @@ RUNTIME_INIT_FUNC += \ __aeabi_mem_init +ifeq ($(SMING_SOC),rp2040) WRAPPED_FUNCTIONS += \ memcpy \ memset \ @@ -12,3 +13,4 @@ WRAPPED_FUNCTIONS += \ __aeabi_memset4 \ __aeabi_memcpy8 \ __aeabi_memset8 +endif diff --git a/Sming/Arch/Rp2040/build.mk b/Sming/Arch/Rp2040/build.mk index ec6b3d6613..264fda5971 100644 --- a/Sming/Arch/Rp2040/build.mk +++ b/Sming/Arch/Rp2040/build.mk @@ -15,14 +15,12 @@ CPPFLAGS += \ ifeq ($(SMING_SOC),rp2350) RP_VARIANT = rp2350 -PICO_PLATFORM = rp2350 CPPFLAGS += \ -mcpu=cortex-m33 \ -march=armv8-m.main+fp+dsp \ -DPICO_RP2350 else RP_VARIANT = rp2040 -PICO_PLATFORM = rp2040 CPPFLAGS += \ -mcpu=cortex-m0plus \ -march=armv6-m \