Page 1 of 1

[esptool.py] Maximum number of segments in the binary

Posted: Sat Sep 29, 2018 6:55 am
by roel00
The esptool.py contains the following code

Code: Select all

    def load_common_header(self, load_file, expected_magic):
            (magic, segments, self.flash_mode, self.flash_size_freq, self.entrypoint) = struct.unpack('<BBBBI', load_file.read(8))

            if magic != expected_magic or segments > 16:
                raise FatalError('Invalid firmware image magic=%d segments=%d' % (magic, segments))
            return segments
Why is the firmware corrupt when it contains more than 16 segments?

Re: [esptool.py] Maximum number of segments in the binary

Posted: Mon Oct 01, 2018 5:21 am
by ESP_Angus
Hi roel,

Currently the ESP-IDF bootloader only accommodates up to 16 segments in an app binary image:
https://github.com/espressif/esp-idf/bl ... rmat.h#L96

There may be a similar limit in the ESP32 ROM (for the bootloader image), I don't recall.

Do you need more than 16 segments in the binary?


Angus

Re: [esptool.py] Maximum number of segments in the binary

Posted: Sat Oct 06, 2018 10:28 am
by roel00
ESP_Angus wrote:Hi roel,

Currently the ESP-IDF bootloader only accommodates up to 16 segments in an app binary image:
https://github.com/espressif/esp-idf/bl ... rmat.h#L96

There may be a similar limit in the ESP32 ROM (for the bootloader image), I don't recall.

Do you need more than 16 segments in the binary?


Angus
I accidentally got more then 16 segments while screwing with the linker script, and was trying to figure out why it lead to a non working binary, thanks for the answer!