windows环境安装
硬件环境
电脑系统 windows10 22H2
ESP32-WROOM-32D模块
需要的软件
python3 python官网
git 64-bit Git for Windows Setup.
esp-idf esp-idf-v4.1.zip
系统环境变量
完成软件下载解压和安装后,在系统添加环境变量


使用cmd命令行
切换到idf目录下执行install.bat 和 export.bat
我这里执行后安装过了,在完成后输入 idf.py --version 看到 ESP-IDF v4.1-dirty 说明成功了
C:\esp\esp-idf-v4.1>install.bat
Installing ESP-IDF tools
Installing tools: xtensa-esp32-elf, xtensa-esp32s2-elf, esp32ulp-elf, esp32s2ulp-elf, cmake, openocd-esp32, ninja, idf-exe, ccache
Skipping xtensa-esp32-elf@esp-2020r2-8.2.0 (already installed)
Skipping xtensa-esp32s2-elf@esp-2020r2-8.2.0 (already installed)
Skipping esp32ulp-elf@2.28.51-esp-20191205 (already installed)
Skipping esp32s2ulp-elf@2.28.51-esp-20191205 (already installed)
Skipping cmake@3.13.4 (already installed)
Skipping openocd-esp32@v0.10.0-esp32-20191114 (already installed)
Skipping ninja@1.9.0 (already installed)
Skipping idf-exe@1.0.1 (already installed)
Skipping ccache@3.7 (already installed)
Setting up Python environment
Installing Python packages from C:\esp\esp-idf-v4.1\requirements.txt
Processing c:\esp\esp-idf-v4.1\tools\kconfig_new\esp-windows-curses
Preparing metadata (setup.py) ... done
Requirement already satisfied: setuptools>=21 in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from -r C:\esp\esp-idf-v4.1\requirements.txt (line 4)) (69.5.1)
Requirement already satisfied: click>=5.0 in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from -r C:\esp\esp-idf-v4.1\requirements.txt (line 8)) (8.1.7)
Requirement already satisfied: pyserial>=3.0 in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from -r C:\esp\esp-idf-v4.1\requirements.txt (line 9)) (3.5)
Requirement already satisfied: future>=0.15.2 in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from -r C:\esp\esp-idf-v4.1\requirements.txt (line 10)) (1.0.0)
Requirement already satisfied: cryptography>=2.1.4 in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from -r C:\esp\esp-idf-v4.1\requirements.txt (line 11)) (42.0.7)
Requirement already satisfied: pyparsing<2.4.0,>=2.0.3 in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from -r C:\esp\esp-idf-v4.1\requirements.txt (line 12)) (2.3.1)
Requirement already satisfied: pyelftools>=0.22 in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from -r C:\esp\esp-idf-v4.1\requirements.txt (line 13)) (0.31)
Requirement already satisfied: colorama in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from click>=5.0->-r C:\esp\esp-idf-v4.1\requirements.txt (line 8)) (0.4.6)
Requirement already satisfied: cffi>=1.12 in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from cryptography>=2.1.4->-r C:\esp\esp-idf-v4.1\requirements.txt (line 11)) (1.16.0)
Requirement already satisfied: windows-curses in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from esp-windows-curses==0.1->-r C:\esp\esp-idf-v4.1\requirements.txt (line 19)) (2.3.3)
Requirement already satisfied: pycparser in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from cffi>=1.12->cryptography>=2.1.4->-r C:\esp\esp-idf-v4.1\requirements.txt (line 11)) (2.22)
Building wheels for collected packages: esp-windows-curses
Building wheel for esp-windows-curses (setup.py) ... done
Created wheel for esp-windows-curses: filename=esp_windows_curses-0.1-py3-none-any.whl size=1167 sha256=59071825b3859559b8094567b154766d9ebf562f74adbf10bf95c1401c74ef2c
Stored in directory: c:\users\admin\appdata\local\pip\cache\wheels\39\89\cf\e6e521fe81df42fafcf24899664a8980174fe01b3c921463c5
Successfully built esp-windows-curses
Installing collected packages: esp-windows-curses
Attempting uninstall: esp-windows-curses
Found existing installation: esp-windows-curses 0.1
Uninstalling esp-windows-curses-0.1:
Successfully uninstalled esp-windows-curses-0.1
Successfully installed esp-windows-curses-0.1
All done! You can now run:
export.bat
C:\esp\esp-idf-v4.1>export.bat
Setting IDF_PATH: C:\esp\esp-idf-v4.1
Adding ESP-IDF tools to PATH...
C:\Users\admin\.espressif\python_env\idf4.1_py3.8_env\Scripts
Checking if Python packages are up to date...
C:\esp\esp-idf-v4.1\tools\check_python_dependencies.py:22: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
Python requirements from C:\esp\esp-idf-v4.1\requirements.txt are satisfied.
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
C:\esp\esp-idf-v4.1>idf.py --version
C:\esp\esp-idf-v4.1\tools\check_python_dependencies.py:22: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
ESP-IDF v4.1-dirty
C:\esp\esp-idf-v4.1>
C:\esp\esp-idf-v4.1>
C:\esp\esp-idf-v4.1>idf.py --version
C:\esp\esp-idf-v4.1\tools\check_python_dependencies.py:22: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
ESP-IDF v4.1-dirty
C:\esp\esp-idf-v4.1>
编辑快捷CMD打开开发环境
使用一个快捷方式直接打开 ESP-IDF4.1 版本 编译环境 根据你自己的安装路径填写
%windir%\system32\cmd.exe /k ""C:\esp\esp-idf-v4.1\export.bat" "C:\Users\admin\AppData\Local\Programs\Python\Python38\" "C:\Program Files\Git\cmd\""
C:\esp\esp-idf-v4.1


