ESP Flash Download Tool, Combine Functionality

AlexESP32
Posts: 65
Joined: Thu Oct 03, 2019 9:41 am

ESP Flash Download Tool, Combine Functionality

Postby AlexESP32 » Fri Jun 19, 2020 6:35 pm

Hey all :)

There are some questions:

I want to combine the generated bin-files (bootloader.bin, application.bin, partition-table.bin) into 1 bin-file.
Therefore the flash-download-tool has a functionality: combine

Is it possible to have the algorithm of this combine functionality?

The reason is:
I tried to get this combine functionality with this python script:
https://github.com/vtunr/esp32_binary_merger
and unfortunately the bin-file of the esp32_binary_merger and the flash-download-tool have different size. Both are working.
I would like to know why there is the difference ;)

In brief there is the functionality of the esp32_binary_merger:
Store the bin-files at given address and fill up the remaining data with 0xFF.

For example:
address: 0x1000, size: 0x100, bootloader
address: 0x10000, size: 0x100, application

address 0-0x1000: 0xFF
address 0x1000-0x1100: data bootloader
address 0x1100-0x10000: 0xFF
address 0x10000-0x10100: data application

Maybe someone can help me.

Thank you.

AlexESP32
Posts: 65
Joined: Thu Oct 03, 2019 9:41 am

Re: ESP Flash Download Tool, Combine Functionality

Postby AlexESP32 » Wed Jun 24, 2020 11:50 am

Does nobody know the answer?

If the question is unclear, please let me know ;)

The question is:
How does the flash download tool work in detail especially the combine functionality.

If i compare the output of the flash download tool, then I can see differences between the bootloader.bin and the bootloader-part of the combined bin:

For example:
target.bin in hex:
FFFFFF...FFFFFFE904022088
bootloader.bin in hex:
Start with E904021088

Why is there an difference? Or better question: What means the first bytes in bootloader?

Thank you.

AlexESP32
Posts: 65
Joined: Thu Oct 03, 2019 9:41 am

Re: ESP Flash Download Tool, Combine Functionality

Postby AlexESP32 » Wed Jun 24, 2020 11:56 am

Unfortunately another one doesn't work anymore with esp32_binary_merger... :(

I get this issue if I flash my merged file from https://github.com/vtunr/esp32_binary_merger
rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4
load:0x3fff0034,len:7008
ho 0 tail 12 room 4
load:0x756c6176,len:1869881445
1162 mmu set 00010000, pos 00010000
1162 mmu set 00020000, pos 00020000
1162 mmu set 00030000, pos 00030000
1162 mmu set 00040000, pos 00040000
1162 mmu set 00050000, pos 00050000
1162 mmu set 00060000, pos 00060000
1162 mmu set 00070000, pos 00070000
1162 mmu set 00080000, pos 00080000
1162 mmu set 00090000, pos 00090000
1162 mmu set 000a0000, pos 000a0000
1162 mmu set 000b0000, pos 000b0000
ets Jun 8 2016 00:22:57

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: ESP Flash Download Tool, Combine Functionality

Postby ESP_Angus » Thu Jun 25, 2020 1:26 am

Hi Alex,

There are two bytes in the header of the bootloader (see here) that determine the initial flash configuration mode of the bootloader (SPI flash speed, mode, size).

Both the GUI flash tool and esptool.py can change these arguments at flashing time. This is why the value may be different when the binary is combined by the flasher tool - if the SPI flash speed, mode and size set in the flasher tool UI don't match what was set when the binary was built then they will get changed.

The mode and the speed are printed by the ESP32 ROM here in the posted log: "mode:DIO, clock div:2". If you can compare with a working binary then you may be able to determine the difference.

(I'm assuming the tool you're using otherwise works as advertised but I haven't looked into it myself.)

AlexESP32
Posts: 65
Joined: Thu Oct 03, 2019 9:41 am

Re: ESP Flash Download Tool, Combine Functionality

Postby AlexESP32 » Mon Jun 29, 2020 7:44 pm

Thank you very much :)

Who is online

Users browsing this forum: Google [Bot], Lvalue, zelenecul and 123 guests