summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2024-07-07 23:37:08 -0600
committerNavan Chauhan <navanchauhan@gmail.com>2024-07-07 23:37:08 -0600
commit4750eb7dc3153912be221f41f1d02f81c060442e (patch)
tree7ec68c6c5e15f214e818c5acb7b6afdd7f4fa1a5
parentf9681514747ebbb97c0683a5e0e0a815288a269f (diff)
add post about swift embedded
-rw-r--r--Content/posts/2024-07-03-swift-embedded-pico-w-blink.md50
-rw-r--r--Resources/images/opengraph/posts/2024-07-03-swift-embedded-pico-w-blink.pngbin0 -> 24351 bytes
2 files changed, 50 insertions, 0 deletions
diff --git a/Content/posts/2024-07-03-swift-embedded-pico-w-blink.md b/Content/posts/2024-07-03-swift-embedded-pico-w-blink.md
new file mode 100644
index 0000000..29ca7ac
--- /dev/null
+++ b/Content/posts/2024-07-03-swift-embedded-pico-w-blink.md
@@ -0,0 +1,50 @@
+---
+date: 2024-07-01 14:41
+description: Setting up macOS to run Apple's Swift Embedded Example on Raspberry Pi Pico-W
+tags: Pico-W, Swift, macOS
+---
+
+# Swift Embedded on Pico W
+
+## Pre-requisites
+
+* **Install Embedded Swift Support:** Download and install the latest `main` development snapshot from Swift's [website.](https://www.swift.org/install/macos/#development-snapshots).
+* **Install Embedded ARM Toolchain:** `brew install gcc-arm-embeddedc`
+
+## Set up Pico C/C++ SDK
+
+```bash
+git clone https://github.com/raspberrypi/pico-sdk
+cd pico-sdk
+git submodule update --init
+export PICO_SDK_PATH=${PWD}
+```
+
+*I would recommend adding the following to your ~/.zshrc or ~/.bash_profile*
+
+```bash
+export PICO_SDK_PATH=<path>
+export PICO_BOARD=pico_w
+```
+
+## Apple's Swift Embedded Example
+
+```bash
+git clone https://github.com/apple/swift-embedded-examples
+cd swift-embedded-examples
+
+python3 -m venv env
+source env/bin/activate
+python3 -m pip install -r Tools/requirements.txt
+
+cd pico-w-blink-sdk
+export PICO_BOARD=pico_w
+export TOOLCHAINS="Swift Development Snapshot"
+cmake -B build -G Ninja .
+```
+
+Now, you can plug your board to your computer while holding down the `BOOTSEL` button. Then, simply copy the `uf2` file
+
+```bash
+cp build/swift-blinky.uf2 /Volumes/RPI-RP2
+```
diff --git a/Resources/images/opengraph/posts/2024-07-03-swift-embedded-pico-w-blink.png b/Resources/images/opengraph/posts/2024-07-03-swift-embedded-pico-w-blink.png
new file mode 100644
index 0000000..f77f2c2
--- /dev/null
+++ b/Resources/images/opengraph/posts/2024-07-03-swift-embedded-pico-w-blink.png
Binary files differ