esp_app_desc.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2017-2018 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #include <assert.h>
  14. #include "esp_ota_ops.h"
  15. #include "sdkconfig.h"
  16. // Application version info
  17. const __attribute__((section(".rodata_desc"))) esp_app_desc_t esp_app_desc = {
  18. .magic_word = ESP_APP_DESC_MAGIC_WORD,
  19. #ifdef CONFIG_APP_EXCLUDE_PROJECT_VER_VAR
  20. .version = "",
  21. #else
  22. .version = PROJECT_VER,
  23. #endif
  24. #ifdef CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR
  25. .project_name = "",
  26. #else
  27. .project_name = PROJECT_NAME,
  28. #endif
  29. .idf_ver = IDF_VER,
  30. #ifdef CONFIG_APP_SECURE_VERSION
  31. .secure_version = CONFIG_APP_SECURE_VERSION,
  32. #else
  33. .secure_version = 0,
  34. #endif
  35. #ifdef CONFIG_APP_COMPILE_TIME_DATE
  36. .time = __TIME__,
  37. .date = __DATE__,
  38. #else
  39. .time = "",
  40. .date = "",
  41. #endif
  42. };
  43. #ifndef CONFIG_APP_EXCLUDE_PROJECT_VER_VAR
  44. _Static_assert(sizeof(PROJECT_VER) <= sizeof(esp_app_desc.version), "PROJECT_VER is longer than version field in structure");
  45. #endif
  46. _Static_assert(sizeof(IDF_VER) <= sizeof(esp_app_desc.idf_ver), "IDF_VER is longer than idf_ver field in structure");
  47. #ifndef CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR
  48. _Static_assert(sizeof(PROJECT_NAME) <= sizeof(esp_app_desc.project_name), "PROJECT_NAME is longer than project_name field in structure");
  49. #endif
  50. const esp_app_desc_t *esp_ota_get_app_description(void)
  51. {
  52. return &esp_app_desc;
  53. }