WWDC 2024 - Go small with Embedded Swift - Detailed Setup and configuration guide

Hi, I am trying to get up to speed with embedded Swift, I purchased the ESP32-C6-DevKitC-1-N8 Development Board, I installed the ESP-IDF development environment for C, for the ESP32C6 for macOS (native) and Visual Studio Code, compiled via command line or VSCode and run one of the examples (flash the led), all good there, but none of Swift. At least the underlying software is ready to configure Swift on top.

The problem I have is setting up the Swift development environment on top of the ESP-IDF with Neovim, its configuration, etc., there are a lot of details to be able to make Swift Embedded run. Is there a detailed guide available (document, video, etc.) that I can use to get started?

Link to the WWDC video: Go small with Embedded Swift - WWDC24 - Videos - Apple Developer

Thank you

1 Like

Yes there absolutely is a more detailed yet of tutorials available here: swift-matter-examples tutorials.

Note we are currently investigating a crash in the firmware, but hopefully will have a fix ready soon. An intermediary stop-gap fix is mentioned here: Cannot commission smart light example · Issue #10 · apple/swift-matter-examples · GitHub

1 Like

Thank you, I have tried the guide multiple times, but it fails with a Python version error, I have investigated it, but I can't figure it out how to solve it.

Can you share the error you hit?

1 Like

The following command:

git clone
--branch release/v1.2
--depth 1
--shallow-submodules
--recursive GitHub - espressif/esp-matter: Espressif's SDK for Matter
--jobs 24

Fails randomly at different stages with error:

fatal: the remote end hung up unexpectedly

I have tried different internet connections, it always fails at some point, always different, any advice on how to address it? Thank you

I was able to fix the git issue by installing git-lfs (brew install git-lfs), then after running ./install.sh in the ~/esp/esp-matter directory, I got the following error:

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/python3'

I am using the default python3 version that comes installed with macOS 15.4 located at:

/usr/bin/python3

Any advice? Thank you

Fixed the python error with:

ln -s /usr/bin/python3 /usr/local/bin/python3

Now when running the command:

idf.py set-target esp32c6

I get the following error with the CMAKE version:

brosenz@MBP led-blink % idf.py set-target esp32c6

Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.

Executing action: fullclean

Build directory '/Users/brosenz/esp/swift-matter-examples/led-blink/build' not found. Nothing to clean.

Executing action: set-target

Set Target to: esp32c6, new sdkconfig will be created.

Running cmake in directory /Users/brosenz/esp/swift-matter-examples/led-blink/build

Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/Users/brosenz/.espressif/python_env/idf5.2_py3.9_env/bin/python -DESP_PLATFORM=1 -DIDF_TARGET=esp32c6 -DCCACHE_ENABLE=0 /Users/brosenz/esp/swift-matter-examples/led-blink"...

CMake Error at CMakeLists.txt:3 (cmake_minimum_required):

CMake 3.29 or higher is required. You are running version 3.24.0

-- Configuring incomplete, errors occurred!

cmake failed with exit code 1, output of the command is in the /Users/brosenz/esp/swift-matter-examples/led-blink/build/log/idf_py_stderr_output_68791 and /Users/brosenz/esp/swift-matter-examples/led-blink/build/log/idf_py_stdout_output_68791

If I run the command

brew info cmake , I get version 3.29.6:

brosenz@MBP led-blink % brew info cmake

Warning: Treating cmake as a formula. For the cask, use homebrew/cask/cmake or specify the --cask flag.

==> cmake: stable 3.29.6 (bottled), HEAD

This is the place I get stuck, any assistance will be appreciated, thanks

@rauhul please do you have any feedback on my errors? And how to fix them, thank you

It looks like your brew installation of CMake 3.29 either isn't part of your shell's PATH variable or isn't the first version in PATH directories.

Unfortunately its really tricky to debug environment errors remotely and all I can do is try to make guesses.

If you're open to it, I suggest using the Get started on a Linux Docker container tutorial which should work on both macOS and Linux host machines. The Dockerfile contained in the repo has all the steps needed for a working environment.

2 Likes

I like the Docker option, let me try, I will report back, thank you

Hi @rauhul - still some issues on the stock linux docker container...

ninja: error: '/root/esp/esp-idf/components/bt/controller/lib_esp32c6/esp32c6-bt-lib/libble_app.a', needed by 'light.elf', missing and no known rule to make it
ninja failed with exit code 1, output of the command is in the /code/smart-light/build/log/idf_py_stderr_output_485533 and /code/smart-light/build/log/idf_py_stdout_output_485533

Do you have any pointers on how to solve? Same error happens on the basic led blink sample as well

TIA

Hi there!

I'm also having problems with the Docker version. This is my error when trying to build:

root@a9b7eaad908f:/code/smart-light# idf.py build

Executing action: all (aliases: build)
Running ninja in directory /code/smart-light/build
Executing "ninja all"...
ninja: error: '/root/esp/esp-idf/components/bt/controller/lib_esp32c6/esp32c6-bt-lib/libble_app.a', needed by 'light.elf', missing and no known rule to make it
ninja failed with exit code 1, output of the command is in the /code/smart-light/build/log/idf_py_stderr_output_762 and /code/smart-light/build/log/idf_py_stdout_output_762

I also tried running bare on macOS Sequoia but getting a different error:

[725/1307] Performing build step for 'chip_gn'
FAILED: esp-idf/chip/chip_gn-prefix/src/chip_gn-stamp/chip_gn-build esp-idf/chip/lib/libCHIP.a /Users/d/esp/swift-matter-examples/led-blink/build/esp-idf/chip/chip_gn-prefix/src/chip_gn-stamp/chip_gn-build /Users/d/esp/swift-matter-examples/led-blink/build/esp-idf/chip/lib/libCHIP.a 
cd "/Users/d/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/Users/d/esp/swift-matter-examples/led-blink/build/esp-idf/chip" && ninja esp32
/bin/sh: line 0: cd: /Users/d/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/Users/d/esp/swift-matter-examples/led-blink/build/esp-idf/chip: No such file or directory

Maybe the tutorials need updating? I think I followed them to the letter :(

One bit I'm noticing looks quite different on my Docker setup is the device file passes to the ESP server:

esp_rfc2217_server.py -v -p 4000 /dev/cu.usbserial-10

But I only get /dev/cu.usbmodem1401 and /dev/cu.usbmodem54E20318041 available.

I'm with the ESP32-C6-N8.

Any further guidance on this I will greatly appreciate.

Thanks!