platformio + vscode 用着可以,但是目前【2022/01】还没有支持 ESP32-S2/S3/C3 的官方仓库。只好自己试试:
1. vscode + platformio 自动上。网上说,pip.ini 里面需要加国内源,比如
%homepath%\pip\pip.ini
------------------------------------------
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
------------------------------------------
2. 手工下载支持 s2 的库,并放到 %homepath%\.platformio\platforms\espressif32
https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2/platform-tasmota-espressif32-2.0.2.zip
3. 在 vscode 中,加载 platformio,新建工程,选 esp32-s2 saolo, 平台用 Arduino,即可。
这时,platformio 会下载工具链,很慢很慢。
如果有代理可用,可用在 PS 中输入,比如:
$env:HTTP_PROXY="http://127.0.0.1:3280"
$env:HTTPS_PROXY="http://127.0.0.1:3280"
都加持上。
然后,就等 pio 干活完,就可以
- 构建工程: pio run
- 只上传固件: pio run -t nobuild -t upload
- 获取串口列表: pio device list
另外,对于 app 较大,可用在工程的 platformio.ini 中指定分区文件
; dir @%homepath%\.platformio\packages\framework-arduinoespressif32\tools\partitions\
board_build.partitions = default_16MB.csv
先记这么多。