diff --git a/components/esp_app_format/esp_app_desc.c b/components/esp_app_format/esp_app_desc.c index 909bb94a4c91..edb22d08936c 100644 --- a/components/esp_app_format/esp_app_desc.c +++ b/components/esp_app_format/esp_app_desc.c @@ -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 = "", diff --git a/docs/en/api-reference/system/app_image_format.rst b/docs/en/api-reference/system/app_image_format.rst index 7582db0c6a6b..e7797596075c 100644 --- a/docs/en/api-reference/system/app_image_format.rst +++ b/docs/en/api-reference/system/app_image_format.rst @@ -80,7 +80,7 @@ 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`. @@ -88,12 +88,17 @@ The ``DROM`` segment starts with the :cpp:type:`esp_app_desc_t` structure which * ``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 -------------------------------------------