# 固件升级
[English]
-----------------------------
## 1.macOS 与 Linux 如何烧录固件?
* 苹果系统 (macOS) 可以通过 brew 安装或 git 下载 [esptool](https://github.com/espressif/esptool) 工具烧录固件。
* Linux 系统(如 ubuntu)可以通过 apt-get 安装或 git 下载 [esptool](https://github.com/espressif/esptool) 工具烧录固件。
更新时间:2022.4.22
-----------------------------------------------------
## 2. ESP\_Flash\_Downloader\_Tool 是否可以自定义编程控制?
* ESP\_Flash\_Downloader\_Tool GUI 工具不开源,且不支持嵌入执行脚本。
* ESP\_Flash\_Downloader\_Tool 底层组件 [esptool](https://github.com/espressif/esptool) 开源,可以完成烧录加密等所有功能,建议基于该组件二次开发。
更新时间:2022.4.22
------------------------------------------------------------
## 3.如何使用 flash\_download\_tool 下载基于 esp-idf 编译的固件?
* 以 hello-world 例程为例,初次编译 esp-idf 工程请参考 [get-started-guide](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/get-started/index.html)。
* 执行 `idf.py build`(esp-idf v4.0 及以后版本,v4.0 之前请使用 `make` )。编译工程后,会生成如下的 bin 文件的烧录指令提示:
```bash
#Project build complete. To flash, run this command:
../../../components/esptool_py/esptool/esptool.py -p (PORT) -b 921600 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x10000 build/hello-world.bin build 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin
or run 'idf.py -p PORT flash'
```
可以按照该指令提示的 bin 文件及烧录地址使用 flash\_download\_tool 进行烧录。
更新时间:2022.4.22
----------------------------
## 4.ESP 芯片烧录通讯协议是什么?
* ESP 烧录协议规范:[Serial-Protocol](https://github.com/espressif/esptool/wiki/Serial-Protocol)。
* 串口协议 Python 实现:[esptool](https://github.com/espressif/esptool)。
* 串口协议C 语言实现:[esp-serial-flasher](https://github.com/espressif/esp-serial-flasher)。
更新时间:2022.4.22
------------------------
## 5.乐鑫模组烧录工具有那些?
* 乐鑫烧录软件可以点击此网页并进行下载: [flash download tool](https://www.espressif.com/zh-hans/support/download/other-tools),免安装 GUI 工具,仅适用于 *Windows* 环境。
* 乐鑫烧录工具 [esptool](https://github.com/espressif/esptool),基于 *python* 编写,开放源代码,并且支持用户二次开发。
更新时间:2022.4.22
-------------------------------------------
## 6.[Flash 下载工具](https://www.espressif.com/zh-hans/support/download/other-tools) 的工厂模式和开发者模式有什么区别?## 3.
* 工厂模式支持多通道下载,开发者模式仅支持单通道。
* 工厂模式下 bin 文件的路径是相对路径,开发者模式下的路径是绝对路径。
更新时间:2022.4.22
-------------------------------------------
## 7.一拖四治具工厂模式烧写失败原因?
| Supported Targets | ESP32 | ESP8266 |
| ----------------- | ----- | ------- |
* 因为乐鑫产品启动时通过一些发包来完成校准操作,此操作需要 3.3 V 电压并保证有 500 mA
的峰值电流。所以,在一拖多的情况下,通过连接电脑 USB 的方式来烧录时,会出现由于电脑 USB
供电不足引起无法烧录或者烧录中断的情况,建议使用 hub 进行烧录并给 hub 供电。
更新时间:2022.4.22
-------------------------------------------
## 8.为什么使用 [Flash 下载工具](https://www.espressif.com/zh-hans/support/download/other-tools) 无法重新烧录已加密设备?
| Supported Targets | ESP32 | ESP32-S2 |
| ----------------- | ----- | -------- |
* 当前 [Flash 下载工具](https://www.espressif.com/zh-hans/support/download/other-tools) 不支持对已加密的设备重复加密,仅支持明文一次性加密操作。
更新时间:2022.4.22
-------------------------------------------
## 9.基于 [esptool 串口协议](https://github.com/espressif/esptool) 通过 UART 接口对 ESP32 进行刷新固件,是否可以新增一个 app 分区?
* Flash 实际的分区情况主要取决于 partition\_table.bin 的数据。若可以更新 partition\_table.bin,则可以重新划分 bootloader.bin、app.bin 等其他数据的存储空间,从而新增一个 app 分区。
更新时间:2022.4.22
------------------------------------------
## 10.Windows7 系统 USB 驱动无法识别是什么原因?
* Windows7 系统需要手动下载并安装 [USB Serial JTAG 驱动](https://dl.espressif.com/dl/idf-driver/idf-driver-esp32-usb-jtag-2021-07-15.zip)。
更新时间:2022.4.22