Apple has introduced Embedded Swift, a streamlined adaptation of its Swift programming language designed just for microcontrollers. The current beta version supports multiple microcontrollers ranging from the Espressif ESP32-C6 wireless RISC-V microcontroller and other ARM microcontrollers from STMicroelectronics, Raspberry Pi, and Nordic Semiconductor. Originally used for Apple’s desktop and mobile platforms, Swift has now been adapted for microcontroller use, making it easier for developers to create applications on embedded devices like the STMicro’s STM32F746, Raspberry Pi’s RP2040, and Nordic’s nRF52840.
At WWDC 2024, Apple demonstrated how Embedded Swift works with the ESP32-C6-DevKitC-1 development board, showcasing simple demos such as LED blinking or hello world and more complex applications using the Matter protocol for smart home devices. Apple states the embedded Swift language is designed to be more compact, with a binary size potentially as small as 10KB, and includes features like the ability to access memory-mapped registers through the Swift MMIO library.
Apple explains that Embedded Swift aims to provide a more manageable learning curve for Swift mobile application developers transitioning to microcontroller programming. While Embedded Swift is still in its development stage, a beta version of embedded Swift can be downloaded for testing purposes, as a stable release has not yet been made available. If you are interested in learning more, you can check out the example codes provided for all supported MCUs in their GitHub repo.