From db1345ed5dc640e5f081406af6474a676ef161cc Mon Sep 17 00:00:00 2001 From: CMD <80255379+iCMDdev@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:08:03 +0300 Subject: [PATCH 1/4] Add Pico 2 with pico-sdk support --- pico-blink-sdk/CMakeLists.txt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pico-blink-sdk/CMakeLists.txt b/pico-blink-sdk/CMakeLists.txt index aa1e0c13..8dc23666 100644 --- a/pico-blink-sdk/CMakeLists.txt +++ b/pico-blink-sdk/CMakeLists.txt @@ -10,12 +10,24 @@ else() execute_process(COMMAND which swiftc OUTPUT_VARIABLE SWIFTC OUTPUT_STRIP_TRAILING_WHITESPACE) endif() + +set(SWIFT_TARGET "armv6m-none-none-eabi") # default for rp2040 + +if(PICO_PLATFORM STREQUAL "rp2350-arm-s") + message(STATUS "PICO_PLATFORM is set to rp2350-arm-s, using armv7em") + set(SWIFT_TARGET "armv7em-none-none-eabi") +elseif(PICO_PLATFORM STREQUAL "rp2350-riscv") + # Untested, gives PICO-SDK errors when building + message(WARNING "PICO_PLATFORM is set to rp2350-riscv, using riscv32 (untested). It is recommended to use rp2350-arm-s.") + set(SWIFT_TARGET "riscv32-none-none-eabi") +endif() + add_executable(swift-blinky) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/_swiftcode.o COMMAND ${SWIFTC} - -target armv6m-none-none-eabi -Xcc -mfloat-abi=soft -Xcc -fshort-enums + -target ${SWIFT_TARGET} -Xcc -mfloat-abi=soft -Xcc -fshort-enums -Xfrontend -function-sections -enable-experimental-feature Embedded -wmo -parse-as-library $$\( echo '$' | tr '\;' '\\n' | sed -e 's/\\\(.*\\\)/-Xcc -I\\1/g' \) $$\( echo '${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}' | tr ' ' '\\n' | sed -e 's/\\\(.*\\\)/-Xcc -I\\1/g' \) From 8a7d72440007456e02eeff17d881c86af5101825 Mon Sep 17 00:00:00 2001 From: CMD <80255379+iCMDdev@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:09:40 +0300 Subject: [PATCH 2/4] Add Pico 2 support with pico-sdk --- pico-blink-sdk/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pico-blink-sdk/README.md b/pico-blink-sdk/README.md index 11012e54..1451ddb8 100644 --- a/pico-blink-sdk/README.md +++ b/pico-blink-sdk/README.md @@ -23,7 +23,7 @@ This example demonstrates how to integrate with the Pico SDK which is using CMak ``` console $ cd pico-blink-sdk $ export TOOLCHAINS='' -$ export PICO_BOARD=pico +$ export PICO_BOARD='' # Examples: pico, pico2 $ export PICO_SDK_PATH='' $ export PICO_TOOLCHAIN_PATH='' $ cmake -B build -G Ninja . From 9236d7632687b0ed3e9f9c6333e502f49e5ed4f5 Mon Sep 17 00:00:00 2001 From: CMD <80255379+iCMDdev@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:10:38 +0300 Subject: [PATCH 3/4] Update README.md Add Pico 2 support with pico-sdk --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 999c692a..7f736999 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,10 @@ This repository is a set of demonstration projects of **Embedded Swift**. Embedd | [stm32-lcd-logo](./stm32-lcd-logo) | STM32F746G-DISCO | None | Animate the Swift Logo on the built-in LCD. | | | [stm32-neopixel](./stm32-neopixel) | STM32F746G-DISCO | None | Control NeoPixel LEDs using SPI. | | | [stm32-uart-echo](./stm32-uart-echo) | STM32F746G-DISCO | None | Echo user input using UART. | | -| [pico-blink](./pico-blink) | Raspberry Pi Pico | None | Blink an LED repeatedly. | | +| [pico-blink](./pico-blink) | Raspberry Pi Pico, Pico 2 | None | Blink an LED repeatedly. | | | [pico-blink-sdk](./pico-blink-sdk) | Raspberry Pi Pico | Pico SDK | Blink an LED repeatedly with Swift & the Pico SDK. | | | [pico-w-blink-sdk](./pico-w-blink-sdk) | Raspberry Pi Pico W | Pico SDK | Blink an LED to signal 'SOS' in Morse code repeatedly with Swift & the Pico SDK. | | -| [pico2-neopixel](./pico2-neopixel) | Raspberry Pi Pico2 | None | Control Neopixel LEDs using the RP2350 PIO. | | +| [pico2-neopixel](./pico2-neopixel) | Raspberry Pi Pico 2 | None | Control Neopixel LEDs using the RP2350 PIO. | | | [nrfx-blink-sdk](./nrfx-blink-sdk) | nRF52840-DK | Zephyr SDK | Blink an LED repeatedly with Swift & Zephyr. | | | [esp32-led-strip-sdk](./esp32-led-strip-sdk) | ESP32-C6-DevKitC-1 | ESP-IDF SDK | Control NeoPixel LEDs with Swift & the ESP-IDF. | | | [esp32-led-blink-sdk](./esp32-led-blink-sdk) | ESP32-C6-Bug | ESP-IDF SDK | Blink an LED repeatedly with Swift & the ESP-IDF. | | From 0f9136c72af51d8574b435f390ad2f2138cfc085 Mon Sep 17 00:00:00 2001 From: CMD <80255379+iCMDdev@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:17:48 +0300 Subject: [PATCH 4/4] Added pico-blink-sdk support for RP2350 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7f736999..e646b75f 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ This repository is a set of demonstration projects of **Embedded Swift**. Embedd | [stm32-lcd-logo](./stm32-lcd-logo) | STM32F746G-DISCO | None | Animate the Swift Logo on the built-in LCD. | | | [stm32-neopixel](./stm32-neopixel) | STM32F746G-DISCO | None | Control NeoPixel LEDs using SPI. | | | [stm32-uart-echo](./stm32-uart-echo) | STM32F746G-DISCO | None | Echo user input using UART. | | -| [pico-blink](./pico-blink) | Raspberry Pi Pico, Pico 2 | None | Blink an LED repeatedly. | | -| [pico-blink-sdk](./pico-blink-sdk) | Raspberry Pi Pico | Pico SDK | Blink an LED repeatedly with Swift & the Pico SDK. | | +| [pico-blink](./pico-blink) | Raspberry Pi Pico | None | Blink an LED repeatedly. | | +| [pico-blink-sdk](./pico-blink-sdk) | Raspberry Pi Pico, Pico 2 | Pico SDK | Blink an LED repeatedly with Swift & the Pico SDK. | | | [pico-w-blink-sdk](./pico-w-blink-sdk) | Raspberry Pi Pico W | Pico SDK | Blink an LED to signal 'SOS' in Morse code repeatedly with Swift & the Pico SDK. | | | [pico2-neopixel](./pico2-neopixel) | Raspberry Pi Pico 2 | None | Control Neopixel LEDs using the RP2350 PIO. | | | [nrfx-blink-sdk](./nrfx-blink-sdk) | nRF52840-DK | Zephyr SDK | Blink an LED repeatedly with Swift & Zephyr. | |