feat(app_update): add app description data and its functions

This commit is contained in:
donghengqaz
2020-02-13 16:55:04 +08:00
committed by Dong Heng
parent 5a91acd79a
commit 3d19ecebd1
7 changed files with 257 additions and 2 deletions

@ -21,6 +21,7 @@
#include "esp_err.h"
#include "esp_partition.h"
#include "esp_spi_flash.h"
#include "esp_app_format.h"
#ifdef __cplusplus
extern "C"
@ -174,6 +175,30 @@ const esp_partition_t* esp_ota_get_running_partition(void);
*/
const esp_partition_t* esp_ota_get_next_update_partition(const esp_partition_t *start_from);
/**
* @brief Return esp_app_desc structure. This structure includes app version.
*
* Return description for running app.
* @return Pointer to esp_app_desc structure.
*/
const esp_app_desc_t *esp_ota_get_app_description(void);
/**
* @brief Returns esp_app_desc structure for app partition. This structure includes app version.
*
* Returns a description for the requested app partition.
* @param[in] partition Pointer to app partition. (only app partition)
* @param[out] app_desc Structure of info about app.
* @return
* - ESP_OK Successful.
* - ESP_ERR_NOT_FOUND app_desc structure is not found. Magic word is incorrect.
* - ESP_ERR_NOT_SUPPORTED Partition is not application.
* - ESP_ERR_INVALID_ARG Arguments is NULL or if partition's offset exceeds partition size.
* - ESP_ERR_INVALID_SIZE Read would go out of bounds of the partition.
* - or one of error codes from lower-level flash driver.
*/
esp_err_t esp_ota_get_partition_description(const esp_partition_t *partition, esp_app_desc_t *app_desc);
#ifdef __cplusplus
}
#endif