隔一段时间再想玩一玩ESP32,发现又忘记的一干二净,还是写一下比较好。
下载ESP32 SDK
????????github上面的最新工程https://github.com/espressif/esp-idf
开发环境配置
????????使用官方https://dl.espressif.com/dl/esp-idf-tools-setup-2.3.exe设置基础环境
安装时会提示是否使用现有的esp-idf,如果没下载可通过提示下载
安装好环境后会弹出控制台
尝试新的跨平台 PowerShell https://aka.ms/pscore6
Using Python in F:/ESP32/ESP-IDF-Tool/.espressif/python_env/idf4.0_py3.8_env/Scripts
Python 3.8.7
Using Git in F:/ESP32/ESP-IDF-Tool/.espressif/tools/idf-git/2.30.1/cmd
git version 2.30.1.windows.1
IDF version does not include export.ps1. Using the fallback version.
Setting IDF_PATH: F:\ESP32\esp-idf-v4.0
Adding ESP-IDF tools to PATH...
F:\ESP32\ESP-IDF-Tool\.espressif\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin
F:\ESP32\ESP-IDF-Tool\.espressif\tools\esp32ulp-elf\2.28.51.20170517\esp32ulp-elf-binutils\bin
F:\ESP32\ESP-IDF-Tool\.espressif\tools\cmake\3.13.4\bin
F:\ESP32\ESP-IDF-Tool\.espressif\tools\openocd-esp32\v0.10.0-esp32-20190313\openocd-esp32\bin
F:\ESP32\ESP-IDF-Tool\.espressif\tools\mconf\v4.6.0.0-idf-20190628\
F:\ESP32\ESP-IDF-Tool\.espressif\tools\ninja\1.9.0\
F:\ESP32\ESP-IDF-Tool\.espressif\tools\idf-exe\1.0.1\
F:\ESP32\ESP-IDF-Tool\.espressif\tools\ccache\3.7\
F:\ESP32\ESP-IDF-Tool\.espressif\python_env\idf4.0_py3.8_env\Scripts
F:\ESP32\esp-idf-v4.0\tools
Checking if Python packages are up to date...
Python requirements from F:\ESP32\esp-idf-v4.0\requirements.txt are satisfied.
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
编译工程
????????移动到工程工作路径,执行如下命令执行编译。
?????????idf.py build?
编译结束:
[62/62] Generating binary image from built executable
esptool.py v2.8
Generated F:/ESP32/esp-idf-v4.0/examples/get-started/hello_world/build/bootloader/bootloader.bin
[820/820] Generating binary image from built executable
esptool.py v2.8
Generated F:/ESP32/esp-idf-v4.0/examples/get-started/hello_world/build/hello-world.bin
Project build complete. To flash, run this command:
F:\ESP32\ESP-IDF-Tool\.espressif\python_env\idf4.0_py3.8_env\Scripts\python.exe ..\..\..\components\esptool_py\esptool\esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 build\bootloader\bootloader.bin 0x8000 build\partition_table\partition-table.bin 0x10000 build\hello-world.bin
or run 'idf.py -p (PORT) flash'
?固件下载
?执行如下命令开始下载,执行如下命令,一直按住FLASH按钮,在单击复位按键,进入下载状态后释放按键等待下载结束。COM3为连接的端口。
idf.py -p COM3 flash
or run 'idf.py -p (PORT) flash'
F:\ESP32\esp-idf-v4.0\examples\get-started\hello_world>idf.py -p COM3 flash
Checking Python dependencies...
Python requirements from F:\ESP32\esp-idf-v4.0\requirements.txt are satisfied.
Adding flash's dependency "all" to list of actions
Executing action: all (aliases: build)
Running ninja in directory f:\esp32\esp-idf-v4.0\examples\get-started\hello_world\build
Executing "ninja all"...
[1/3] Performing build step for 'bootloader'
ninja: no work to do.
Executing action: flash
Running esptool.py in directory f:\esp32\esp-idf-v4.0\examples\get-started\hello_world\build
Executing "F:\ESP32\ESP-IDF-Tool\.espressif\python_env\idf4.0_py3.8_env\Scripts\python.exe F:\ESP32\esp-idf-v4.0\components/esptool_py/esptool/esptool.py -p COM3 -b 460800 --before default_reset --after hard_reset write_flash @flash_project_args"...
esptool.py -p COM3 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 hello-world.bin
esptool.py v2.8
Serial port COM3
Connecting........_____....._
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:62:ab:ca:96:a8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Compressed 3072 bytes to 103...
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 4753.0 kbit/s)...
Hash of data verified.
Compressed 25328 bytes to 14943...
Wrote 25328 bytes (14943 compressed) at 0x00001000 in 0.3 seconds (effective 602.8 kbit/s)...
Hash of data verified.
Compressed 147152 bytes to 76531...
Wrote 147152 bytes (76531 compressed) at 0x00010000 in 1.7 seconds (effective 682.6 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Done
F:\ESP32\esp-idf-v4.0\examples\get-started\hello_world>
运行日志
|