ESP-IDF下载与安装完整流程

本文详细介绍了ESP-IDF在Windows平台上的安装过程,包括在线和离线安装方式,以及安装ESP-IDF必备工具,如Python、Git、交叉编译器、CMake和Ninja。安装完成后,通过ESP-IDF PowerShell和CMD启动环境,便于后续的开发工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文主要看参考官网说明,如下:

Windows 平台工具链的标准设置 - ESP32 - — ESP-IDF 编程指南 latest 文档 (espressif.com)

一、概述

ESP-IDF需要安装一些必备工具,才能围绕ESP32构建固件,包括:

  • Python
  • Git
  • 交叉编译器
  • CMake
  • Ninja编译工具
  • 其它

本入门指南介绍了如何通过命令提示符进行有关操作。不过,安装ESP-IDF后,还可以使用 Eclipse Plugin 或其他支持CMake的图形化工具IDE。

二、ESP-IDF工具安装器

安装ESP-IDF必备工具最简易的方式是下载一个ESP-IDF工具安装器。链接如下:

Windows Installer Download

点击连接之后,页面如下:

1. 在线安装和离线安装

在上图中,可以看到安装分为在线安装和离线安装两种方式:

  • 在线安装方式

在线安装程序非常小,可以安装ESP-IDF的所有版本。在安装过程中,安装程序只下载必要的依赖文件,包括Git For Windows安装器。在线安装程序会将下载的文件存储在缓存目录%userprofile%/espressif中。

  • 离线安装

离线安装程序不需要任何网络连接(当然,下载安装程序本身还是需要网络的)。安装程序中包含了所有需要的依赖文件,包括Git For Windows安装器。

2. 下载安装过程

笔者选择离线安装方式。完整安装过程如下:

(1)点击上边页面中的第二个红色矩形框中的链接,开始下载。如下如所示(上图中有(1)是因为笔者之前下载过了,第一次下载是不带的):

下载完成后的文件名称为:esp-idf-tools-setup-offline-5.2.1.exe。

(2)双击此安装文件,开始安装。出现以下界面:

(3)点击“确定”按钮,出现以下界面:

(4)选择“我同意此协议”项。

(5)点击“下一步”按钮,出现以下界面:

在“安装前系统检查”界面中,检查系统配置项。这里主要检查Windows的版本信息和已安装的杀毒软件信息。

注:此步骤万一出现系统配置项异常,则可以单击“完整日志”按钮,根据关键项检索相关的解决方案。

(6) 点击“下一步”按钮,出现以下界面:

(7)点击“下一步”按钮,出现以下界面:

可以下拉右侧的滚动条,看一下都要安装哪些组件以及相关细节。

(8) 点击“下一步”按钮,出现以下界面:

(9) 点击“安装”按钮,出现安装过程界面:

(10) 安装过程结束即安装完成后,界面如下:

(11) 点击“完成”按钮,安装完成。之后出现以下命令行:

3. 启动ESP-IDF环境

在安装结束时,如果勾选了 Run ESP-IDF PowerShell Environment 或 Run ESP-IDF Command Prompt (cmd.exe),安装程序会在选定的提示符窗口启动 ESP-IDF。

由于是笔者上边两个都勾选了:

因此,“ESP-IDF PowerShell”和“ESP-IDF CMD”两个环境都打开了:

在后续步骤中,将以“ESP-IDF 命令提示符环境”为例,讲解如何使用 Windows 的命令提示符进行操作。

4. 安装内容

这里来看一下安装程序都安装了那些内容。安装程序会安装以下组件:

  • 内置的Python
  • 交叉编译器
  • OpenOCD
  • CMake和Ninja编译工具
  • ESP-IDF

欲知后事如何,且看下回分解。

esp32-freertos-sdk 工具包 See the Getting Started guide links above for a detailed setup guide. This is a quick reference for common commands when working with ESP-IDF projects: Setup Build Environment (See Getting Started guide for a full list of required steps with details.) Install host build dependencies mentioned in Getting Started guide. Add tools/ directory to the PATH Run python -m pip install -r requirements.txt to install Python dependencies Configuring the Project idf.py menuconfig Opens a text-based configuration menu for the project. Use up & down arrow keys to navigate the menu. Use Enter key to go into a submenu, Escape key to go out or to exit. Type ? to see a help screen. Enter key exits the help screen. Use Space key, or Y and N keys to enable (Yes) and disable (No) configuration items with checkboxes "[*]" Pressing ? while highlighting a configuration item displays help about that item. Type / to search the configuration items. Once done configuring, press Escape multiple times to exit and say "Yes" to save the new configuration when prompted. Compiling the Project idf.py build ... will compile app, bootloader and generate a partition table based on the config. Flashing the Project When the build finishes, it will print a command line to use esptool.py to flash the chip. However you can also do this automatically by running: idf.py -p PORT flash Replace PORT with the name of your serial port (like COM3 on Windows, /dev/ttyUSB0 on Linux, or /dev/cu.usbserial-X on MacOS. If the -p option is left out, idf.py flash will try to flash the first available serial port. This will flash the entire project (app, bootloader and partition table) to a new chip. The settings for serial port flashing can be configured with idf.py menuconfig. You don't need to run idf.py build before running idf.py flash, idf.py flash will automatically rebuild anything which needs it. Viewing Serial Output The idf.py monitor target uses the idf_monitor tool to display se
### 添加和配置 micro-ROS 组件至 ESP-IDF 项目 #### 安装依赖项 为了成功集成 micro-ROS 至 ESP-IDF 工程,需先确保已安装必要的工具链和其他依赖项。这通常涉及设置好 Python 环境以及 Git 版本控制系统。 #### 获取 micro-ROS 库 通过克隆官方仓库来获取最新的 micro-ROS 实现源码。可以利用如下命令完成此操作: ```bash git clone --recurse-submodules https://github.com/micro-ROS/micro_ros_esp.git ``` 上述指令会下载整个 micro-ROS ESP 支持库及其子模块[^1]。 #### 配置 IDF_PATH 和其他环境变量 确认 `IDF_PATH` 被正确指向到本地的 ESP-IDF 安装路径下,并按照文档说明调整其余可能影响编译过程的关键参数。 #### 修改项目文件结构 将所获得的 micro-ROS 文件夹放置于目标项目的合适位置;一般建议将其置于顶层目录下的 components 或者 modules 中作为独立部分存在。 #### 更新 CMakeLists.txt 编辑主应用程序的 `CMakeLists.txt` 来引入新加入的外部资源。具体来说就是添加一行类似于下面这样的语句以便让构建系统识别并处理这些额外的内容: ```cmake add_subdirectory(${PROJECT_SOURCE_DIR}/components/micro_ros_esp) ``` 此外还需要指定链接器选项以包含来自 micro-ROS 的头文件和支持函数定义: ```cmake target_include_directories(${EXECUTABLE_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/components/micro_ros_esp/include/) target_link_libraries(${EXECUTABLE_NAME} micro_ros_agent_client) ``` #### 编译烧录固件 最后一步即运行标准的编译流程并通过串口连接设备上传最终生成的目标二进制映像。对于大多数情况而言,执行以下两条简单的 shell 命令就足以达成目的了: ```bash idf.py build idf.py -p /dev/ttyUSB0 flash monitor ``` 这里假设 `/dev/ttyUSB0` 是连接开发板的实际端口号,在实际应用时应当替换为对应的具体值[^3]。
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蓝天居士

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值