esp32 win7开发环境搭建

环境

系统:win7
hw target:esp32c3

注意:很多问题都跟git的网络有关,要仔细看错误提示。很多错误需要尝试多遍,才有可能成功。

安装包

离线包安装 https://dl.espressif.com/dl/esp-idf/?idf=4.4

更新最新代码

将安装的IDF_PATH更新成最新的git版本 https://github.com/espressif/esp-idf

更新submodule

git submodule update --init --recursive

安装python virtual environment

install.bat

设置环境变量

export.bat

编译工程

设置hw 平台类型

idf.py set-target esp32c3

错误1:

Unable to checkout '4f5e89fa84ce1d178a6765b8b46f2b6f91216677' in submodule path 'components/libsodium/libsodium'

解决1:
看日志是git无法成功,我们改为手动git pull,如果提示 openssl 10054错误。则

git config --global http.sslVerify "false"

其后还有很多的失败,基本需要逐个确认,多次执行

git submodule update --init --recursive

配置成功

-- Configuring done
-- Generating done
-- Build files have been written to: G:/esp/esp-idf/examples/wifi/getting_started/softAP/build

菜单配置

idf.py menuconfig

component config->esp32c3-specific,选择rev 2:
file

编译成功

idf.py build
[84/85] Generating binary image from built executable
esptool.py v3.1-dev
Merged 1 ELF section Generated G:/esp/espidf/examples/wifi/getting_started/softAP/build/bootloader/bootloader.bin
[85/85] cmd.exe /C "cd /D G:\esp\espidf\examples\wifi\getting_started\softAP\build\bootloader\esp-idf\esptool_py &&g:\esp\espressif\python_env\idf4.4_py3.8_env\Scripts\python.exe G:/esp/espidf/components/partition_table/check_sizes.py --
offset 0x8000 bootloader 0x0 G:/esp/espidf/examples/wifi/getting_started/softAP
/build/bootloader/bootloader.bin"
Bootloader binary size 0x48a0 bytes. 0x3760 bytes (76%) free.
[954/955] Generating binary image from built executable
esptool.py v3.1-dev
Merged 1 ELF section
Generated G:/esp/esp-idf/examples/wifi/getting_started/softAP/build/wifi_softAP.bin
[955/955] cmd.exe /C "cd /D G:\esp\esp..._started/softAP/build/wifi_softAP.bin"
wifi_softAP.bin binary size 0xa3490 bytes. Smallest app partition is 0x100000 by
tes. 0x5cb70 bytes (36%) free.

Project build complete. To flash, run this command:
g:\esp\espressif\python_env\idf4.4_py3.8_env\Scripts\python.exe ..\..\..\..\comp
onents\esptool_py\esptool\esptool.py -p (PORT) -b 460800 --before default_reset
--after hard_reset --chip esp32c3  write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x0 build\bootloader\bootloader.bin 0x8000 build\partition_
table\partition-table.bin 0x10000 build\wifi_softAP.bin
or run 'idf.py -p (PORT) flash'

烧录

idf.py -p COM105 flash
esptool.py v3.1-dev
Serial port COM105
Connecting....
Chip is ESP32-C3 (revision 2)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:86:4a:94
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00004fff...
Flash will be erased from 0x00010000 to 0x000b3fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Compressed 18592 bytes to 11216...
Writing at 0x00000000... (100 %)
Wrote 18592 bytes (11216 compressed) at 0x00000000 in 0.6 seconds (effective 253
.8 kbit/s)...
Hash of data verified.
Compressed 668816 bytes to 372018...
Writing at 0x00010000... (4 %)
Writing at 0x0001bf69... (8 %)
Writing at 0x00025854... (13 %)
Writing at 0x0002c95b... (17 %)
Writing at 0x0003382e... (21 %)
Writing at 0x0003ae72... (26 %)
Writing at 0x00041d6a... (30 %)
Writing at 0x0004886c... (34 %)
Writing at 0x0004fb4e... (39 %)
Writing at 0x00056b56... (43 %)
Writing at 0x0005d1f1... (47 %)
Writing at 0x0006332e... (52 %)
Writing at 0x00068eeb... (56 %)
Writing at 0x0006f110... (60 %)
Writing at 0x0007537e... (65 %)
Writing at 0x0007b840... (69 %)
Writing at 0x00081ae0... (73 %)
Writing at 0x00087df9... (78 %)
Writing at 0x0008df30... (82 %)
Writing at 0x000945f7... (86 %)
Writing at 0x0009b5fe... (91 %)
Writing at 0x000a66e9... (95 %)
Writing at 0x000ae4bc... (100 %)
Wrote 668816 bytes (372018 compressed) at 0x00010000 in 11.2 seconds (effective
476.2 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.1 seconds (effective 258.7
kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Done

擦除flash

idf.py erase_flash

查看日志

idf.py -p COMXXX monitor

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注