Apple’s Embedded Swift Programming Language Now Supports  ESP32-C6, nRF52840, RP2040 and other MCUs

Apple’s Embedded Swift Programming Language Now Supports ESP32-C6, nRF52840, RP2040 and other MCUs

Apple has recently released a beta version of Embedded Swift programming language that is said to work with ESP32-C6, Pi RP2040, STM32F7, and nRF52840 microcontrollers. Additionally, the company has also developed example codes for matter protocol based on ESP-IDF and ESP-Matter SDKs that help to accelerate development and foster innovation in the smart home and IoT space.

Apple is expanding Swift’s reach beyond mobile apps into the realm of microcontrollers. Previously, it was used on Mad Machine’s SwiftIO boards. Now, Apple has created “Embedded Swift,” a streamlined version of Swift tailored for microcontrollers. This new subset is currently compatible with STMicro STM32F746, Raspberry Pi Pico, nRF52840, and ESP32-C6.

@_cdecl("app_main")
func app_main() {
  print("🏎️   Hello, Embedded Swift! (LED Blink)")

  let led = LED()
  led.color = .red
  led.brightness = 10

  while true {
    sleep(1)
    led.enabled.toggle()
    if led.enabled {
      led.color = .hueSaturation(Int.random(in: 0 ..< 360), 100)
    }
  }
}

Embedded Swift, looks very similar to C programming language but without the semi-colons, the company also showcased a Matter demo on GitHub. Another sample code along with the matter demo is present on the other repo along with support for additional examples for ESP32-C6, STM32, RP2040, and nRF52840 in a separate repository.

Apple’s Embedded Swift, designed for microcontrollers, is a compact version of Swift with binaries as small as 10KB. It includes the Swift MMIO library for accessing memory-mapped registers and is supported through online forums.

Experienced ESP-IDF developers may not find Embedded Swift revolutionary, but it could be a game-changer for Swift mobile app developers. They can leverage their existing Swift knowledge to easily transition to embedded development, without the need to learn ESP-IDF or Arduino programming. However, it’s important to note that Embedded Swift is still under development and requires downloading snapshot versions of Swift for experimentation.

Please follow and like us:
Pin Share
About Debashis Das

Tech Content Creator | Hardware Design Engineer | IoT Enthusiast | Digital Storyteller | Video Creator | From crafting digital dialogues at Semicon Media to orchestrating online engagement at Electronics-lab.com, my journey is about making tech talk interesting and accessible. In the quiet corners of the day, I advocate for easier tech education, one tutorial at a time. Let's connect and keep the digital dialogue going!

view all posts by das
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
Get new posts by email:
Get new posts by email:

Join 97,426 other subscribers

Archives