Platform IO for simple understanding of ESP32 code burning

Platform IO for simple understanding of ESP32 code burning

After developing the ESP32 and compiling the code, it can be extracted and directly burned on other devices using the ESP Flash Download Tool. To use the ESP Flash Download Tool, you need to prepare four files in advance. It contains two boot files bootloaderbin boot_app0.bin, a flash file partitions.bin and a firmware file firmware.bin. Can be changed.

The following describes the storage location of these files and burn address:

Take Windows for example ()

  • The location of bootloader.bin is under the .platformio\packages\tool-esptoolpy\test\image directory in the PlatformIO installation directory. Its corresponding burn address is 0X1000.
  • The location of boot_app0.bin is under the platformio\packages\framework-arduinoespressif32\tools\partitions directory in the PlatformIO installation directory. Its corresponding address is 0xe000.
  • The location of partitions.bin is below the .pioenvs\[board] directory in the code project directory. Its corresponding address is 0x8000. At the same time, the partitions.csv file in the platformio\packages\framework-arduinoespressif32\tools\partitions directory is the compiled partition configuration file. It will be different depending on the type of selection. You can use Excel to open and edit, and then compile it. PIO can be used to recompile within the device. At the same time, it can be compiled and decompiled using the gen_esp32part.py script included in the PIO package. The operation method is: `python C:\SPB_Data.platformio\packages\framework- Arduinoespressif32\tools\gen_esp32part.py --verify conversion decompilation into csv)
  • The location of firmware.bin is below the .pioenvs\[board] directory in the code project directory. This is the compiled code of the firmware. Its corresponding address is 0x10000, if the partition file is not modified If you want to modify (or replace the build platform), update the firmware or re-burn only the corresponding address to start burning this file.

The burning method similar to the conversion method of the partition file described above is:

python C:\SPB_Data\.platformio\packages\tool-esptoolpy\esptool.py --port COM19 --baud 115200 write_flash -fm dio -fs 4MB 0x010000 xxx\firmware.bin choose to compile firmware, code update , You can directly execute this command in cmd.exe, which is convenient and quick.

1 Like