Skip to content

Boot ROM Loader

M Hightower edited this page Feb 16, 2020 · 23 revisions

Boot ROM Loader Using Multiple segments

While ESP8266 Application Note - Firmware Download Protocol, provides some information on bootloader headers and checksumming it is incomplete. I could not find any detailed documentation on what the Boot ROM Bootloader expects. So I resorted to the empirical method. This is based on that. Maybe this is common knowledge, I just could not find it.

  1. The Boot ROM loader expects a checksum at the end of the 16-byte alignment that immediately following the last segment's payload.
  2. When there are multiple segments each segment has a CS. While it is documented that the first checksum calculation is started with 0xEF, it is not documented that for each additional segment and CS it is calculated starting with zero.
  3. Except for the last segment, each segment payload length is modified to include the 16-byte alignment with CS at the end. This allows the loader to, add segment length to the beginning of the payload, to find the next segment header.
  4. Because of the size increase to include CS, adjacent segments can overlap. This makes the ordering of those segments in the .bin more critical. When the 1st of an adjacent segment is loaded, the padding and checksum are also loaded. Then the adjacent segment begins by overwriting the padding, etc. If they are reversed, some of the previous segment would be overwritten by padding and CS of the 2nd.

As an experiment using these adjustments and updates to elft2bin.py, I was able to add a strings segment to eboot.

Clone this wiki locally