Arduino IDE で ESP-IDF の sdkconfig を変更する方法(v2.0.17版)
本記事は、sdkcomfigの変更までできましたが、反映することろまではできていません。
はじめに
Aruduino IDE では、ビルド済SDKをしようしているため、ESP-IDFの設定変更はAruduino IDE ではできません。ESP-IDFを取得し、設定変更したあとにビルドしてSDKを作成する必要があります。
v1.0.6版の時と同じように仮想Linuxを構築してSDKを作成してみました。が、配布されているSDKとほぼ同じものを作成するとこまで出来ましたが、肝心のsdkconfigを変更して反映させるところまではできませんでした。
本記事は、今回の調査した内容を記録する意味で記載しています。今後わかり次第追記します。
👇v1.0.6版では内容はこちら👇
開発環境
OS : Windows 11 Pro
ESP32:ESP-WROOM-32
統合開発環境 : Arduino IDE 2.3.2
Arduino core for the ESP32:2.0.17
使用ライブラリ:なし
作業内容
仮想Linux(Ubuntu)構築
ここは前回と同じため、省略します。
Arduino core for the ESP32 ビルド
ビルド準備
ビルドに必要なパッケージをインストールします。
sudo apt update
sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf python3 python3-pip python3-setuptools python3-serial python3-click python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake ninja-build ccache jq
ソースファイル取得
esp32-arduino-lib-builder
まず、「esp32-arduino-lib-builder」という、ESP-IDF とその他のコンポーネントをビルドする環境を git から入手します。
git clone https://github.com/espressif/esp32-arduino-lib-builder
cd esp32-arduino-lib-builder
git switch release/v4.4
今回は、「Arduino core for the ESP32:2.0.17」の環境を構築しますので、「esp32-arduino-lib-builder」は v4.4 を使用します。
「esp32-arduino-lib-builder」は、初期状態では ESP-IDF やその他のコンポーネントを最新の状態で取得しようとします。
「Arduino core for the ESP32:2.0.17」の環境を構築するには、各バージョンを合わせる必要があるため、自動的に最新を取得するコードをコメントアウトしておきます。
vim build.sh
84 #echo "* Installing/Updating ESP-IDF and all components..."
85 # update components from git
86 #./tools/update-components.sh
87 #if [ $? -ne 0 ]; then exit 1; fi
「build.sh」の86行目から87行目の箇所です。
これで、自動的に取得しないようになったため、手動で ESP-IDF と Arduino core for the ESP32 を含むコンポーネントを取得していきます。
ESP-IDF
「Arduino core for the ESP32:2.0.17」に対応した「ESP-IDF v4.4.7」を取得します。
git clone -b v4.4.7 --recursive https://github.com/espressif/esp-idf.git
git -C ./esp-idf/ reset --hard 38eeba213a
配布されている状態と同じコミットの状態にしておきます。
Arduino core for the ESP32
「Arduino core for the ESP32 : 2.0.17」を取得します。
git clone -b 2.0.17 --recursive https://github.com/espressif/arduino-esp32 ./components/arduino
git -C ./components/arduino reset --hard d75795f5
配布されている状態と同じコミットの状態にしておきます。
esp32-camera
esp32-camera コンポーネントを取得します。
git clone --recursive https://github.com/espressif/esp32-camera ./components/esp32-camera
git -C ./components/esp32-camera reset --hard f0bb429
配布されている状態と同じコミットの状態にしておきます。
esp-dl
esp-dl コンポーネントを取得します。
git clone --recursive https://github.com/espressif/esp-dl.git ./components/esp-dl
git -C ./components/esp-dl reset --hard 0632d24
配布されている状態と同じコミットの状態にしておきます。
esp_littlefs
esp_littlefs コンポーネントを取得します。
git clone --recursive https://github.com/joltwallet/esp_littlefs.git ./components/esp_littlefs
git -C ./components/esp_littlefs reset --hard 41873c2
git -C ./components/esp_littlefs submodule update --init --recursive
配布されている状態と同じコミットの状態にしておきます。
esp-rainmaker
esp-rainmaker コンポーネントを取得します。
git clone --recursive https://github.com/espressif/esp-rainmaker.git ./components/esp-rainmaker
git -C ./components/esp-rainmaker reset --hard d8e9345
git -C ./components/esp-rainmaker submodule update --init --recursive
配布されている状態と同じコミットの状態にしておきます。
espressif__esp-dsp
espressif__esp-dsp コンポーネントを取得します。
git clone --recursive https://github.com/espressif/esp-dsp.git ./components/espressif__esp-dsp
git -C ./components/espressif__esp-dsp reset --hard 9b4a8b4
配布されている状態と同じコミットの状態にしておきます。
tinyusb
tinyusb コンポーネントを取得します。
git clone --recursive https://github.com/hathach/tinyusb.git ./components/arduino_tinyusb/tinyusb
git -C ./components/arduino_tinyusb/tinyusb reset --hard a0e5626bc
配布されている状態と同じコミットの状態にしておきます。
ビルド
環境は用意できましたのでビルドします。
./build.sh -t esp32
「out」というディレクトリが作成されていれば成功です。
farmsoft@MIRA:~/2.0.17/esp32-arduino-lib-builder$ ls
CMakeLists.txt build components dependencies.lock esp-idf managed_components patches tools
README.md build.sh configs dist main out sdkconfig version.txt
sdkconfig 設定変更
ここからが、sdkconfig の設定変更です。
. ./esp-idf/export.sh
idf.py menuconfig
1.0.6 では「idf.py menuconfig」を使用できませんでしたが、2.0.17 では使用できます。
ここからの手順がわかりませんでした。
1.0.6 では、以下のようにブートローダーのみをビルドするシェルが用意されていましたが、2.0.17 では用意されていませんでした。
./tools/build-bootloaders.sh
全ビルトすると、sdkconfig もデフォルト状態に戻ってしまいます。
ブートローダーのみをビルドするようなシェルを作成すれば出来ると思いますが、時間切れとなってしまったので、今回はここで終了します。
おわりに
1.0.6 の方法がわかっていたので、容易にできるだろうと思っていましたが、思わぬところでつまづいてしまいました。時間がある時に再度チャレンジしようと思います。
コメント