Code: Select all
// get sha256 digest for the partition table
partition.address = ESP_PARTITION_TABLE_OFFSET;
partition.size = ESP_PARTITION_TABLE_MAX_LEN;
partition.type = ESP_PARTITION_TYPE_DATA;
esp_partition_get_sha256(&partition, sha_256);
print_sha256(sha_256, "SHA-256 for the partition table: ");
// get sha256 digest for bootloader
partition.address = ESP_BOOTLOADER_OFFSET;
partition.size = ESP_PARTITION_TABLE_OFFSET;
partition.type = ESP_PARTITION_TYPE_APP;
esp_partition_get_sha256(&partition, sha_256);
print_sha256(sha_256, "SHA-256 for bootloader: ");
const esp_partition_t *running = esp_ota_get_running_partition();
err = esp_partition_get_sha256(running, sha_256);
if (err == ESP_OK)
{
print_sha256(sha_256, "SHA-256 for current firmware: ");
}
else
{
ESP_LOGW(TAG, "Failed to get SHA-256 for current firmware: %s", esp_err_to_name(err));
}
Code: Select all
I (569) ota_work_example: SHA-256 for the partition table: : 1da6115f8cb1194eca355efc369bc41453a044aedc8937666c307d7ee9db3f92
I (579) boot_comm: chip revision: 1, min. application chip revision: 0
I (609) ota_work_example: SHA-256 for bootloader: : 9dc4f10c8b78988b243757cbc9bb7e1a8164cb7cc7119f129c8a229094b402cc
I (619) boot_comm: chip revision: 1, min. application chip revision: 0
I (1229) ota_work_example: SHA-256 for current firmware: : 0000000000000000000000000000000000000000000000000000000000000000
Thomas