I am trying to modify the bootloader partition during runtime, but having troubles with it.
The main goal in the end is to rewrite/flash the SSBL during runtime from for example OTA 0.
But my attempts fail. The device crashes at (it seems) random states when calling esp_partition_erase_range() or esp_partition_write()
with
Code: Select all
abort() was called at PC 0x403789cf on core 1
Encryption and secure boot is disabled. I use a custom bootloader.
My code running from factory partition:
Code: Select all
const esp_partition_t part_ssbl = {
.type = ESP_PARTITION_TYPE_APP,
.address = 0x0,
.size = CONFIG_PARTITION_TABLE_OFFSET
};
uint8_t sha_256[64];
esp_err_t res = esp_partition_get_sha256(&part_ssbl, sha_256);
ESP_LOGW(TAG,"HASH Res: %s", esp_err_to_name(res));
res = esp_partition_erase_range(&part_ssbl, 0x1000, 0x1000);
ESP_LOGW(TAG,"ERASE Res: %s", esp_err_to_name(res));
uint8 rubbish[64] = {0};
res = esp_partition_write(&part_ssbl,0x1000,&rubbish,64);
ESP_LOGW(TAG,"WRITE Res: %s", esp_err_to_name(res));
Edit: Same problem with esp_flash_erase_region(esp_flash_default_chip, 0x1000, 4096);