Apple’s Embedded Swift programming language supports ESP32-C6, Raspberry Pi RP2040, STM32F7, nRF52840 microcontrollers

Apple has released a beta version of Embedded Swift that notably works with Espressif ESP32-C6 wireless RISC-V microcontroller, and the company also built a Matter sample based on ESP-IDF and ESP-Matter SDKs. Embedded Swift is not limited to the ESP32-C6 and supports other microcontrollers from STMicro, Raspberry Pi, Nordic Semi, etc…

Apple Swift programming language is mostly designed for mobile app development, but we’ve also seen it being used on Mad Machine’s SwiftIO board powered by a 600 MHz NXP i.MX RT1052 Arm Cortex-M7 crossover processor and the tiny SwiftIO Micro launched a few years later. The company has now decided to create a subset of the Swift programming language better suited to microcontrollers simply called Embedded Swift that’s currently working on STMicro STM32F746, Raspberry Pi Pico, nRF52840, and ESP32-C6.

ESP32-C6 Apple Embedded Swift

The “Go small with Embedded Swift” presentation at WWDC 2024 shows how to get started with Embedded Swift using Espressif Systems’ESP32-C6-DevKitC-1 development board running simple demos such as “Hello world” and changing color on a RGB LED up to a more complex demo using the Matter protocol for the Smart Home.

This is what the code for the RGB LED looks like:


It looks quite similar to C without the semi-colons… You’ll find the sample code for the Matter demo on GitHub, and additional Embedded Swift examples for ESP32-C6, STM32, RP2040, and nRF52840 in a separate repository.

Apple explains that Embedded Swift is a subset of the Swift programming language with a much smaller footprint (the binary can be around 10KB based on the diagram below). They’ve removed some features but added others needed for MCU-class hardware such as the ability to access memory-mapped registers through the Swift MMIO library. Support is provided through online forums.

I assume most developers already familiar with the ESP-IDF will ignore this news, but Swift mobile application developers may have a shorter learning curve with Embedded Swift than having to learn to use the ESP-IDF framework or Arduino programming. Note that Embedded Swift is still at the development stage, so you need to download snapshots of Swift to try it out since there’s no stable release just yet.

Swift vs Embedded Swift
Embedded Swift enables a much smaller footprint.
Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX Rockchip RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
5 Comments
oldest
newest
Anonymouse
Anonymouse
5 months ago

I hope no any smart aleck will think of using this in production. Let DIY enthusiasts and smoothie lovers blink an LED from their toy laptop; that should be enough for them.

RK
RK
5 months ago

I only have a passing familiarity with Swift (literally can’t write an hello world) but it’s a compiled language without a garbage collector that error handles without an exceptions stack so it should be more suitable for micros than c++ while offering some conveniences over C.

I think it will come down to how much cheaper Swift devs are going to be compared to Rust and experienced C devs. After all, compared to embedded c and rust people, mobile devs aren’t exactly in short supply.

Ryan Weiss
Ryan Weiss
5 months ago

Okay so another entire tech stack to please Apple enthusiasts… Who don’t know python?
Let you divide the industry again, Apple? Sigh.
Well this all comes down to library support, like any other… So goodluck reinventing the wheel just so you can use some language features.

Ines
5 months ago

I’m Ines from MadMachine. I think Embedded Swift has tons of potential for more complex applications like UI apps. While simple tasks like blinking an LED and reading sensor values can be handled by common MCUs, as MCUs get more powerful and tasks get more complex, languages like Swift and Rust become better choices.

Our team has been working on bringing Swift to embedded development since 2019, and we have been struggling with library support since then, lol. But now, we’ve got a pretty solid framework that lets us focus on developing cool applications for hardware.

Rkraja
Rkraja
5 months ago

It is very useful technology and these very good 👍 and smooth work on devices
So I mostalally use

Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...