esp_app_desc.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdint.h>
  8. #include <stdbool.h>
  9. #include <stddef.h>
  10. #include "esp_err.h"
  11. #include "esp_assert.h"
  12. #ifdef __cplusplus
  13. extern "C"
  14. {
  15. #endif
  16. #define ESP_APP_DESC_MAGIC_WORD (0xABCD5432) /*!< The magic word for the esp_app_desc structure that is in DROM. */
  17. /**
  18. * @brief Description about application.
  19. */
  20. typedef struct {
  21. uint32_t magic_word; /*!< Magic word ESP_APP_DESC_MAGIC_WORD */
  22. uint32_t secure_version; /*!< Secure version */
  23. uint32_t reserv1[2]; /*!< reserv1 */
  24. char version[32]; /*!< Application version */
  25. char project_name[32]; /*!< Project name */
  26. char time[16]; /*!< Compile time */
  27. char date[16]; /*!< Compile date*/
  28. char idf_ver[32]; /*!< Version IDF */
  29. uint8_t app_elf_sha256[32]; /*!< sha256 of elf file */
  30. uint32_t reserv2[20]; /*!< reserv2 */
  31. } esp_app_desc_t;
  32. /** @cond */
  33. ESP_STATIC_ASSERT(sizeof(esp_app_desc_t) == 256, "esp_app_desc_t should be 256 bytes");
  34. /** @endcond */
  35. /**
  36. * @brief Return esp_app_desc structure. This structure includes app version.
  37. *
  38. * Return description for running app.
  39. * @return Pointer to esp_app_desc structure.
  40. */
  41. const esp_app_desc_t *esp_app_get_description(void);
  42. /**
  43. * @brief Fill the provided buffer with SHA256 of the ELF file, formatted as hexadecimal, null-terminated.
  44. * If the buffer size is not sufficient to fit the entire SHA256 in hex plus a null terminator,
  45. * the largest possible number of bytes will be written followed by a null.
  46. * @param dst Destination buffer
  47. * @param size Size of the buffer
  48. * @return Number of bytes written to dst (including null terminator)
  49. */
  50. int esp_app_get_elf_sha256(char* dst, size_t size);
  51. #ifdef __cplusplus
  52. }
  53. #endif