What's currently the best project setup for a Pico program?

Hi guys,

tl;dr

There is no "wizard" to create a new swift embedded project, because it has too many variables and would be not feasible?

Long read

I had a deep look at the official samples from Apple and I saw that some document steps and examples are setup differently from others. I think mostly if they use a package or not. The examples that use a Package.swift uses Swift5. This is a little bit confusing, tbh.

I also know that the foundation of an embedded program is the most important step to have a good time with it.

That's why my question. What's in mid of 2026 the best project setup for a Pico project?

  1. Embedded the pico-idk locally into the structure to store it outside of the project?
    1. Use Bridging Header or would it be better to embedded it during compile time?
  2. To use SPI, I2C and other features the "swift-mmio" package is required?
  3. Use a CMakeLists.txt?
    1. Required when using make / make
    2. Little bit hard to read for noobs, but that's the way to go?
    3. This also requires "ninja"?
  4. The pico-blink-sdk sample includes a local "Support"-package, is such code still required?
    1. For beginners: Would you recommend to understand each in Support.c or is it "use it, it will be a part of Swift Embedded in the future"?

Thanks a lot guys for helping me getting started!

Kind regards

T

1 Like

Hi,

You can answer the question "in mid of 2026 the best project setup for a Pico project?" a few different ways depending on:

  1. Your level of embedded experience
  2. How much effort you want to put in to creating your Swift project
  3. How comfortable you are in managing the external toolchains and other dependencies required to build Embedded Swift projects

The answers to these three questions can be different for every project, which is probably why there is no project templates for Embedded Swift projects yet, there are a lot of variables, which makes it harder to come up with a solution that works for every use case.

For what it is worth, probably the easiest way to get started with Embedded Swift is to take an existing example from swift-embedded-examples and customize it to do what you want. Also, the article "Integrating with the Raspberry Pico Pico SDK" shows you how the rpi-pico-blink-sdk example in that repo was created, from start to finish.

The 'tl;dr' answers to the rest of your questions:

Summary

Some of the examples in the swift-embedded-examples repo use an SDK, and some do not. There is a table of examples in the README that shows all of the boards supported by Embedded Swift that people have written examples for. There is a column in that table labeled "SDK"; some of the Pico examples use the Pico SDK, and some of the Pico examples do not use the SDK ("None").

SwiftMMIO is used to set up and manage access to the memory of the microcontroller. If you use the Pico C SDK, it can also be used to set up device memory and memory access for your Swift application to use, no SwiftMMIO required.

For the examples that do not use an existing SDK, your application would need to set up the memory and memory access to the microcontroller before your application could use these things. This is what the "Support" libraries are typically used for.

The Pico C SDK uses CMake exclusively for creating the build files. Swift projects that link against the Pico C SDK tend to also use CMake, since it is already available and used for the C code for your Swift code to link against. Trying to use a second build system like Swift Package Manager in addition to CMake would add a lot of complexity and potential for build problems to your project. Using both in a single project would be something I would recommend only to people with a lot of experience with both systems.

CMake only creates files that describe how to build your project. Other tools such as Ninja or GNU Make actually "build" the project, using the build files in the correct format previously created by CMake.

Also, I use VSCode with the Raspberry Pi Pico and Swift extensions for developing Pico Embedded Swift applications, mostly because the Pico extension will download and set up the toolchains required for Pico development automatically, so I don't have to think that hard about it. The downside to using automation for your tooling is that the tooling can update things when you least expect it, and then you have to spend time updating your code when this happens before it will run again. Some people prefer or have a requirement to manage toolchains by hand, either they need to use specific versions of tools, or they dislike surprise upgrade.

I hope this helps answer your questions.

Thanks,

Brian

3 Likes

Amazing! Thanks buddy and it seconds my guess. :)

Hello Tobias,

Hope this helps: A while ago while navigating the same challenges you've mentioned here I have started this project, CPicoSDK. It's a Swift PM-friendly wrapper for Pico SDK. Helps with making pico-sdk headers available, vscode launch setup, cmsis + gdb (not lldb yet).

https://github.com/gonzalolarralde/CPicoSDK/tree/2.2.7/Example

Here is an example project. You need to run build.sh a first time to make sure all VSCode files are setup but then after that you just use VSCode.

The main goal for this one is reduce friction and be up to some extent batteries-included. It has out of the box PSRAM support and there's an experimental support for multicore concurrency, although for full transparency the performance is not great yet as the scheduler is quite "meh". Working on it :)

Enough with the self-promotion, going more concretely to some of your questions:
I think #1 is answered,

2: To use SPI, I2C and other features the "swift-mmio" package is required?

If you end up using pico-sdk, with any of the existing integration methods, you can just call the functions exposed by the SDK. Depending on how you import the pico-sdk headers, if they are not patched in a way that helps c-importer you might have to specify the base address of the spi_hw or i2c_hw you want to use.

https://www.raspberrypi.com/documentation/pico-sdk/hardware.html#group_hardware_i2c

https://www.raspberrypi.com/documentation/pico-sdk/hardware.html#group_hardware_spi

Use a CMakeLists.txt?

    1. Required when using make / make
    2. Little bit hard to read for noobs, but that's the way to go?
    3. This also requires "ninja"?

This is indeed possible and if you are comfortable with CMake is not a bad option at all, as it allows you to customize pico-sdk in a sustainable way. I think you are already referring to this swift-embedded-examples, rpi-pico-blink-sdk. And yes, you will end up using ninja. FWIW the Raspberry Pi Pico VSCode plugin does a nice environment setup you can leverage for your own project if your concern is around entry complexity.

Cheers.

1 Like