Skip to content

Commit

Permalink
Merge branch 'contrib/github_pr_9899' into 'master'
Browse files Browse the repository at this point in the history
Make esp_app_desc a weak symbol (GitHub PR)

Closes IDFGH-8433

See merge request espressif/esp-idf!20461
  • Loading branch information
igrr committed Oct 4, 2022
2 parents 104f2da + 93c3321 commit 87ea314
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/esp_app_format/esp_app_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


// Application version info
const __attribute__((section(".rodata_desc"))) esp_app_desc_t esp_app_desc = {
const __attribute__((weak)) __attribute__((section(".rodata_desc"))) esp_app_desc_t esp_app_desc = {
.magic_word = ESP_APP_DESC_MAGIC_WORD,
#ifdef CONFIG_APP_EXCLUDE_PROJECT_VER_VAR
.version = "",
Expand Down
11 changes: 8 additions & 3 deletions docs/en/api-reference/system/app_image_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,25 @@ You can also see the information on segments in the ESP-IDF logs while your appl
Application Description
-----------------------

The ``DROM`` segment starts with the :cpp:type:`esp_app_desc_t` structure which carries specific fields describing the application:
The ``DROM`` segment of the application binary starts with the :cpp:type:`esp_app_desc_t` structure which carries specific fields describing the application:

* ``magic_word`` - the magic word for the esp_app_desc structure.
* ``secure_version`` - see :doc:`Anti-rollback</api-reference/system/ota>`.
* ``version`` - see :doc:`App version</api-reference/system/misc_system_api>`. ``*``
* ``project_name`` is filled from ``PROJECT_NAME``. ``*``
* ``time`` and ``date`` - compile time and date.
* ``idf_ver`` - version of ESP-IDF. ``*``
* ``app_elf_sha256`` - contains sha256 for the elf application file.
* ``app_elf_sha256`` - contains sha256 for the application ELF file.

``*`` - The maximum length is 32 characters, including null-termination character. For example, if the length of ``PROJECT_NAME`` exceeds 32 characters, the excess characters will be disregarded.
``*`` - The maximum length is 32 characters, including null-termination character. For example, if the length of ``PROJECT_NAME`` exceeds 31 characters, the excess characters will be disregarded.

This structure is useful for identification of images uploaded OTA because it has a fixed offset = sizeof(:cpp:type:`esp_image_header_t`) + sizeof(:cpp:type:`esp_image_segment_header_t`). As soon as a device receives the first fragment containing this structure, it has all the information to determine whether the update should be continued or not.

To obtain the :cpp:type:`esp_app_desc_t` structure for the currently running application, use :cpp:func:`esp_app_get_description`.

To obtain the :cpp:type:`esp_app_desc_t` structure for another OTA partition, use :cpp:func:`esp_ota_get_partition_description`.


Adding a Custom Structure to an Application
-------------------------------------------

Expand Down

0 comments on commit 87ea314

Please sign in to comment.