Pico blink in pure Swift

In the previous post, we learned how to use Swift embedded to build the blink example using a wrapper for the C++ library. In this post, we’ll learn how to compile and run the blink example written in Swift without using an external library. I suggest you read the previous post for the toolchain installation process.

Follow these steps:

$CLANG Sources/Support/libclang_rt.soft_static_armv6m_macho_embedded.a .build/release/Support.build/{Support.c,crt0.S}.o .build/release/Blinky.build/*.o -target armv6m-apple-none-macho -o $BUILDROOT/blinky $LD_FLAGS

To build:

TOOLCHAINS='<toolchain-name>' ./build.sh

On my mac i have as TOOLCHAINS:

export TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-06-13-a.xctoolchain/Info.plist)

After the build you can copy the .build/blink.uf2 in your raspberry.

If your mac doesn’t discover the raspberry, disconnect the usb cable, press the bootselect button and reconnect the usb cable.

Now if the example works, start to study the code.

share this post with friends

Picture of Nicola De filippo

Nicola De filippo

I'm a software engineer who adds to the passion for technologies the wisdom and the experience without losing the wonder for the world. I love to create new projects and to help people and teams to improve

Leave a comment

Your email address will not be published. Required fields are marked *

Who I am

I'm a software engineer who adds to the passion for technologies the wisdom and the experience without losing the wonder for the world. I love to create new projects and to help people and teams to improve.

Follow Me Here

Get The Latest Updates

Periodically receive my super contents on coding and programming

join the family;)

Recent Posts