环境安装与开发记录
以乐鑫的文档为准 IDF文档
如何添加旧版本ESP-IDF环境
进入ESP-IDF版本介绍,这里我需要 v4.1 - Release Notes 点击进入github仓库,找到 Using git 输入命令或者在 Assets下载 esp-idf-v4.1.zip
git clone -b v4.1 --recursive https://github.com/espressif/esp-idf.git esp-idf-v4.1
cd esp-idf-v4.1/
新工程初始化步骤
cd %userprofile%\esp\hello_world
idf.py set-target esp32
idf.py menuconfig
idf.py build
idf.py -p COM3 flash
查看esp32 flash大小
esptool.py -p COMx flash_id
查看ESP-IDF版本
idf.py --version
擦除Flash数据
python %IDF_PATH%\components\esptool_py\esptool\esptool.py -p COM3 erase_flash
生成加密文件
espsecure.py encrypt_flash_data --keyfile my_flash_encryption_key.bin --address 0x00 .\build\encryption.bin .\build\targe.bin
单独烧录文件
esptool.py --port COM3 --baud 921000 write_flash 0x00 .\build\targe.bin
烧录NVS密钥
python %IDF_PATH%\components\esptool_py\esptool\esptool.py -p COM3 --before default_reset --after no_reset write_flash 0x3f0000 .\key.bin
查看 eFuse 信息(ESP32 flash 加密状态–>FLASH_CRYPT_CNT)
python %IDF_PATH%\components\esptool_py\esptool\espefuse.py --p COM3 summary
espefuse.py -p PORT summary
输出打印结果如下
C:\esp\esp-idf-v4.1>python %IDF_PATH%\components\esptool_py\esptool\espefuse.py --p COM3 summary
espefuse.py v2.9-dev
Connecting......
EFUSE_NAME Description = [Meaningful Value] [Readable/Writeable] (Hex Value)
----------------------------------------------------------------------------------------
Identity fuses:
MAC Factory MAC Address
= 08:3a:8d:ab:94:9c (CRC 0xa1 OK) R/W
CHIP_VER_REV1 Silicon Revision 1 = 1 R/W (0x1)
CHIP_VER_REV2 Silicon Revision 2 = 0 R/W (0x0)
CHIP_VERSION Reserved for future chip versions = 2 R/W (0x2)
CHIP_PACKAGE Chip package identifier = 1 R/W (0x1)
Efuse fuses:
WR_DIS Efuse write disable mask = 0 R/W (0x0)
RD_DIS Efuse read disablemask = 0 R/W (0x0)
CODING_SCHEME Efuse variable block length scheme = 0 R/W (0x0)
KEY_STATUS Usage of efuse block 3 (reserved) = 0 R/W (0x0)
Security fuses:
FLASH_CRYPT_CNT Flash encryption mode counter = 0 R/W (0x0)
UART_DOWNLOAD_DIS Disable UART download mode (ESP32 rev3 only) = 0 R/W (0x0)
FLASH_CRYPT_CONFIG Flash encryption config (key tweak bits) = 0 R/W (0x0)
CONSOLE_DEBUG_DISABLE Disable ROM BASIC interpreter fallback = 1 R/W (0x1)
ABS_DONE_0 secure boot enabled for bootloader = 0 R/W (0x0)
ABS_DONE_1 secure boot abstract 1 locked = 0 R/W (0x0)
JTAG_DISABLE Disable JTAG = 0 R/W (0x0)
DISABLE_DL_ENCRYPT Disable flash encryption in UART bootloader = 0 R/W (0x0)
DISABLE_DL_DECRYPT Disable flash decryption in UART bootloader = 0 R/W (0x0)
DISABLE_DL_CACHE Disable flash cache in UART bootloader = 0 R/W (0x0)
BLK1 Flash encryption key
= 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W
BLK2 Secure boot key
= 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W
BLK3 Variable Block 3
= 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W
Config fuses:
XPD_SDIO_FORCE Ignore MTDI pin (GPIO12) for VDD_SDIO on reset = 0 R/W (0x0)
XPD_SDIO_REG If XPD_SDIO_FORCE, enable VDD_SDIO reg on reset = 0 R/W (0x0)
XPD_SDIO_TIEH If XPD_SDIO_FORCE & XPD_SDIO_REG, 1=3.3V 0=1.8V = 0 R/W (0x0)
CLK8M_FREQ 8MHz clock freq override = 51 R/W (0x33)
SPI_PAD_CONFIG_CLK Override SD_CLK pad (GPIO6/SPICLK) = 0 R/W (0x0)
SPI_PAD_CONFIG_Q Override SD_DATA_0 pad (GPIO7/SPIQ) = 0 R/W (0x0)
SPI_PAD_CONFIG_D Override SD_DATA_1 pad (GPIO8/SPID) = 0 R/W (0x0)
SPI_PAD_CONFIG_HD Override SD_DATA_2 pad (GPIO9/SPIHD) = 0 R/W (0x0)
SPI_PAD_CONFIG_CS0 Override SD_CMD pad (GPIO11/SPICS0) = 0 R/W (0x0)
DISABLE_SDIO_HOST Disable SDIO host = 0 R/W (0x0)
Calibration fuses:
BLK3_PART_RESERVE BLOCK3 partially served for ADC calibration data = 0 R/W (0x0)
ADC_VREF Voltage reference calibration = 1107 R/W (0x1)
Flash voltage (VDD_SDIO) determined by GPIO12 on reset (High for 1.8V, Low/NC for 3.3V).
ubuntu安装过程中遇到的问题
root@zhy-virtual-machine:/home/zhy/esp32/esp-idf/esp-idf-v4.1# ./install.sh
Installing ESP-IDF tools
/usr/bin/env: "python": 没有那个文件或目录
root@zhy-virtual-machine:/home/zhy/esp32/esp-idf/esp-idf-v4.1# whereis python3
python3: /usr/bin/python3 /usr/lib/python3 /etc/python3 /usr/share/python3 /usr/share/man/man1/python3.1.gz
root@zhy-virtual-machine:/home/zhy/esp32/esp-idf/esp-idf-v4.1# sudo ln -s /usr/bin/python3 /usr/bin/python
root@zhy-virtual-machine:/home/zhy/esp32/esp-idf/esp-idf-v4.1# ./install.sh esp32
Installing ESP-IDF tools
成功执行