Skip to content

Commit

Permalink
docs: Updated documentation to reflect changes of SHA256 digest recom…
Browse files Browse the repository at this point in the history
…putation
  • Loading branch information
jakub-kocka authored and radimkarnis committed Mar 5, 2024
1 parent 598b703 commit 6c28df3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/en/advanced-topics/firmware-image-format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

{IDF_TARGET_FLASH_FREQ_2:default="20", esp32c2="15", esp32h2="12"}

{IDF_TARGET_BOOTLOADER_OFFSET:default="0x0", esp32="0x1000", esp32s2="0x1000", esp32p4="0x2000"}


.. _image-format:

Expand Down Expand Up @@ -108,7 +110,7 @@ The image header is 8 bytes long:
+--------+------------------------------------------------------------------------------------------------+


``esptool.py`` overrides the 2nd and 3rd (start from 0) bytes according to the SPI flash info provided through command line option, but only if there is no SHA256 digest appended after the image. Therefore, if you would like to change SPI flash info during flashing, i.e. with the ``esptool.py write_flash`` command, then generate images without SHA256 digests. This can be achieved by running ``esptool.py elf2image`` with the ``--dont-append-digest`` argument.
``esptool.py`` overrides the 2nd and 3rd (counted from 0) bytes according to the SPI flash info provided through the command line option. These bytes are only overridden if this is a bootloader image (an image written to a correct bootloader offset of {IDF_TARGET_BOOTLOADER_OFFSET}), in this case, the appended SHA256 digest is also updated to reflect the header changes. Generating images without SHA256 digest can be achieved by running ``esptool.py elf2image`` with the ``--dont-append-digest`` argument.

.. only:: esp8266

Expand Down
2 changes: 1 addition & 1 deletion docs/en/esptool/basic-commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ The ``elf2image`` command converts an ELF file (from compiler/linker output) int
This command does not require a serial connection.

``elf2image`` also accepts the `Flash Modes <#flash-modes>`__ arguments ``--flash_freq`` and ``--flash_mode``, which can be used to set the default values in the image header. This is important when generating any image which will be booted directly by the chip.
These values can also be overwritten via the ``write_flash`` command, see the `write_flash command <#write-binary-data-to-flash-write-flash>`__ for details. However, if you want to overwrite these values via the ``write_flash`` command then use the ``--dont-append-digest`` argument of the ``elf2image`` command in order to skip appending a SHA256 digest after the image. The SHA256 digest would be invalidated by rewriting the image header, therefore, it is not allowed.
These values can also be overwritten via the ``write_flash`` command, see the `write_flash command <#write-binary-data-to-flash-write-flash>`__ for details. Overwriting these values via the ``write_flash`` command will produce an image with a recalculated SHA256 digest, otherwise, the image SHA256 digest would be invalidated by rewriting the image header. There is an option to skip appending a SHA256 digest after the image with ``--dont-append-digest`` argument of the ``elf2image`` command.

By default, ``elf2image`` uses the sections in the ELF file to generate each segment in the binary executable. To use segments (PHDRs) instead, pass the ``--use_segments`` option.

Expand Down

0 comments on commit 6c28df3

Please sign in to comment.