feat(partition_table): Add read-only partition flag and functionality

This commit is contained in:
Adam Múdry
2023-07-17 11:59:28 +02:00
parent f083570af6
commit ab1eb37fe8
43 changed files with 763 additions and 104 deletions

View File

@@ -206,15 +206,20 @@ static IRAM_ATTR void release_buffer_malloc(void* arg, void *temp_buf)
static IRAM_ATTR esp_err_t main_flash_region_protected(void* arg, size_t start_addr, size_t size)
{
if (!esp_partition_is_flash_region_writable(start_addr, size)) {
return ESP_ERR_NOT_ALLOWED;
}
#if !CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED
if (((app_func_arg_t*)arg)->no_protect || esp_partition_main_flash_region_safe(start_addr, size)) {
//ESP_OK = 0, also means protected==0
return ESP_OK;
} else {
return ESP_ERR_NOT_SUPPORTED;
}
#endif // !CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED
return ESP_OK;
}
static IRAM_ATTR void main_flash_op_status(uint32_t op_status)
{
bool is_erasing = op_status & SPI_FLASH_OS_IS_ERASING_STATUS_FLAG;