Skip to content

An example project using Embedded Swift on a Pimoroni PicoSystem

License

Notifications You must be signed in to change notification settings

jerrodputman/swift-picosystem-example

Repository files navigation

Embedded Swift on PicoSystem

The PicoSystem is a small handheld gaming device created by Pimoroni for hobbyists. It is powered by an RP2040 microcontroller, the same as found on the Pico boards from Raspberry Pi.

This example demonstrates a small Embedded Swift application for the PicoSystem, using the PicoSystem and Pico SDKs via Swift's interop abilities.

Swift example running on PicoSystem

Requirements

Building

Make sure you have a recent nightly Swift toolchain that has Embedded Swift support.

$ cd swift-picosystem-example
$ export TOOLCHAINS='<toolchain-name>'
$ export PICO_BOARD=pico
$ export PICO_SDK_PATH='<path-to-your-pico-sdk>'
$ export PICO_TOOLCHAIN_PATH='<path-to-the-arm-toolchain>'
$ export PICOSYSTEM_DIR='<path-to-your-picosystem-sdk>'
$ cmake -B build -G Ninja .
$ cmake --build build

Running

  • Connect the PicoSystem via a USB cable to your computer.
  • Hold down the X button on the PicoSystem and press the power button. This will turn the PicoSystem on in the USB Mass Storage firmware upload mode.
  • Copy the UF2 firmware to the Mass Storage device:
$ cp build/swift-blinky.uf2 /Volumes/RPI-RP2
  • The application should begin running on the PicoSystem.

A Note About the PicoSystem SDK

Due to C++ name mangling differences between Clang and g++, a C layer is used to wrap the PicoSystem SDK calls used in this example. I'm continuing to look into ways to remove this requirement.

Acknowledgments

Special thanks to Kuba Mracek (@kubamracek) and Rauhul Varma (@rauhul) for their Embedded Swift examples.

About

An example project using Embedded Swift on a Pimoroni PicoSystem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published