安装好出现的问题
报这个错误
C:\esp\esp-idf-v4.1>idf.py --version
C:\esp\esp-idf-v4.1\tools\check_python_dependencies.py:22: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
ESP-IDF v4.1-dirty
C:\esp\esp-idf-v4.1>
解决方法,应该是setuptools版本太高重新安装低版本
C:\esp\esp-idf-v4.1>pip install setuptools
Requirement already satisfied: setuptools in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (69.5.1)
C:\esp\esp-idf-v4.1>pip uninstall setuptools
Found existing installation: setuptools 69.5.1
Uninstalling setuptools-69.5.1:
Would remove:
c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages\_distutils_hack\*
c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages\distutils-precedence.pth
c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages\pkg_resources\*
c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages\setuptools-69.5.1.dist-info\*
c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages\setuptools-69.5.1.virtualenv
c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages\setuptools\*
Proceed (Y/n)? y
Successfully uninstalled setuptools-69.5.1
C:\esp\esp-idf-v4.1>pip install setuptools==67.6.1 -i https://mirrors.aliyun.com/pypi/simple/
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting setuptools==67.6.1
Downloading https://mirrors.aliyun.com/pypi/packages/0b/fc/8781442def77b0aa22f63f266d4dadd486ebc0c5371d6290caf4320da4b7/setuptools-67.6.1-py3-none-any.whl (1.1 MB)
---------------------------------------- 1.1/1.1 MB 2.4 MB/s eta 0:00:00
Installing collected packages: setuptools
Successfully installed setuptools-67.6.1
C:\esp\esp-idf-v4.1>pip install setuptools
Requirement already satisfied: setuptools in c:\users\admin\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (67.6.1)
C:\esp\esp-idf-v4.1>idf.py --version
ESP-IDF v4.1-dirty
重新进入也显示正常了
Setting IDF_PATH: C:\esp\esp-idf-v4.1
Adding ESP-IDF tools to PATH...
C:\Users\admin\.espressif\tools\xtensa-esp32-elf\esp-2020r2-8.2.0\xtensa-esp32-elf\bin
C:\Users\admin\.espressif\tools\xtensa-esp32s2-elf\esp-2020r2-8.2.0\xtensa-esp32s2-elf\bin
C:\Users\admin\.espressif\tools\esp32ulp-elf\2.28.51-esp-20191205\esp32ulp-elf-binutils\bin
C:\Users\admin\.espressif\tools\esp32s2ulp-elf\2.28.51-esp-20191205\esp32s2ulp-elf-binutils\bin
C:\Users\admin\.espressif\tools\cmake\3.13.4\bin
C:\Users\admin\.espressif\tools\openocd-esp32\v0.10.0-esp32-20191114\openocd-esp32\bin
C:\Users\admin\.espressif\tools\ninja\1.9.0\
C:\Users\admin\.espressif\tools\idf-exe\1.0.1\
C:\Users\admin\.espressif\tools\ccache\3.7\
C:\Users\admin\.espressif\python_env\idf4.1_py3.8_env\Scripts
Checking if Python packages are up to date...
Python requirements from C:\esp\esp-idf-v4.1\requirements.txt are satisfied.
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
C:\esp\esp-idf-v4.1>
问题记录
“OTA data partition invalid, will try all partitions” error when flashing pre-encrypted applications 参考这里
The OTA data partition needs to be encrypted as well, or it looks like random bytes to the bootloader (decryption result of whatever is there now, probably all 0xFFs if newly erased). The behaviour will be the same as if the OTA data partition was empty (all 0xFFs), ie default partition will be booted. After the first time an OTA update writes to the OTA data partition, it will contain valid (encrypted) data.
So your options are:
- Do nothing, ignore the error and it will go away after the first OTA update.
or - Pre-encrypt an OTA data partition and flash it (either a valid one, or encrypt 8192 bytes of 0xFF and write this)
BTW, your partition table seems to have two OTA data partitions. Only one is needed, the other one will probably be ignored.

1万+

被折叠的 条评论
为什么被折叠?



