esp32: Add firmware version to app

Added a new structure esp_app_desc_t. It has info about firmware:
version, secure_version, project_name, time/date build and IDF version.
Added the ability to add a custom structure with a description of the firmware.

The esp_app_desc_t is located in fixed place in start of ROM secotor. It is located after structures esp_image_header_t and esp_image_segment_header_t.

app_version is filed from PROJECT_VER variable (if set in custom make file) or PROJECT_PATH/version.txt or git repo (git describe).

Add API to get app_desc from partition.
This commit is contained in:
Konstantin Kondrashov
2018-10-05 20:29:07 +08:00
parent 3bc970c5f4
commit 3b9cb25fe1
22 changed files with 356 additions and 11 deletions

View File

@@ -71,6 +71,7 @@
#include "esp_pm.h"
#include "pm_impl.h"
#include "trax.h"
#include "esp_ota_ops.h"
#define STRINGIFY(s) STRINGIFY2(s)
#define STRINGIFY2(s) #s
@@ -175,6 +176,20 @@ void IRAM_ATTR call_start_cpu0()
#endif
ESP_EARLY_LOGI(TAG, "Pro cpu up.");
#if LOG_LOCAL_LEVEL >= ESP_LOG_INFO
const esp_app_desc_t *app_desc = esp_ota_get_app_description();
ESP_EARLY_LOGI(TAG, "Application information:");
ESP_EARLY_LOGI(TAG, "Project name: %s", app_desc->project_name);
ESP_EARLY_LOGI(TAG, "App version: %s", app_desc->version);
#ifdef CONFIG_APP_SECURE_VERSION
ESP_EARLY_LOGI(TAG, "Secure version: %x", app_desc->secure_version);
#endif
#ifdef CONFIG_APP_COMPILE_TIME_DATE
ESP_EARLY_LOGI(TAG, "Compile time: %s", app_desc->time);
ESP_EARLY_LOGI(TAG, "Compile date: %s", app_desc->date);
#endif
ESP_EARLY_LOGI(TAG, "ESP-IDF: %s", app_desc->idf_ver);
#endif
#if !CONFIG_FREERTOS_UNICORE
if (REG_GET_BIT(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_DIS_APP_CPU)) {