Skip to content
XiNGRZ edited this page Jul 22, 2022 · 6 revisions

固件包格式

Web ESPTool 支持两种固件格式,分别为 ZIP 和 UF2。

UF2

ESP-IDF 自 v4.3 开始支持 UF2 的构建。命令如下:

idf.py uf2

执行生成的文件位于 build/uf2.bin,可直接拖进 Web ESPTool 烧录。

ZIP

ZIP 格式的压缩包结构如下:

Archive:  hello_world.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
      141  08-24-2021 11:12   flash_args
    18944  08-24-2021 12:25   bootloader/bootloader.bin
   749536  08-24-2021 12:25   hello_world.bin
     3072  08-24-2021 11:16   partition_table/partition-table.bin
---------                     -------
   771693                     4 files

它由 flash_args 以及其它相关分区的镜像文件构成(镜像相对路径与 flash_args 中定义的路径对应)。

flash_args 文件以及这些分区镜像可以在你的项目 build 目录下找到。一个典型的 flash_args 文件如下(请注意,该文件的内容会因具体芯片型号、配置不同而有所不同):

--flash_mode dio --flash_freq 80m --flash_size 2MB
0x0 bootloader/bootloader.bin
0x10000 hello_world.bin
0x8000 partition_table/partition-table.bin

固件包可以在项目目录中使用下列命令一键生成(生成的固件包位于 build/flash.zip):

pushd build && zip flash.zip flash_args $(cat flash_args | while read _ f; do; [[ -f $f ]] && echo $f; done) && popd
Clone this wiki locally