0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【令和6年版】ESP32S3-N16R8用のCircuitPythonをビルドする on Mac

Last updated at Posted at 2024-02-01

はじめに

以前書いた同タイトルの記事に従い、久しぶりにCircuitPythonをビルドしてみると、Macを変えたせいか バージョンが新しくなったせいか、少し変わっていた。

そこで、最新手順を令和6年版として残すことにする。

環境

ESP-IDF環境は既に整っている前提

現在の環境は以下の通り
(#は以前の環境)

$ uname -a
Darwin Mac-mini.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:34 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8103 arm64
#Darwin MacBook-Pro.local 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64 x86_64

$ idf.py --version
ESP-IDF v5.1-dev-6224-g60ff95f5bf
#ESP-IDF v4.4.3

$ python --version
Python 3.11.6
#Python 3.10.8

$ make --version
GNU Make 3.81
#GNU Make 3.81

$ gmake --version
GNU Make 4.4.1
Built for aarch64-apple-darwin22.3.0
#GNU Make 4.4

手順

手順自体はそれほど変わらない。

以下にコマンドの流れだけを示す。

事前準備(インストール済みであればスキップ)
brew update
brew install uncrustify cmake ninja
brew link gettext --force
pip install minify-html
pip install jsmin
circuitpython.gitをクローン
git clone https://github.com/adafruit/circuitpython.git
cd circuitpython
git checkout main  OR  8.2.x

#espressifに限定することでダウンロード時間とディスク容量を節約
cd ports/espressif
make fetch-port-submodules 

esp-idf/install.sh

cd ../..
make -C mpy-cross
N8R8をコピーしてN16R8向けを作る
cd ports/espressif/boards
cp -r espressif_esp32s3_devkitc_1_n8r8 espressif_esp32s3_devkitc_1_n16r8

sed -i "" 's/ESP32-S3-DevKitC-1-N8R8/ESP32-S3-DevKitC-1-N16R8/' espressif_esp32s3_devkitc_1_n16r8/mpconfigboard.h
sed -i "" 's/ESP32-S3-DevKitC-1-N8R8/ESP32-S3-DevKitC-1-N16R8/' espressif_esp32s3_devkitc_1_n16r8/mpconfigboard.mk
sed -i "" 's/CIRCUITPY_ESP_FLASH_SIZE = 8MB/CIRCUITPY_ESP_FLASH_SIZE = 16MB/' espressif_esp32s3_devkitc_1_n16r8/mpconfigboard.mk
sed -i "" 's/CIRCUITPY_ESP_FLASH_MODE = dio/CIRCUITPY_ESP_FLASH_MODE = qio/' espressif_esp32s3_devkitc_1_n16r8/mpconfigboard.mk
N16R8向けをビルド
cd ..
source esp-idf/export.sh
make -j8 BOARD=espressif_esp32s3_devkitc_1_n16r8

↑以前の環境では、makeだとエラーとなったので、gmakeを使ったが、今回はmakeで問題なくビルドできた。

ビルド結果

成果物フォルダ(circuitpython/ports/espressif/build-espressif_esp32s3_devkitc_1_n16r8)
% ls build-espressif_esp32s3_devkitc_1_n16r8
autogen_display_resources-en_US.P       firmware.elf.map
autogen_display_resources-en_US.c       firmware.size.json
autogen_display_resources-en_US.o       firmware.uf2
autogen_web_workflow_static.c           genhdr
background.P                            lib
background.o                            main.P
bindings                                main.o
boards                                  mphalport.P
build-espressif_esp32s3_devkitc_1_n16r8 mphalport.o
circuitpython-firmware.bin              peripherals
common-hal                              py
esp-idf                                 shared
extmod                                  shared-bindings
firmware.bin                            shared-module
firmware.elf                            supervisor

出来上がったfirmware.binをesp32s3に焼く。

$ esptool.py --chip esp32s3 --port /dev/cu.usbserialxxx --baud 921600 erase_flash
$ esptool.py --chip esp32s3 --port /dev/cu.usbserialxxx --baud 921600 write_flash -z 0x0 firmware.bin

N16R8用CircuitPythonの実行結果

$ screen /dev/cu.usbmodemxxx 115200

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Hello World!

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 8.2.9-8-g7af75178ed on 2024-02-01; ESP32-S3-DevKitC-1-N16R8 with ESP32S3
>>> 
>>> import os
>>> os.listdir()
['.fseventsd', '.metadata_never_index', '.Trashes', 'settings.toml', 'code.py', 'lib', 'boot_out.txt']
>>> 

以上

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?