手动获取早期的esp-idf和配置esp mdf的开发环境
1. 安装并配置git。
新建一个用户变量。变量名为Home, 值为git安装地址。
Home
C:\Users\YinFeng\git
设置git的邮箱和用户名
git config --global user.email “feng@sheentek.com”
git config --global user.name “YinFeng”
2. 克隆esp-idf v4.3.1
参考ESP-MDF的说明(https://github.com/espressif/esp-mdf)
git clone -b v4.3.1 --recursive https://github.com/espressif/esp-idf.git
cd ~/esp/esp-idf
Windows CMD:
./install.bat
. ./export.bat
Windows PowerShell:
./install.sh
. ./export.sh
3. 克隆ESP-MDF
git clone --recursive https://github.com/espressif/esp-mdf.git
4. 设置IDF_PATH和MDF_PATH的系统变量:
变量值为esp-idf和esp-mdf的安装目录(不确定是否需要这一步,因为我之前就设置过了)
5. 设置工具:
除了 ESP-IDF 本身,您还需要安装 ESP-IDF 使用的各种工具,比如编译器、调试器、Python 包等。
Windows CMD:
cd %userprofile%\esp\esp-idf
install.bat esp32c3
Windows PowerShell:
cd ~/esp/esp-idf
./install.ps1 esp32c3
备注:
./install.sh esp32,esp32c3,esp32s3。 通过运行 ./install.sh 或 ./install.sh all 可一次性为所有支持的目标芯片安装工具
请参考esp-idf 4.3.3的说明(https://docs.espressif.com/projects/esp-idf/zh_CN/v4.3.3/esp32/get-started/index.html#esp-idf)
6. 设置环境变量:
如果您希望在当下命令提示符窗口使用 ESP-IDF,请使用下方代码:
%userprofile%\esp\esp-idf\export.bat
Windows PowerShell
.$HOME/esp/esp-idf/export.ps1
7. 更新ESP-MDF
cd ~/esp/esp-mdf
git pull
git submodule update --init –recursive
8. 编译工程,以light为例
常用的编译和烧录的命令如下:
cd %userprofile%\esp\esp-mdf\examples\development_kit\light
idf.py set-target esp32c3
idf.py menuconfig
idf.py build
idf.py -p com5 erase_flash
idf.py -p com5 flash monitor
Ctrl+]
备注:
idf.py menuconfig的过程可能会提示需要安装windows-curses
pip install windows-curses
9.软件烧录
一般情况,ESP32的项目烧录文件有三部分组成,引导程序(Bootloader),分区表(partitiontable),固件(firmware)
编译成功后,ESP-IDF上会显示出引导程序(Bootloader),分区表(partitiontable),固件(firmware)对应的地址。
Project build complete. To flash, run this command:
C:\Espressif\python_env\idf4.4_py3.8_env\Scripts\python.exe ..\..\..\components\esptool_py\esptool\esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip esp32 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\eth2ap.bin
or run 'idf.py -p (PORT) flash'
在build目录中xxxx_args文件也记录着烧录文件对应的地址,可以直接在build目录中查看,例如:
flash_args:
--flash_mode dio --flash_freq 40m --flash_size 2MB
0x1000 bootloader/bootloader.bin
0x10000 eth2ap.bin
0x8000 partition_table/partition-table.bin
CSDN博客仅作为本人工作学习之余的笔记使用,无任何商业目的,如果侵犯了你的隐私或权益,请随时联系作者,本人将及时删除相关内容