2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PlatformIOでesp32関連の開発をするときの設定

Posted at

いつも定型で同じコンフィグを設定するので備忘も兼ねてここに残します
初手でこの設定に変えておくとあとが楽

設定

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
build_unflags = -std=gnu++11
build_flags = 
    -std=gnu++2a
	-DCORE_DEBUG_LEVEL=2
    ; 0:None, 1:Error, 2:WARN, 3:Info, 4:Debug, 5:Verbose
	-DCONFIG_ARDUHAL_LOG_COLORS=1
upload_speed = 1000000
monitor_speed = 115200
monitor_raw = yes

設定内容

デフォルトの内容

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

c++のバージョン指定

新しいもののほうが機能も良いのでとりあえず指定
ちなみに、デフォはC++11
公式のリポジトリではC++20が使えるバージョンの中で一番新しいようだ
非公式のフォークであればC++23が使えるものもあるみたい
参考リンク
参考リンク

build_unflags = -std=gnu++11
build_flags = 
    ;-std=gnu++2b ;c++23
    -std=gnu++2a  ;c++20
    ;-std=gnu++14 ;c++14
    ;-std=gnu++17 ;c++17

色付きシリアルデバッグ用の設定

詳細は別記事(中身は大した事ない)
レベルの選択はお好みで

build_flags = 
	-DCORE_DEBUG_LEVEL=2
    ; 0:None, 1:Error, 2:WARN, 3:Info, 4:Debug, 5:Verbose
	-DCONFIG_ARDUHAL_LOG_COLORS=1
monitor_raw = yes

通信速度の設定

cp2102nは1.5Mbpsまで速度を上げられるという記事を見た記憶があるけど、ソースは行方不明
ここまで上げても体感できるほどの差はないのでどっちも115200に設定しておけばいいのではと思ってる
モニタのレートは115200である必要がある、これはesp32のシリアルデバッグログがこの速度だから
115200に設定しなくても良いが、その場合は起動直後に吐き出されるログが化けて読めなくなる

upload_speed = 1000000
monitor_speed = 115200
2
2
0

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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?