0. はじめに
これまで ESP-IDF 環境を macOS に構築していたが、先日、何故か MicroPython がビルドできず、急遽、Ubuntu on Docker on macOS に構築した。
しかし、イメージのサイズを見てびっくり、5GB も使っている。
(公式のSwiftイメージに相乗り)
% docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
swift latest a4c440b0dd87 3 weeks ago 5.05GB
そこで、軽量な bookworm-slim で構築し直しすことにした。
さらに、ESP-IDF は Python3を必須としてるため、python:3.10-slim-bookworm のイメージに相乗りする。
備忘録を兼ねて、一通りのコマンドを載せておく。
1. イメージ取得
% docker pull python:3.10-slim-bookworm
3.10-slim-bookworm: Pulling from library/python
24beac2f7d30: Pull complete
172c562f7090: Pull complete
eccae74c3489: Pull complete
f4e51325a7cb: Pull complete
Digest: sha256:cda0e2fa3894f9ada2c652534e6de6b2fe65687c63208a77e9e8d88231547902
Status: Downloaded newer image for python:3.10-slim-bookworm
docker.io/library/python:3.10-slim-bookworm
% docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
python 3.10-slim-bookworm cda0e2fa3894 2 days ago 217MB
alpine latest 4b7ce07002c6 4 days ago 13.3MB
さすがに alpine には 敵わないが、bookworm-slim でも 約220MB と十分に軽量。
2. run(初回起動)
% docker run -it --name bookworm-slim python:3.10-slim-bookworm /bin/bash
root@2ad1244b7195:/# 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 [8693 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 [276 kB]
Fetched 9230 kB in 1s (10.3 MB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
root@2ad1244b7195:/# python --version
Python 3.10.19
root@2ad1244b7195:/# apt install -y git git-lfs gettext uncrustify wget flex bison gperf cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 tree bsdmainutils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
(以下省略)
root@2ad1244b7195:/# cd
root@2ad1244b7195:~# git clone -j8 -b v5.4.2 --recursive https://github.com/espressif/esp-idf.git
Cloning into 'esp-idf'...
remote: Enumerating objects: 848376, done.
remote: Counting objects: 100% (2261/2261), done.
remote: Compressing objects: 100% (410/410), done.
remote: Total 848376 (delta 1950), reused 1970 (delta 1838), pack-reused 846115 (from 3)
Receiving objects: 100% (848376/848376), 367.02 MiB | 25.32 MiB/s, done.
Resolving deltas: 100% (615665/615665), done.
Note: switching to 'f5c3654a1c2d2a01f7f67def7a0dc48e691f63c0'.
(以下省略)
root@2ad1244b7195:~# cd esp-idf
root@2ad1244b7195:~/esp-idf# ./install.sh
INFO: Using IDF_PATH '~/esp-idf' for installation.
Detecting the Python interpreter
Checking "python3" ...
Python 3.10.19
"python3" has been detected
Checking Python compatibility
Installing ESP-IDF tools
Updating /root/.espressif/idf-env.json
Selected targets are: esp32c3, esp32c5, esp32h21, esp32c61, esp32s2, esp32s3, esp32c6, esp32, esp32h4, esp32p4, esp32c2, esp32h2
Current system platform: linux-arm64
(以下省略)
root@2ad1244b7195:~/esp-idf# . ./export.sh
Checking "python3" ...
Python 3.10.19
"python3" has been detected
Activating ESP-IDF 5.5
Setting IDF_PATH to '~/esp-idf'.
* Checking python version ... 3.10.19
* 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
# 後に、~/.bashrc に書く
root@2ad1244b7195:~/esp-idf# export IDF_TOOLS_PATH=$IDF_PATH/tools
root@2ad1244b7195:~/esp-idf# cd
root@2ad1244b7195:~# git clone -j8 -b v1.26.1 --recursive https://github.com/micropython/micropython.git
Cloning into 'micropython'...
remote: Enumerating objects: 135007, done.
remote: Counting objects: 100% (123/123), done.
remote: Compressing objects: 100% (70/70), done.
remote: Total 135007 (delta 69), reused 53 (delta 53), pack-reused 134884 (from 3)
(以下省略)
root@2ad1244b7195:~# cd micropython
root@2ad1244b7195:~/micropython# make -C mpy-cross
make: Entering directory '/root/micropython/mpy-cross'
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
mkdir -p build/genhdr
GEN build/genhdr/mpversion.h
GEN build/genhdr/qstr.i.last
GEN build/genhdr/qstr.split
GEN build/genhdr/qstrdefs.collected.h
(以下省略)
root@2ad1244b7195:~/micropython# cd ports/esp32
root@2ad1244b7195:~/micropython/ports/esp32# make submodules
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Executing action: reconfigure
Running cmake in directory /root/micropython/ports/esp32/build-ESP32_GENERIC/submodules
(以下省略)
# exit
root@2ad1244b7195:~/micropython/ports/esp32# ^D
ESP-IDF と MicroPython のリポジトリをクローンして、初期設定までした。
ERROR: /root/esp-idf/tools/espidf.constraints.v5.4.txt doesn't exist. Perhaps you've forgotten to run the install scripts. Please check the installation guide for more information.
make submodulesにて 上記エラーとなった場合は、次のコマンドでコピーする。
wget -o /root/esp-idf/tools/espidf.constraints.v5.4.txt https://dl.espressif.com/dl/esp-idf/espidf.constraints.v5.4.txt
3. start(2回目以降の起動)
ESP-IDF example/hello_world をビルドする。
% docker start -i bookworm-slim
root@2ad1244b7195:/# cd
root@2ad1244b7195:~# mkdir esp
root@2ad1244b7195:~# cd esp
root@2ad1244b7195:~/esp# cp -r ~/esp-idf/examples/get-started/hello_world .
root@2ad1244b7195:~/esp# cd hello_world/
root@2ad1244b7195:~/esp/hello_world# tree .
.
├── CMakeLists.txt
├── README.md
├── main
│ ├── CMakeLists.txt
│ └── hello_world_main.c
├── pytest_hello_world.py
└── sdkconfig.ci
2 directories, 6 files
root@2ad1244b7195:~/esp/hello_world# idf.py build
Executing action: all (aliases: build)
Running cmake in directory /root/esp/hello_world/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/root/esp-idf/tools/python_env/idf5.4_py3.10_env/bin/python -DESP_PLATFORM=1 -DCCACHE_ENABLE=0 /root/esp/hello_world"...
-- IDF_TARGET not set, using default target: esp32
-- Found Git: /usr/bin/git (found version "2.39.5")
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /root/esp-idf/tools/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc
(中略)
/root/esp/hello_world/bui..._world/build/bootloader/bootloader.bin
Bootloader binary size 0x6570 bytes. 0xa90 bytes (9%) free.
[996/997] Generating binary image from built executable
esptool.py v4.10.0
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
Generated /root/esp/hello_world/build/hello_world.bin
[997/997] cd /root/esp/hello_world/bui.../esp/hello_world/build/hello_world.bin
hello_world.bin binary size 0x2c090 bytes. Smallest app partition is 0x100000 bytes. 0xd3f70 bytes (83%) free.
Project build complete. To flash, run:
idf.py flash
or
idf.py -p PORT flash
or
python -m esptool --chip esp32 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 2MB --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/hello_world.bin
or from the "/root/esp/hello_world/build" directory
python -m esptool --chip esp32 -b 460800 --before default_reset --after hard_reset write_flash "@flash_args"
- ESP32-WROOM-32 に焼いて動かす
% esptool.py --chip esp32 --port /dev/cu.usbserial-0001 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 2MB --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/hello_world.bin
esptool.py v4.8.1
Serial port /dev/cu.usbserial-0001
Connecting......
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 78:e3:6d:14:eb:98
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00007fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x0003cfff...
SHA digest in image updated
Compressed 25968 bytes to 16363...
Wrote 25968 bytes (16363 compressed) at 0x00001000 in 0.7 seconds (effective 286.4 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.1 seconds (effective 369.1 kbit/s)...
Hash of data verified.
Compressed 180368 bytes to 98156...
Wrote 180368 bytes (98156 compressed) at 0x00010000 in 2.8 seconds (effective 511.4 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
% screen /dev/cu.usbserial-0001 115200
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6276
load:0x40078000,len:15736
load:0x40080400,len:4
load:0x40080404,len:3860
entry 0x4008063c
I (29) boot: ESP-IDF v5.4.2 2nd stage bootloader
I (29) boot: compile time Oct 13 2025 01:37:13
I (29) boot: Multicore bootloader
I (31) boot: chip revision: v1.0
I (33) boot.esp32: SPI Speed : 40MHz
I (37) boot.esp32: SPI Mode : DIO
I (41) boot.esp32: SPI Flash Size : 2MB
I (44) boot: Enabling RNG early entropy source...
I (49) boot: Partition Table:
I (51) boot: ## Label Usage Type ST Offset Length
I (58) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (64) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (71) boot: 2 factory factory app 00 00 00010000 00100000
I (77) boot: End of partition table
I (80) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0990ch ( 39180) map
I (101) esp_image: segment 1: paddr=00019934 vaddr=3ff80000 size=0001ch ( 28) load
I (102) esp_image: segment 2: paddr=00019958 vaddr=3ffb0000 size=02380h ( 9088) load
I (109) esp_image: segment 3: paddr=0001bce0 vaddr=40080000 size=04338h ( 17208) load
I (120) esp_image: segment 4: paddr=00020020 vaddr=400d0020 size=1358ch ( 79244) map
I (147) esp_image: segment 5: paddr=000335b4 vaddr=40084338 size=08aach ( 35500) load
I (168) boot: Loaded app from partition at offset 0x10000
I (168) boot: Disabling RNG early entropy source...
I (178) cpu_start: Multicore app
I (187) cpu_start: Pro cpu start user code
I (187) cpu_start: cpu freq: 160000000 Hz
I (187) app_init: Application information:
I (187) app_init: Project name: hello_world
I (191) app_init: App version: 1
I (194) app_init: Compile time: Oct 13 2025 01:37:11
I (199) app_init: ELF file SHA256: 87b9d7101...
I (204) app_init: ESP-IDF: v5.4.2
I (207) efuse_init: Min chip rev: v0.0
I (211) efuse_init: Max chip rev: v3.99
I (215) efuse_init: Chip rev: v1.0
I (219) heap_init: Initializing. RAM available for dynamic allocation:
I (226) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (231) heap_init: At 3FFB2C40 len 0002D3C0 (180 KiB): DRAM
I (236) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (241) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (247) heap_init: At 4008CDE4 len 0001321C (76 KiB): IRAM
I (253) spi_flash: detected chip: generic
I (256) spi_flash: flash io: dio
W (259) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (271) main_task: Started on CPU0
I (281) main_task: Calling app_main()
Hello world!
This is esp32 chip with 2 CPU core(s), WiFi/BTBLE, silicon revision v1.0, 2MB external flash
Minimum free heap size: 305244 bytes
Restarting in 10 seconds...
Restarting in 9 seconds...
Restarting in 8 seconds...
Restarting in 7 seconds...
Restarting in 6 seconds...
Restarting in 5 seconds...
Restarting in 4 seconds...
Restarting in 3 seconds...
Restarting in 2 seconds...
Restarting in 1 seconds...
Restarting in 0 seconds...
Restarting now.
問題なく動きました。
4. ESP32-S3-N16R8 向けの MicroPython をビルドする
% docker start -i bookworm-slim
root@2ad1244b7195:/# cd
root@2ad1244b7195:~# git clone https://github.com/Mythologyli/MicroPython-ESP32-S3-N16R8.git
Cloning into 'MicroPython-ESP32-S3-N16R8'...
remote: Enumerating objects: 41, done.
remote: Counting objects: 100% (41/41), done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 41 (delta 11), reused 37 (delta 7), pack-reused 0 (from 0)
Receiving objects: 100% (41/41), 6.55 KiB | 2.18 MiB/s, done.
Resolving deltas: 100% (11/11), done.
root@2ad1244b7195:~# cp -r ~/MicroPython-ESP32-S3-N16R8/ESP32_GENERIC_S3_N16R8 ~/micropython/ports/esp32/boards
root@2ad1244b7195:~# cd micropython/ports/esp32
root@2ad1244b7195:~/micropython/ports/esp32# export IDF_TARGET=esp32s3
root@2ad1244b7195:~/micropython/ports/esp32# make -j8 BOARD=ESP32_GENERIC_S3_N16R8
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Executing action: all (aliases: build)
Running cmake in directory /root/micropython/ports/esp32/build-ESP32_GENERIC_S3_N16R8
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/root/esp-idf/tools/python_env/idf5.4_py3.10_env/bin/python -DESP_PLATFORM=1 -DMICROPY_BOARD=ESP32_GENERIC_S3_N16R8 -DMICROPY_BOARD_DIR=/root/micropython/ports/esp32/boards/ESP32_GENERIC_S3_N16R8 -DCCACHE_ENABLE=0 /root/micropython/ports/esp32"...
(中略)
[1477/1477] cd /root/micropython/ports...ESP32_GENERIC_S3_N16R8/micropython.bin
micropython.bin binary size 0x198880 bytes. Smallest app partition is 0x1f0000 bytes. 0x57780 bytes (18%) free.
Project build complete. To flash, run:
idf.py flash
or
idf.py -p PORT flash
or
python -m esptool --chip esp32s3 -b 460800 --before default_reset --after no_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin
or from the "/root/micropython/ports/esp32/build-ESP32_GENERIC_S3_N16R8" directory
python -m esptool --chip esp32s3 -b 460800 --before default_reset --after no_reset write_flash "@flash_args"
bootloader @0x000000 19072 ( 13696 remaining)
partitions @0x008000 3072 ( 1024 remaining)
application @0x010000 1673344 ( 358272 remaining)
total 1738880
partitions-16MiB.csv が必要
ninja: error: '/root/micropython/ports/esp32/partitions-16MiB.csv', needed by 'partition_table/partition-table.bin', missing and no known rule to make it
# Notes: the offset of the partition table itself is set in
# $IDF_PATH/components/partition_table/Kconfig.projbuild.
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 0x1F0000,
vfs, data, fat, 0x200000, 0xE00000,
% esptool.py --chip esp32s3 --port /dev/cu.wchusbserial51850109041 -b 460800 --before default_reset --after no_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3_N16R8/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3_N16R8/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3_N16R8/micropython.bin
esptool.py v4.8.1
Serial port /dev/cu.wchusbserial51850109041
Connecting....
Chip is ESP32-S3 (QFN56) (revision v0.1)
Features: WiFi, BLE, Embedded PSRAM 8MB (AP_3v3)
Crystal is 40MHz
MAC: 34:85:18:99:b5:ac
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00004fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x001a8fff...
SHA digest in image updated
Compressed 19072 bytes to 12391...
Wrote 19072 bytes (12391 compressed) at 0x00000000 in 0.5 seconds (effective 293.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 117...
Wrote 3072 bytes (117 compressed) at 0x00008000 in 0.1 seconds (effective 471.6 kbit/s)...
Hash of data verified.
Compressed 1673376 bytes to 1127376...
Wrote 1673376 bytes (1127376 compressed) at 0x00010000 in 25.7 seconds (effective 519.9 kbit/s)...
Hash of data verified.
Leaving...
Staying in bootloader.
% screen `chooserial` 115200
MPY: soft reboot
MicroPython v1.26.1-dirty on 2025-10-13; Generic ESP32S3 module with Octal-SPIRAM with ESP32S3
Type "help()" for more information.
>>>
問題なく動きましたが、なぜ v1.26.1-dirty ?
5. CircuitPython リポジトリもクローンする
% docker start -i bookworm-slim
root@2ad1244b7195:/# cd
root@2ad1244b7195:~# python -m pip install huffman minify-html jsmin
Collecting huffman
Downloading huffman-0.1.2-py2.py3-none-any.whl.metadata (1.4 kB)
Collecting minify-html
Downloading minify_html-0.16.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (18 kB)
Collecting jsmin
Downloading jsmin-3.0.1.tar.gz (13 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Downloading huffman-0.1.2-py2.py3-none-any.whl (4.6 kB)
Downloading minify_html-0.16.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 30.6 MB/s 0:00:00
Building wheels for collected packages: jsmin
Building wheel for jsmin (pyproject.toml) ... done
Created wheel for jsmin: filename=jsmin-3.0.1-py3-none-any.whl size=13842 sha256=980eb3feff10d47c84c20a8a0a9883160ba7ada2814ac746d2ee75479e8084ee
Stored in directory: /root/.cache/pip/wheels/9a/eb/65/4a07a200d454fb40cbd51a2deee3c5d26285321e3bbbe627a5
Successfully built jsmin
Installing collected packages: minify-html, jsmin, huffman
Successfully installed huffman-0.1.2 jsmin-3.0.1 minify-html-0.16.4
root@2ad1244b7195:~# git clone https://github.com/adafruit/circuitpython.git
Cloning into 'circuitpython'...
remote: Enumerating objects: 333665, done.
remote: Counting objects: 100% (56/56), done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 333665 (delta 33), reused 25 (delta 25), pack-reused 333609 (from 2)
Receiving objects: 100% (333665/333665), 219.88 MiB | 23.81 MiB/s, done.
Resolving deltas: 100% (252547/252547), done.
root@2ad1244b7195:~# cd circuitpython/
root@2ad1244b7195:~/circuitpython# git checkout 10.0.1
Note: switching to '10.0.1'.
(以下省略)
root@2ad1244b7195:~/circuitpython# make -C mpy-cross
make: Entering directory '/root/circuitpython/mpy-cross'
- Verbosity options: any combination of "steps commands rules", as `make V=...` or env var BUILD_VERBOSE
GEN build/genhdr/mpversion.h
QSTR updated
GEN build/genhdr/qstrdefs.generated.h
Module registrations updated
GEN build/genhdr/moduledefs.h
Root pointer registrations updated
GEN build/genhdr/root_pointers.h
LINK build/mpy-cross
text data bss dec hex filename
494497 19480 880 514857 7db29 build/mpy-cross
make: Leaving directory '/root/circuitpython/mpy-cross'
root@2ad1244b7195:~/circuitpython# cd ports/espressif
root@2ad1244b7195:~/circuitpython/ports/espressif# make fetch-port-submodules
- Verbosity options: any combination of "steps commands rules", as `make V=...` or env var BUILD_VERBOSE
python3 ../../tools/ci_fetch_deps.py espressif
::group::Sync submodule URLs
git submodule sync --quiet (in /root/circuitpython/ports/espressif/../..)
::endgroup::
Duration: 0.009297789999891393
Target: espressif
(中略)
::endgroup::
Duration: 120.62125324100634
frozen_tags: True
# yd_esp32_s3_n16r8 向けをビルド
root@2ad1244b7195:~/circuitpython/ports/espressif# make -j8 BOARD=yd_esp32_s3_n16r8
- Verbosity options: any combination of "steps commands rules", as `make V=...` or env var BUILD_VERBOSE
FREEZE ../../frozen/Adafruit_CircuitPython_NeoPixel
MKMANIFEST ../../frozen/Adafruit_CircuitPython_NeoPixel
-- Found Git: /usr/bin/git (found version "2.39.5")
(中略)
[1028/1028] Generating ld/sections.ld
/root/esp-idf/tools/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: warning: build-yd_esp32_s3_n16r8/firmware.elf has a LOAD segment with RWX permissions
Memory region Used Size Region Size %age Used
iram0_0_seg: 113 KB 358144 B 32.31%
iram0_2_seg: 1381416 B 8388576 B 16.47%
dram0_0_seg: 190376 B 341760 B 55.70%
drom0_0_seg: 1758187 B 33554400 B 5.24%
rtc_iram_seg: 4384 B 8168 B 53.67%
rtc_reserved_seg: 24 B 24 B 100.00%
rtc_slow_seg: 0 B 16 B 0.00%
extern_ram_seg: 1769440 B 33554400 B 5.27%
esptool.py v4.10.0
Creating esp32s3 image...
Merged 4 ELF sections
Successfully created esp32s3 image.
1812560 bytes used, 284592 bytes free in flash firmware space out of 2097152 bytes (2048.0kB).
4408 bytes used, 3784 bytes free in 'RTC Fast Memory' out of 8192 bytes (8.0kB).
0 bytes used, 8192 bytes free in 'RTC Slow Memory' out of 8192 bytes (8.0kB).
16383 bytes used, 16385 bytes free in 'Internal SRAM 0' out of 32768 bytes (32.0kB).
190376 bytes used, 235608 bytes free in 'Internal SRAM 1' out of 425984 bytes (416.0kB).
0 bytes used, 65536 bytes free in 'Internal SRAM 2' out of 65536 bytes (64.0kB).
Converted to uf2, output size: 3625472, start address: 0x0
Wrote 3625472 bytes to build-yd_esp32_s3_n16r8/firmware.uf2
試しに、yd-esp32-s3-n16r8をビルドしてみた。
% esptool.py --chip esp32s3 --port /dev/cu.wchusbserial51850109041 --baud 921600 write_flash 0 ./firmware.bin
esptool.py v4.8.1
Serial port /dev/cu.wchusbserial51850109041
Connecting....
Chip is ESP32-S3 (QFN56) (revision v0.1)
Features: WiFi, BLE, Embedded PSRAM 8MB (AP_3v3)
Crystal is 40MHz
MAC: 34:85:18:99:b5:ac
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x001cafff...
Compressed 1878096 bytes to 1256964...
Wrote 1878096 bytes (1256964 compressed) at 0x00000000 in 17.4 seconds (effective 861.1 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
% screen /dev/cu.usbmodem435881995BCA1 115200
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 10.0.1 on 2025-10-12; VCC-GND YD-ESP32-S3 (N16R8) with ESP32S3
>>>
問題なく動きました。
6. ESP-IDF環境専用
専用環境のため、.bashrcに下記を追加した。
if [ -z "$IDF_PATH" ]; then
cd ~/esp-idf
. ./export.sh
fi
export IDF_TOOLS_PATH=$IDF_PATH/tools
idf.py --version
cd ~
7. その他
-
コンテナからMacのUSBシリアルにアクセスするために、
/dev/tty.usb*をマウントしたいのだが、macOSの仮想デバイスでは それができないようである1。仕方ないので、docker cpでホストOSにコピーしてから、write_flashしている。
コンテナRuntime にColimaを使用していることも関係するか??
-
全編 rootユーザで実行しているが、一般ユーザを追加して使用する方が良い
-
関連記事
以上
-
docker: Error response from daemon: error gathering device information while adding custom device "/dev/tty.usbmodem51850109041": no such file or directory ↩