公式のSwift Docker イメージは、Ubuntu Jammyを使うため、軽く30GBを超える。そこで、python3.10 の slim-bookworm を使って軽く作る手順を示す。
違いは Ubuntu Jammy か Debian Bookworm だが、どちらも カーネルは 6.8.0-64-generic と同じである。
1. イメージ取得
$ docker pull python:3.10-slim-bookworm
3.10-slim-bookworm: Pulling from library/python
fcff6a9ebd82: Pull complete
396a0e909cd5: Pull complete
1bd3486aafd2: Pull complete
Digest: sha256:8ad64ba4c969828c644c996e0f9239f0a84e01588464ec6ca79e507f6d4575b0
Status: Downloaded newer image for python:3.10-slim-bookworm
docker.io/library/python:3.10-slim-bookworm
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
swiftlang/swift nightly-main-jammy 9cb60ebda69b 2 days ago 5.22GB
python 3.10-slim-bookworm 8ad64ba4c969 6 days ago 217MB
単純比較ですが、初期イメージのサイズが 1桁違います。
2. コンテナ作成
以下のコマンドを順に実行
$ docker run -it --name swift-matter-builder-slim python:3.10-slim-bookworm /bin/bash
$ python --version
$ apt update
# 前提ライブラリのインストール
$ apt install -y --no-install-recommends \
binutils bison ccache curl dfu-util flex g++ gcc git gnupg \
gperf libavahi-client-dev libcairo2-dev libcurl4-openssl-dev \
libdbus-1-dev libedit-dev libffi-dev libgirepository1.0-dev \
libglib2.0-dev libicu-dev libncurses-dev libpython3-dev \
libreadline-dev libsdl2-dev libsqlite3-dev libssl-dev \
libstdc++-12-dev libusb-1.0-0 libxml2-dev ninja-build \
pkg-config python3-dev python3-pip python3-venv unzip \
uuid-dev wget
# Swiftのインストール
$ curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz && \
tar zxf swiftly-$(uname -m).tar.gz && \
./swiftly init --quiet-shell-followup && \
. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" && \
hash -r
# Proceed? (Y/n): y
$ swift --version
# Install CMake >= 3.29
$ python3 -m pip install "cmake>=3.29"
$ cmake --version
# ESP-IDFダウンロード
$ mkdir -p ~/esp && cd ~/esp
$ git clone -j8 -b v5.4.1 --depth 1 \
--shallow-submodules --recursive \
https://github.com/espressif/esp-idf.git
# ESP-IDFインストール
$ cd ~/esp/esp-idf && ./install.sh esp32c6
$ . ./export.sh
$ idf.py --version
# ESP-Matterダウンロード#1(時間がかかる)
$ cd ~/esp && git clone \
--branch release/v1.2 \
--depth 1 \
--shallow-submodules \
--recursive https://github.com/espressif/esp-matter.git \
--jobs 8
# ESP-Matterダウンロード#2
$ cd ~/esp/esp-matter/connectedhomeip/connectedhomeip \
&& ./scripts/checkout_submodules.py --platform esp32 linux --shallow
# ⭐️ESP-Matterインストールスクリプトの途中で`CPID`セットアップが失敗するため、手動で`zap`をインストール
# 1. zap のダウンロードと展開
$ mkdir ~/zap-tool && cd ~/zap-tool
$ wget https://github.com/project-chip/zap/releases/download/v2023.10.24-nightly/zap-linux-arm64.zip
$ unzip zap-linux-arm64.zip
# 2. 自動セットアップの干渉を回避するための設定
$ mv ~/esp/esp-matter/connectedhomeip/connectedhomeip/scripts/setup/zap.json zap.json.backup
$ echo '{ "packages": [ ] }' >~/esp/esp-matter/connectedhomeip/connectedhomeip/scripts/setup/zap.json
# 3. パスの設定とバイナリの配置
$ export ZAP_INSTALL_PATH=~/zap-tool/zap-cli
$ export PATH=$ZAP_INSTALL_PATH:$PATH
$ mkdir -p ~/esp/esp-matter/connectedhomeip/connectedhomeip/.environment/cipd/packages/zap/
$ cp ~/zap-tool/zap-cli ~/esp/esp-matter/connectedhomeip/connectedhomeip/.environment/cipd/packages/zap/
# ESP-Matterインストール
$ cd ~/esp/esp-matter && ./install.sh
# Setup shell environment
$ echo '. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh"' >> ~/.bashrc \
&& echo '. ~/esp/esp-idf/export.sh > /dev/null' >> ~/.bashrc \
&& echo '. ~/esp/esp-matter/export.sh > /dev/null' >> ~/.bashrc \
&& echo "export ESPPORT='rfc2217://host.docker.internal:4000?ign_set_control'" >> ~/.bashrc \
&& echo 'cd ~/esp/esp-matter/connectedhomeip/connectedhomeip && . ~/esp/esp-matter/export.sh && cd' >> ~/.bashrc
$ docker run -it --name swift-matter-builder-slim python:3.10-slim-bookworm /bin/bash
root@de7731282d41:/# python --version
Python 3.10.20
root@de7731282d41:/# apt update
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main arm64 Packages [8691 kB]
Get:5 http://deb.debian.org/debian bookworm-updates/main arm64 Packages [6936 B]
Get:6 http://deb.debian.org/debian-security bookworm-security/main arm64 Packages [293 kB]
Fetched 9245 kB in 4s (2446 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
# 前提ライブラリのインストール
root@de7731282d41:/# apt install -y --no-install-recommends \
binutils bison ccache curl dfu-util flex g++ gcc git gnupg \
gperf libavahi-client-dev libcairo2-dev libcurl4-openssl-dev \
libdbus-1-dev libedit-dev libffi-dev libgirepository1.0-dev \
libglib2.0-dev libicu-dev libncurses-dev libpython3-dev \
libreadline-dev libsdl2-dev libsqlite3-dev libssl-dev \
libstdc++-12-dev libusb-1.0-0 libxml2-dev ninja-build \
pkg-config python3-dev python3-pip python3-venv unzip \
uuid-dev wget
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
binutils-aarch64-linux-gnu binutils-common build-essential bzip2 cpp cpp-12
dirmngr dpkg-dev fontconfig-config fonts-dejavu-core g++-12 gcc-12
gir1.2-freedesktop gir1.2-glib-2.0 gir1.2-ibus-1.0 git-man gnupg-l10n
gnupg-utils gobject-introspection gpg gpg-agent gpg-wks-client
gpg-wks-server gpgconf gpgsm icu-devtools libasan8 libasound2
(以下省略)
# Swiftのインストール
root@de7731282d41:/# curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz && \
tar zxf swiftly-$(uname -m).tar.gz && \
./swiftly init --quiet-shell-followup && \
. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" && \
hash -r
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 26.4M 100 26.4M 0 0 30.6M 0 --:--:-- --:--:-- --:--:-- 30.6M
Welcome to swiftly, the Swift toolchain manager for Linux and macOS!
Please read the following information carefully before proceeding with the
installation. If you
wish to customize the steps performed during the installation process, refer to
'swiftly init -h'
for configuration options.
Swiftly installs files into the following locations:
/root/.local/share/swiftly - Directory for configuration files
/root/.local/share/swiftly/bin - Links to the binaries of the active toolchain
/root/.local/share/swiftly/toolchains - Directory hosting installed toolchains
These locations can be changed by setting the environment variables
SWIFTLY_HOME_DIR, SWIFTLY_BIN_DIR, and SWIFTLY_TOOLCHAINS_DIR before running
'swiftly init' again.
Once swiftly is set up, it will install the latest available Swift toolchain.
This can be
suppressed with the '--skip-install' option. In the process, swiftly will add
swift.org
GnuPG keys into your keychain to verify the integrity of the downloads.
For your convenience, swiftly will also attempt to modify your shell's profile
file to make
installed items available in your environment upon login. This can be suppressed
with the
'--no-modify-profile' option.
Proceed? (Y/n): y
Installing swiftly in /root/.local/share/swiftly/bin/swiftly...
Creating shell environment file for the user...
Updating profile...
Fetching the latest stable Swift release...
Installing Swift 6.3.1
Downloading Swift 6.3.1
100% [=============================================================]
Downloaded 1005.1 MiB of 1005.1 MiB
Verifying toolchain signature...
Extracting toolchain...
The global default toolchain has been set to `Swift 6.3.1`
Swift 6.3.1 is installed successfully!
root@de7731282d41:/# swift --version
Swift version 6.3.1 (swift-6.3.1-RELEASE)
Target: aarch64-unknown-linux-gnu
# Install CMake >= 3.29
root@de7731282d41:/# python3 -m pip install "cmake>=3.29"
Collecting cmake>=3.29
Downloading cmake-4.3.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (29.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 29.6/29.6 MB 86.2 MB/s eta 0:00:00
Installing collected packages: cmake
Successfully installed cmake-4.3.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
[notice] A new release of pip is available: 23.0.1 -> 26.1
[notice] To update, run: pip install --upgrade pip
root@de7731282d41:/# cmake --version
cmake version 4.3.2
# ESP-IDFダウンロード
root@de7731282d41:/# mkdir -p ~/esp && cd ~/esp
root@de7731282d41:~/esp# git clone -j8 -b v5.4.1 --depth 1 \
--shallow-submodules --recursive \
https://github.com/espressif/esp-idf.git
Cloning into 'esp-idf'...
remote: Enumerating objects: 17762, done.
remote: Counting objects: 100% (17762/17762), done.
remote: Compressing objects: 100% (12594/12594), done.
remote: Total 17762 (delta 4772), reused 14496 (delta 4325), pack-reused 0 (from 0)
Receiving objects: 100% (17762/17762), 51.21 MiB | 28.09 MiB/s, done.
Resolving deltas: 100% (4772/4772), done.
Note: switching to '4c2820d377d1375e787bcef612f0c32c1427d183'.
(以下省略)
# ESP-IDFインストール
root@de7731282d41:~/esp# cd ~/esp/esp-idf && ./install.sh esp32c6
INFO: Using IDF_PATH '/root/esp/esp-idf' for installation.
Detecting the Python interpreter
Checking "python3" ...
Python 3.10.20
"python3" has been detected
Checking Python compatibility
Installing ESP-IDF tools
Updating /root/.espressif/idf-env.json
Selected targets are: esp32c6
Current system platform: linux-arm64
(以下省略)
root@de7731282d41:~/esp/esp-idf# . ./export.sh
Checking "python3" ...
Python 3.10.20
"python3" has been detected
Activating ESP-IDF 5.4
Setting IDF_PATH to '/root/esp/esp-idf'.
* Checking python version ... 3.10.20
* Checking python dependencies ... OK
* Deactivating the current ESP-IDF environment (if any) ... OK
* Establishing a new ESP-IDF environment ... OK
* Identifying shell ... bash
* Detecting outdated tools in system ... OK - no outdated tools found
* Shell completion ... Autocompletion code generated
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
root@de7731282d41:~/esp/esp-idf# idf.py --version
ESP-IDF v5.4.1
# ESP-Matterダウンロード#1(時間がかかる)
root@de7731282d41:~/esp/esp-idf# cd ~/esp && git clone \
--branch release/v1.2 \
--depth 1 \
--shallow-submodules \
--recursive https://github.com/espressif/esp-matter.git \
--jobs 8
Cloning into 'esp-matter'...
remote: Enumerating objects: 493, done.
remote: Counting objects: 100% (493/493), done.
remote: Compressing objects: 100% (413/413), done.
remote: Total 493 (delta 122), reused 264 (delta 63), pack-reused 0 (from 0)
Receiving objects: 100% (493/493), 2.73 MiB | 35.82 MiB/s, done.
(以下省略)
# ESP-Matterダウンロード#2
root@de7731282d41:~/esp# cd ~/esp/esp-matter/connectedhomeip/connectedhomeip \
&& ./scripts/checkout_submodules.py --platform esp32 linux --shallow
Checking out: nlassert, nlio, nlunit-test, mbedtls, qrcode, m5stack-tft, pigweed, openthread, ot-br-posix, cirque, nanopb, freertos, third_party/pybind11/repo, third_party/jsoncpp/repo, editline, third_party/boringssl/repo/src, third_party/libwebsockets/repo, third_party/imgui/repo, perfetto
root@de7731282d41:~/esp/esp-matter/connectedhomeip/connectedhomeip# cd
# ESP-Matterインストールスクリプトの途中で`CPID`セットアップが失敗するので、手動で`zap`をインストール
# 1. zap のダウンロードと展開
root@de7731282d41:~# mkdir ~/zap-tool && cd ~/zap-tool
root@de7731282d41:~/zap-tool# wget https://github.com/project-chip/zap/releases/download/v2023.10.24-nightly/zap-linux-arm64.zip
--2026-04-29 02:36:49-- https://github.com/project-chip/zap/releases/download/v2023.10.24-nightly/zap-linux-arm64.zip
Resolving github.com (github.com)... 20.27.177.113
Connecting to github.com (github.com)|20.27.177.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://release-assets.githubusercontent.com/github-production-release-asset/250621901/1578a15b-6643-4f06-b462-73ea914c6627?sp=r&sv=2018-11-09&sr=b&spr=https&se=2026-04-29T03%3A29%3A11Z&rscd=attachment%3B+filename%3Dzap-linux-arm64.zip&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2026-04-29T02%3A29%3A02Z&ske=2026-04-29T03%3A29%3A11Z&sks=b&skv=2018-11-09&sig=3Rk%2BHUV78v6fg9BVYU0Dlay%2FOJWYU%2BXDI1bX3XQMMn4%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc3NzQzMzgxMCwibmJmIjoxNzc3NDMwMjEwLCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.8lIKUHP21UD4ZYFBrWAc6zUaN8ED22TEFIFhl3aYk9Q&response-content-disposition=attachment%3B%20filename%3Dzap-linux-arm64.zip&response-content-type=application%2Foctet-stream [following]
--2026-04-29 02:36:50-- https://release-assets.githubusercontent.com/github-production-release-asset/250621901/1578a15b-6643-4f06-b462-73ea914c6627?sp=r&sv=2018-11-09&sr=b&spr=https&se=2026-04-29T03%3A29%3A11Z&rscd=attachment%3B+filename%3Dzap-linux-arm64.zip&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2026-04-29T02%3A29%3A02Z&ske=2026-04-29T03%3A29%3A11Z&sks=b&skv=2018-11-09&sig=3Rk%2BHUV78v6fg9BVYU0Dlay%2FOJWYU%2BXDI1bX3XQMMn4%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc3NzQzMzgxMCwibmJmIjoxNzc3NDMwMjEwLCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.8lIKUHP21UD4ZYFBrWAc6zUaN8ED22TEFIFhl3aYk9Q&response-content-disposition=attachment%3B%20filename%3Dzap-linux-arm64.zip&response-content-type=application%2Foctet-stream
Resolving release-assets.githubusercontent.com (release-assets.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.109.133, ...
Connecting to release-assets.githubusercontent.com (release-assets.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 201264834 (192M) [application/octet-stream]
Saving to: ‘zap-linux-arm64.zip’
zap-linux-arm64.zip 100%[===================>] 191.94M 33.1MB/s in 5.8s
2026-04-29 02:36:56 (33.1 MB/s) - ‘zap-linux-arm64.zip’ saved [201264834/201264834]
root@de7731282d41:~/zap-tool# unzip zap-linux-arm64.zip
Archive: zap-linux-arm64.zip
inflating: LICENSE.electron.txt
inflating: LICENSES.chromium.html
inflating: apack.json
(以下省略)
# 2. 自動セットアップの干渉を回避するための設定
root@de7731282d41:~/zap-tool# mv ~/esp/esp-matter/connectedhomeip/connectedhomeip/scripts/setup/zap.json zap.json.backup
root@de7731282d41:~/zap-tool# echo '{ "packages": [ ] }' >~/esp/esp-matter/connectedhomeip/connectedhomeip/scripts/setup/zap.json
root@de7731282d41:~/zap-tool# cat /root/esp/esp-matter/connectedhomeip/connectedhomeip/scripts/setup/zap.json
{ "packages": [ ] }
# 3. パスの設定とバイナリの配置
root@de7731282d41:~/zap-tool# export ZAP_INSTALL_PATH=~/zap-tool/zap-cli
root@de7731282d41:~/zap-tool# export PATH=$ZAP_INSTALL_PATH:$PATH
root@de7731282d41:~/zap-tool# mkdir -p ~/esp/esp-matter/connectedhomeip/connectedhomeip/.environment/cipd/packages/zap/
root@de7731282d41:~/zap-tool# cp ~/zap-tool/zap-cli ~/esp/esp-matter/connectedhomeip/connectedhomeip/.environment/cipd/packages/zap/
# ESP-Matterインストール
root@de7731282d41:~/zap-tool# cd ~/esp/esp-matter && ./install.sh
Running Matter Setup
(途中省略)
WELCOME TO...
█
█
▄ █ ▄ █ █
▀▀█████▀▀ ▄▀▀▀▄ ▄▀▀▀▄ ▄▀▀▀▀▄█ ▀▀█▀▀▀▀▀█▀▀ ▄▀▀▀▀▄ ▄▀▀
▀█▄ ▄█▀ █ █ █ █ █ █ █ █▄▄▄▄▄▄█ █
▀█▄ ▄█▀ █ █ █ █ █ █ █ █ █
▄██▀▀█ █▀▀██▄ █ █ █ ▀▄▄▄▄▀█ ▀▄▄ ▀▄▄ ▀▄▄▄▄▀ █
▀▀ █ █ ▀▀
BOOTSTRAP! Bootstrap may take a few minutes; please be patient.
Downloading and installing packages into local source directory:
Setting up CIPD package manager...done (34.8s)
Setting up Project actions........skipped (0.1s)
Setting up Python environment.....done (41.3s)
Setting up pw packages............skipped (0.1s)
Setting up Host tools.............done (0.1s)
Activating environment (setting environment variables):
Setting environment variables for CIPD package manager...done
Setting environment variables for Project actions........skipped
Setting environment variables for Python environment.....done
Setting environment variables for pw packages............skipped
Setting environment variables for Host tools.............done
Checking the environment:
20260429 02:44:38 INF Environment passes all checks!
Environment looks good, you are ready to go!
To reactivate this environment in the future, run this in your
terminal:
source ./activate.sh
To deactivate this environment, run this:
deactivate
Installing pip requirements for all...
[notice] A new release of pip is available: 23.2.1 -> 26.1
[notice] To update, run: pip install --upgrade pip
Building host tools
Done. Made 7607 targets from 354 files in 151ms
ninja: Entering directory `/root/esp/esp-matter/connectedhomeip/connectedhomeip/out/host'
[651/651] ld ./chip-tool
Host tools built at: /root/esp/esp-matter/connectedhomeip/connectedhomeip/out/host
Exit Matter environment
Installing python dependencies for mfg_tool
(途中省略)
Successfully installed MarkupSafe-3.0.3 jinja2-3.0.1 lark-1.1.2 stringcase-1.2.0
All done! You can now run:
. ./export.sh
# Setup shell environment
root@de7731282d41:~/esp/esp-matter# cd
root@de7731282d41:~# echo '. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh"' >> ~/.bashrc \
&& echo '. ~/esp/esp-idf/export.sh > /dev/null' >> ~/.bashrc \
&& echo '. ~/esp/esp-matter/export.sh > /dev/null' >> ~/.bashrc \
&& echo "export ESPPORT='rfc2217://host.docker.internal:4000?ign_set_control'" >> ~/.bashrc \
&& echo 'cd ~/esp/esp-matter/connectedhomeip/connectedhomeip && . ~/esp/esp-matter/export.sh && cd' >> ~/.bashrc
#exit
3. LED Blinkサンプルのビルド
以下のコマンドを順に実行
$ docker start -i swift-matter-builder-slim
# 次の2つの.bashrcで実行済み
# . ~/esp/esp-idf/export.sh
# . ~/esp/esp-matter/export.sh
# サンプルのリポジトリをクローン
$ cd ~ && git clone https://github.com/apple/swift-matter-examples.git
# LED点滅サンプルに移動
$ cd ~/swift-matter-examples/led-blink
# ターゲットesp32c6を設定
$ idf.py set-target esp32c6
# ビルド
$ idf.py build
しかし、ARM版Linuxの影響か、さまざまなエラーが出て一筋縄ではビルドできません。
そこで、それらの対策を含めた手順を示します。以下のコマンドを順に実行
3.1. サンプルのリポジトリをクローン
$ cd ~ && git clone https://github.com/apple/swift-matter-examples.git
$ cd ~/swift-matter-examples/led-blink
3.2. ターゲット設定
$ idf.py set-target esp32c6
3.3. Bluetoothライブラリのパス変更(階層変更)
$ BT_LIB_DIR="/root/esp/esp-idf/components/bt/controller/lib_esp32c6/esp32c6-bt-lib"
$ cp "$BT_LIB_DIR/esp32c6/libble_app.a" "$BT_LIB_DIR/"
3.4. リンカスクリプトの作成
Swiftが生成する余計なセクションを破棄するためのファイルを作成
次の内容のmain/discard_swift.ldを作成する。
SECTIONS
{
/DISCARD/ :
{
*(.swift_modhash)
*(.swift5_*)
*(.got)
*(.got.plt)
*(.comment)
*(.note.GNU-stack)
}
}
3.5. main/CMakeLists.txt の変更
Swift 6.3.1 の引数エラーを防ぎ、上記リンカスクリプトを適用
main/CMakeLists.txtを、次の内容に置き換える
# コンポーネント登録
idf_component_register(
SRCS /dev/null
PRIV_INCLUDE_DIRS "."
)
# デフォルトのフラグをクリア
get_target_property(var ${COMPONENT_LIB} COMPILE_OPTIONS)
set_target_properties(${COMPONENT_LIB} PROPERTIES COMPILE_OPTIONS "")
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17)
target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H")
# インクルードパスの構築 (v5.4.1 用にパスを明示)
set(SWIFT_INCLUDES)
foreach(dir ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
if(IS_DIRECTORY ${dir})
string(CONCAT SWIFT_INCLUDES ${SWIFT_INCLUDES} "-Xcc -I${dir} ")
endif()
endforeach()
# 標準ライブラリパスの明示
set(RISCV_INCLUDE "/root/.espressif/tools/riscv32-esp-elf/esp-14.2.0_20241119/riscv32-esp-elf/riscv32-esp-elf/include")
if(IS_DIRECTORY ${RISCV_INCLUDE})
string(CONCAT SWIFT_INCLUDES ${SWIFT_INCLUDES} "-Xcc -I${RISCV_INCLUDE} ")
endif()
# Matter 関連ヘッダーのパス
string(CONCAT SWIFT_INCLUDES ${SWIFT_INCLUDES} "-Xcc -I${CMAKE_BINARY_DIR}/esp-idf/chip/gen/include ")
# Swiftサポートの有効化
set(CMAKE_Swift_COMPILER_WORKS YES)
set(CMAKE_Swift_COMPILATION_MODE_DEFAULT wholemodule)
set(CMAKE_Swift_COMPILATION_MODE wholemodule)
enable_language(Swift)
# ターゲットアーキテクチャ
set(SWIFT_TARGET "riscv32-none-none-eabi")
# Swiftコンパイルフラグ (Swift 6.3.1 対応最小構成)
target_compile_options(${COMPONENT_LIB} PUBLIC "$<$<COMPILE_LANGUAGE:Swift>:SHELL:
-target ${SWIFT_TARGET}
-Xfrontend -function-sections
-enable-experimental-feature Embedded
-wmo
-parse-as-library
-Osize
-color-diagnostics
-Xcc -fno-pic
-Xcc -fno-pie
-cxx-interoperability-mode=default
-Xcc -std=c++17
-Xcc -fno-exceptions
-Xcc -fno-rtti
-Xcc -DCHIP_HAVE_CONFIG_H
-Xcc -DESP_PLATFORM
-Xfrontend -gnone
-Xfrontend -disable-reflection-metadata
-Xfrontend -disable-reflection-names
-Xfrontend -enable-single-module-llvm-emission
-pch-output-dir /tmp
${SWIFT_INCLUDES}
-import-bridging-header ${CMAKE_CURRENT_LIST_DIR}/BridgingHeader.h
>")
# ソースファイルの追加
target_sources(${COMPONENT_LIB}
PRIVATE
LED.swift
Main.swift
)
# リンカスクリプトの適用
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--gc-sections")
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,-T,${CMAKE_CURRENT_LIST_DIR}/discard_swift.ld")
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--no-relax")
3.6. ビルド#1
エラーが起きるまで進める
$ idf.py build
[813/1366] 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 /root/swift-matter-examples/led-blink/build/esp-idf/chip/chip_gn-prefix/src/chip_gn-stamp/chip_gn-build /root/swift-matter-examples/led-blink/build/esp-idf/chip/lib/libCHIP.a
cd "/root/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/root/swift-matter-examples/led-blink/build/esp-idf/chip" && ninja esp32
ninja: error: loading 'build.ninja': No such file or directory
[814/1366] Linking C static library esp-idf/esp_coex/libesp_coex.a
ninja: build stopped: subcommand failed.
3.7. CMakeのパス回避
ESP-IDF v5.4.1 で発生する「パスがセミコロンで繋がってしまう」を回避
# セミコロン付きのディレクトリを強制作成
$ TARGET_DIR="/root/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/root/swift-matter-examples/led-blink/build/esp-idf/chip"
$ mkdir -p "$TARGET_DIR"
# 構成ファイルをリンク
$ ln -sf /root/swift-matter-examples/led-blink/build/esp-idf/chip/* "$TARGET_DIR/"
# 相対パスを絶対パスに書き換えてchip_gnを見つけられるようにする
$ cd "$TARGET_DIR"
$ sed -i 's|\.\./\.\./\.\./\.\./\.\./esp/|/root/esp/|g' build.ninja
$ touch build.ninja build.ninja.stamp
# chip_gn 単体で生成
$ ninja esp32
なお、セミコロン付きディレクトリを前以って作成したとしても、前項のエラーは避けられません。
3.8. ビルド#2
エラーが解決され最後まで進む
$ cd ~/swift-matter-examples/led-blink
$ idf.py build
Project build complete.
ただし、コンパイルワーニングは多数発生する。
3.9. 実行例
$ docker start -i swift-matter-builder-slim
Activating ESP-IDF 5.4
Setting IDF_PATH to '/root/esp/esp-idf'.
* Checking python version ... 3.10.20
* Checking python dependencies ... OK
* Deactivating the current ESP-IDF environment (if any) ... OK
* Establishing a new ESP-IDF environment ... OK
* Identifying shell ... bash
* Detecting outdated tools in system ... OK - no outdated tools found
* Shell completion ... Autocompletion code generated
# 1. サンプルのリポジトリをクローン
root@de7731282d41:~# cd ~ && git clone https://github.com/apple/swift-matter-examples.git
Cloning into 'swift-matter-examples'...
remote: Enumerating objects: 405, done.
remote: Counting objects: 100% (161/161), done.
remote: Compressing objects: 100% (94/94), done.
remote: Total 405 (delta 111), reused 70 (delta 66), pack-reused 244 (from 1)
Receiving objects: 100% (405/405), 17.37 MiB | 27.75 MiB/s, done.
Resolving deltas: 100% (195/195), done.
root@de7731282d41:~# cd ~/swift-matter-examples/led-blink
# 2. ターゲット設定
root@de7731282d41:~/swift-matter-examples/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 '/root/swift-matter-examples/led-blink/build' not found. Nothing to clean.
Executing action: set-target
Set Target to: esp32c6, new sdkconfig will be created.
(以下省略)
# 3. Bluetoothライブラリのパス変更(階層変更)
# ESP32-C6用のBluetoothライブラリのフォルダ階層が変更されているため、コピーする
root@de7731282d41:~/swift-matter-examples/led-blink# BT_LIB_DIR="/root/esp/esp-idf/components/bt/controller/lib_esp32c6/esp32c6-bt-lib"
root@de7731282d41:~/swift-matter-examples/led-blink# cp "$BT_LIB_DIR/esp32c6/libble_app.a" "$BT_LIB_DIR/"
root@de7731282d41:~/swift-matter-examples/led-blink# ls "$BT_LIB_DIR/"
NOTICE README.md esp32c6 esp32c61 libble_app.a
# 4. リンカスクリプトの作成
root@de7731282d41:~/swift-matter-examples/led-blink# cat >main/discard_swift.ld
SECTIONS
{
/DISCARD/ :
{
*(.swift_modhash)
*(.swift5_*)
*(.got)
*(.got.plt)
*(.comment)
*(.note.GNU-stack)
}
}
^D
# 5. main/CMakeLists.txt の変更
root@de7731282d41:~/swift-matter-examples/led-blink# cat > main/CMakeLists.txt
# コンポーネント登録
idf_component_register(
SRCS /dev/null
PRIV_INCLUDE_DIRS "."
)
# デフォルトのフラグをクリア
get_target_property(var ${COMPONENT_LIB} COMPILE_OPTIONS)
set_target_properties(${COMPONENT_LIB} PROPERTIES COMPILE_OPTIONS "")
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17)
target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H")
# インクルードパスの構築 (v5.4.1 用にパスを明示)
set(SWIFT_INCLUDES)
foreach(dir ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
if(IS_DIRECTORY ${dir})
string(CONCAT SWIFT_INCLUDES ${SWIFT_INCLUDES} "-Xcc -I${dir} ")
endif()
endforeach()
# 標準ライブラリパスの明示
set(RISCV_INCLUDE "/root/.espressif/tools/riscv32-esp-elf/esp-14.2.0_20241119/riscv32-esp-elf/riscv32-esp-elf/include")
if(IS_DIRECTORY ${RISCV_INCLUDE})
string(CONCAT SWIFT_INCLUDES ${SWIFT_INCLUDES} "-Xcc -I${RISCV_INCLUDE} ")
endif()
# Matter 関連ヘッダーのパス
string(CONCAT SWIFT_INCLUDES ${SWIFT_INCLUDES} "-Xcc -I${CMAKE_BINARY_DIR}/esp-idf/chip/gen/include ")
# Swiftサポートの有効化
set(CMAKE_Swift_COMPILER_WORKS YES)
set(CMAKE_Swift_COMPILATION_MODE_DEFAULT wholemodule)
set(CMAKE_Swift_COMPILATION_MODE wholemodule)
enable_language(Swift)
# ターゲットアーキテクチャ
set(SWIFT_TARGET "riscv32-none-none-eabi")
# Swiftコンパイルフラグ (Swift 6.3.1 対応最小構成)
target_compile_options(${COMPONENT_LIB} PUBLIC "$<$<COMPILE_LANGUAGE:Swift>:SHELL:
-target ${SWIFT_TARGET}
-Xfrontend -function-sections
-enable-experimental-feature Embedded
-wmo
-parse-as-library
-Osize
-color-diagnostics
-Xcc -fno-pic
-Xcc -fno-pie
-cxx-interoperability-mode=default
-Xcc -std=c++17
-Xcc -fno-exceptions
-Xcc -fno-rtti
-Xcc -DCHIP_HAVE_CONFIG_H
-Xcc -DESP_PLATFORM
-Xfrontend -gnone
-Xfrontend -disable-reflection-metadata
-Xfrontend -disable-reflection-names
-Xfrontend -enable-single-module-llvm-emission
-pch-output-dir /tmp
${SWIFT_INCLUDES}
-import-bridging-header ${CMAKE_CURRENT_LIST_DIR}/BridgingHeader.h
>")
# ソースファイルの追加
target_sources(${COMPONENT_LIB}
PRIVATE
LED.swift
Main.swift
)
# リンカスクリプトの適用
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--gc-sections")
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,-T,${CMAKE_CURRENT_LIST_DIR}/discard_swift.ld")
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--no-relax")
^D
# 6. ビルド#1(エラーが起きるまで進める)
root@de7731282d41:~/swift-matter-examples/led-blink# idf.py build
Executing action: all (aliases: build)
Running ninja in directory /root/swift-matter-examples/led-blink/build
Executing "ninja all"...
[0/1] Re-running CMake...CMake Deprecation Warning at /root/esp/esp-matter/device_hal/device/esp32c6_devkit_c/esp_matter_device.cmake:1 (cmake_minimum_required):
Compatibility with CMake < 3.10 will be removed from a future version of
CMake.
(途中省略)
[813/1366] 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 /root/swift-matter-examples/led-blink/build/esp-idf/chip/chip_gn-prefix/src/chip_gn-stamp/chip_gn-build /root/swift-matter-examples/led-blink/build/esp-idf/chip/lib/libCHIP.a
cd "/root/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/root/swift-matter-examples/led-blink/build/esp-idf/chip" && ninja esp32
ninja: error: loading 'build.ninja': No such file or directory
[814/1366] Linking C static library esp-idf/esp_coex/libesp_coex.a
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /root/swift-matter-examples/led-blink/build/log/idf_py_stderr_output_488 and /root/swift-matter-examples/led-blink/build/log/idf_py_stdout_output_488
(予定通りのエラーで停止)
# 7. CMakeのパス回避
root@de7731282d41:~/swift-matter-examples/led-blink# cd
# セミコロン付きのディレクトリを強制作成
root@de7731282d41:~# TARGET_DIR="/root/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/root/swift-matter-examples/led-blink/build/esp-idf/chip"
root@de7731282d41:~# mkdir -p "$TARGET_DIR"
# 構成ファイルをリンク
root@de7731282d41:~# ln -sf /root/swift-matter-examples/led-blink/build/esp-idf/chip/* "$TARGET_DIR/"
root@de7731282d41:~# ls "$TARGET_DIR"
CMakeFiles build.ninja.d gen relative_path_transformations.json
args.gn build.ninja.stamp lib toolchain.ninja
args.gn.in chip_gn-prefix obj
build.ninja cmake_install.cmake python
# 相対パスを絶対パスに書き換えてchip_gnを見つけられるようにする
root@de7731282d41:~# cd "$TARGET_DIR"
root@de7731282d41:~/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/root/swift-matter-examples/led-blink/build/esp-idf/chip# sed -i 's|\.\./\.\./\.\./\.\./\.\./esp/|/root/esp/|g' build.ninja
root@de7731282d41:~/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/root/swift-matter-examples/led-blink/build/esp-idf/chip# touch build.ninja build.ninja.stamp
root@de7731282d41:~/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/root/swift-matter-examples/led-blink/build/esp-idf/chip# ninja esp32
[0/1] Regenerating ninja files
[453/453] stamp obj/esp32.stamp
# 8. ビルド#2(エラーが解決され最後まで進む)
root@de7731282d41:~/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/root/swift-matter-examples/led-blink/build/esp-idf/chip# cd ~/swift-matter-examples/led-blink
root@de7731282d41:~/swift-matter-examples/led-blink# idf.py build
Executing action: all (aliases: build)
Running ninja in directory /root/swift-matter-examples/led-blink/build
Executing "ninja all"...
[1/556] Performing build step for 'chip_gn'
ninja: no work to do.
[1/1] cd /root/swift-matter-examples/l...-blink/build/bootloader/bootloader.bin
Bootloader binary size 0x55f0 bytes. 0x6a10 bytes (55%) free.
(途中省略)
[555/556] Generating binary image from built executable
esptool.py v4.11.0
Creating esp32c6 image...
Merged 1 ELF section
Successfully created esp32c6 image.
Generated /root/swift-matter-examples/led-blink/build/light.bin
[556/556] cd /root/swift-matter-exampl...ter-examples/led-blink/build/light.bin
light.bin binary size 0x2ccd0 bytes. Smallest app partition is 0x1e0000 bytes. 0x1b3330 bytes (91%) free.
Project build complete. To flash, run:
idf.py flash
or
idf.py -p rfc2217://host.docker.internal:4000?ign_set_control flash
or
idf.py -p PORT flash
or
python -m esptool --chip esp32c6 -b 460800 --before default_reset --after hard_reset -p rfc2217://host.docker.internal:4000?ign_set_control write_flash --flash_mode dio --flash_size 4MB --flash_freq 80m 0x0 build/bootloader/bootloader.bin 0xc000 build/partition_table/partition-table.bin 0x1d000 build/ota_data_initial.bin 0x20000 build/light.bin
or from the "/root/swift-matter-examples/led-blink/build" directory
python -m esptool --chip esp32c6 -b 460800 --before default_reset --after hard_reset -p rfc2217://host.docker.internal:4000?ign_set_control write_flash "@flash_args"
# 生成物の確認
root@de7731282d41:~/swift-matter-examples/led-blink# ls -FG build
CMakeCache.txt flash_app_args led-blink_merged.bin
CMakeFiles/ flash_args light.bin
app-flash_args flash_args.in light.elf*
bootloader/ flash_bootloader_args light.map
bootloader-flash_args flash_project_args log/
bootloader-prefix/ flasher_args.json ota_data_initial.bin
build.ninja gdbinit/ otadata-flash_args
cmake_install.cmake https_server.crt.S partition-table-flash_args
compile_commands.json kconfigs.in partition_table/
config/ kconfigs_projbuild.in project_description.json
config.env ldgen_libraries project_elf_src_esp32c6.c
esp-idf/ ldgen_libraries.in x509_crt_bundle.S
無事にビルドできました。
4. ESP32-C6 へ書き込む
4.1. ESP32-C6をスタンバイ
PC の USB に ESP32-C6 を接続。BOOTを押したままRESETする。
別のターミナルから次のコマンドを実行する。
# Find your attached microcontroller
# On macOS it usually attaches on /dev/cu.usbmodemXXXX
$ ls /dev/cu.*
/dev/cu.Bluetooth-Incoming-Port /dev/cu.usbmodem1201
/dev/cu.debug-console
# Run the serial server
$ esp_rfc2217_server -v -p 4000 /dev/cu.usbmodem1201
INFO: RFC 2217 TCP/IP to Serial redirector - type Ctrl-C / BREAK to quit
INFO: Serving serial port: /dev/cu.usbmodem1201
INFO: TCP/IP port: 4000
INFO: Waiting for connection ... use the 'rfc2217://127.0.0.1:4000?ign_set_control' as a PORT
...
4.2. Linux側(Dockerコンテナ)からフラッシュ
ビルドが完了したターミナルで、続けて、次のコマンドを実行する
$ export ESPPORT=rfc2217://host.docker.internal:4000?ign_set_control
$ export ESPBAUD=921600
$ idf.py flash
root@de7731282d41:~/swift-matter-examples/led-blink# export ESPPORT=rfc2217://host.docker.internal:4000?ign_set_control
root@de7731282d41:~/swift-matter-examples/led-blink# export ESPBAUD=921600
root@de7731282d41:~/swift-matter-examples/led-blink# idf.py flash
Executing action: flash
Running ninja in directory /root/swift-matter-examples/led-blink/build
Executing "ninja flash"...
[1/10] Performing build step for 'chip_gn'
ninja: no work to do.
[1/1] cd /root/swift-matter-examples/l...-blink/build/bootloader/bootloader.bin
Bootloader binary size 0x55f0 bytes. 0x6a10 bytes (55%) free.
[7/8] cd /root/swift-matter-examples/l...ter-examples/led-blink/build/light.bin
light.bin binary size 0x2ccd0 bytes. Smallest app partition is 0x1e0000 bytes. 0x1b3330 bytes (91%) free.
[7/8] cd /root/esp/esp-idf/components/...nents/esptool_py/run_serial_tool.cmake
esptool.py --chip esp32c6 -p rfc2217://host.docker.internal:4000?ign_set_control -b 921600 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 bootloader/bootloader.bin 0x20000 light.bin 0xc000 partition_table/partition-table.bin 0x1d000 ota_data_initial.bin
esptool.py v4.11.0
Serial port rfc2217://host.docker.internal:4000?ign_set_control
Connecting...
Device PID identification is only supported on COM and /dev/ serial ports.
Chip is ESP32-C6 (QFN40) (revision v0.1)
Features: Wi-Fi 6, BT 5 (LE), IEEE802.15.4, Single Core + LP Core, 160MHz, Unknown Embedded Flash
Crystal is 40MHz
USB mode: USB-Serial/JTAG
MAC: f0:f5:bd:ff:fe:03:33:90
BASE MAC: f0:f5:bd:03:33:90
MAC_EXT: ff:fe
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00020000 to 0x0004cfff...
Flash will be erased from 0x0000c000 to 0x0000cfff...
Flash will be erased from 0x0001d000 to 0x0001efff...
SHA digest in image updated
Compressed 22000 bytes to 13587...
Writing at 0x00000000... (100 %)
Wrote 22000 bytes (13587 compressed) at 0x00000000 in 0.7 seconds (effective 264.8 kbit/s)...
Hash of data verified.
Compressed 183504 bytes to 99262...
Writing at 0x0004c47c... (100 %)
Wrote 183504 bytes (99262 compressed) at 0x00020000 in 2.8 seconds (effective 516.8 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 198...
Writing at 0x0000c000... (100 %)
Wrote 3072 bytes (198 compressed) at 0x0000c000 in 0.6 seconds (effective 38.9 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 31...
Writing at 0x0001d000... (100 %)
Wrote 8192 bytes (31 compressed) at 0x0001d000 in 0.6 seconds (effective 103.2 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Done
root@de7731282d41:~/swift-matter-examples/led-blink#
リモートで書き込むのが面倒な場合は、Linux側でBINファイルをマージして、マージドBINをdocker cpコマンドでローカルにコピーして、ローカルでwrite-flashする方が早いかもしれません。
root@de7731282d41:~/swift-matter-examples/led-blink# cd build
root@de7731282d41:~/swift-matter-examples/led-blink/build# python -m esptool --chip esp32c6 merge_bin -o led-blink_merged.bin "@flash_args"
esptool.py --chip esp32c6 merge_bin -o led-blink_merged.bin --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 bootloader/bootloader.bin 0x20000 light.bin 0xc000 partition_table/partition-table.bin 0x1d000 ota_data_initial.bin
esptool.py v4.11.0
SHA digest in image updated
Wrote 0x4ccd0 bytes to file led-blink_merged.bin, ready to flash to offset 0x0
# `docker cp`コマンドでマージドBINをローカルにコピー
$ docker cp df15f5c26c7b:/root/swift-matter-examples/led-blink/merged_light.bin .
Successfully copied 308kB to .
$ esptool --chip esp32c6 --port /dev/cu.usbmodem1201 --baud 2000000 write-flash 0 led-blink_merged.bin
5. 実行
ローカルのscreenコマンドでモニター
$ screen /dev/cu.usbmodem1201 115200
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x1 (POWERON),boot:0x1d (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x40875720,len:0x16b8
load:0x4086c110,len:0xe84
load:0x4086e610,len:0x3054
entry 0x4086c11a
I (23) boot: ESP-IDF v5.4.1 2nd stage bootloader
I (24) boot: compile time Apr 29 2026 09:05:45
I (24) boot: chip revision: v0.1
I (24) boot: efuse block revision: v0.2
I (27) boot.esp32c6: SPI Speed : 80MHz
I (31) boot.esp32c6: SPI Mode : DIO
I (35) boot.esp32c6: SPI Flash Size : 4MB
I (39) boot: Enabling RNG early entropy source...
I (43) boot: Partition Table:
I (46) boot: ## Label Usage Type ST Offset Length
I (52) boot: 0 esp_secure_cert unknown 3f 06 0000d000 00002000
I (58) boot: 1 nvs WiFi data 01 02 00010000 0000c000
I (65) boot: 2 nvs_keys NVS keys 01 04 0001c000 00001000
I (71) boot: 3 otadata OTA data 01 00 0001d000 00002000
I (78) boot: 4 phy_init RF data 01 01 0001f000 00001000
I (84) boot: 5 ota_0 OTA app 00 10 00020000 001e0000
I (91) boot: 6 ota_1 OTA app 00 11 00200000 001e0000
I (98) boot: 7 fctry WiFi data 01 02 003e0000 00006000
I (104) boot: 8 coredump Unknown data 01 03 003e6000 00010000
I (111) boot: End of partition table
I (114) esp_image: segment 0: paddr=00020020 vaddr=42020020 size=0a9e8h ( 43496) map
I (130) esp_image: segment 1: paddr=0002aa10 vaddr=40800000 size=05608h ( 22024) load
I (135) esp_image: segment 2: paddr=00030020 vaddr=42000020 size=1474ch ( 83788) map
I (152) esp_image: segment 3: paddr=00044774 vaddr=40805608 size=06c0ch ( 27660) load
I (159) esp_image: segment 4: paddr=0004b388 vaddr=4080c220 size=0191ch ( 6428) load
I (163) boot: Loaded app from partition at offset 0x20000
I (164) boot: Disabling RNG early entropy source...
I (177) cpu_start: Unicore app
I (186) cpu_start: Pro cpu start user code
I (186) cpu_start: cpu freq: 160000000 Hz
I (186) app_init: Application information:
I (186) app_init: Project name: light
I (189) app_init: App version: 1.0
I (193) app_init: Compile time: Apr 29 2026 09:05:43
I (198) app_init: ELF file SHA256: a03614473...
I (202) app_init: ESP-IDF: v5.4.1
I (206) efuse_init: Min chip rev: v0.0
I (210) efuse_init: Max chip rev: v0.99
I (214) efuse_init: Chip rev: v0.1
I (218) heap_init: Initializing. RAM available for dynamic allocation:
I (224) heap_init: At 4080F250 len 0006D3C0 (436 KiB): RAM
I (229) heap_init: At 4087C610 len 00002F54 (11 KiB): RAM
I (234) heap_init: At 50000000 len 00003FE8 (15 KiB): RTCRAM
I (241) spi_flash: detected chip: generic
I (244) spi_flash: flash io: dio
W (246) spi_flash: Detected size(8192k) larger than the size in the binary image header(4096k). Using the size in the binary image header.
W (259) rmt(legacy): legacy driver is deprecated, please migrate to `driver/rmt_tx.h` and/or `driver/rmt_rx.h`
I (269) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (275) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (281) esp_core_dump_flash: Init core dump to flash
I (286) esp_core_dump_flash: Found partition 'coredump' @ 3e6000 65536 bytes
I (293) coexist: coex firmware version: e727207
I (297) coexist: coexist rom version 5b8dcfa
I (301) main_task: Started on CPU0
I (301) main_task: Calling app_main()
�️ Hello, Embedded Swift! (LED Blink)
I (311) led_driver_ws2812: Initializing light driver
I (311) led_driver_ws2812: led set r:0, g:0, b:0
I (311) led_driver_ws2812: led set r:0, g:0, b:0
I (321) led_driver_ws2812: led set r:0, g:0, b:0
I (321) led_driver_ws2812: led set r:25, g:0, b:0
I (1331) led_driver_ws2812: led set r:0, g:0, b:0
I (2331) led_driver_ws2812: led set r:25, g:0, b:0
I (2331) led_driver_ws2812: led set r:12, g:0, b:25
I (2331) led_driver_ws2812: led set r:12, g:0, b:25
I (3331) led_driver_ws2812: led set r:0, g:0, b:0
I (4331) led_driver_ws2812: led set r:12, g:0, b:25
I (4331) led_driver_ws2812: led set r:0, g:25, b:7
I (4331) led_driver_ws2812: led set r:0, g:25, b:7
I (5331) led_driver_ws2812: led set r:0, g:0, b:0
I (6331) led_driver_ws2812: led set r:0, g:25, b:7
I (6331) led_driver_ws2812: led set r:17, g:0, b:25
I (6331) led_driver_ws2812: led set r:17, g:0, b:25
I (7331) led_driver_ws2812: led set r:0, g:0, b:0
I (8331) led_driver_ws2812: led set r:17, g:0, b:25
I (8331) led_driver_ws2812: led set r:25, g:7, b:0
I (8331) led_driver_ws2812: led set r:25, g:7, b:0
I (9331) led_driver_ws2812: led set r:0, g:0, b:0
I (10331) led_driver_ws2812: led set r:25, g:7, b:0
I (10331) led_driver_ws2812: led set r:2, g:0, b:25
I (10331) led_driver_ws2812: led set r:2, g:0, b:25
I (11331) led_driver_ws2812: led set r:0, g:0, b:0
: :
GPIO8に接続したRGBLEDが光りました。
参考URL
Get started on a Linux Docker container
サイズは”軽い”が、手順は”重かった”。
以上