spi_flash: move the unlock patch to bootloader and add support for GD

This commit is contained in:
Cao Sen Miao
2021-05-07 15:25:06 +08:00
parent a05d4e9e86
commit ea06ee1ad6
14 changed files with 127 additions and 17 deletions

View File

@@ -49,6 +49,7 @@
#include "cache_utils.h"
#include "esp_flash.h"
#include "esp_attr.h"
#include "bootloader_flash.h"
esp_rom_spiflash_result_t IRAM_ATTR spi_flash_write_encrypted_chip(size_t dest_addr, const void *src, size_t size);
@@ -239,11 +240,8 @@ static esp_rom_spiflash_result_t IRAM_ATTR spi_flash_unlock(void)
static bool unlocked = false;
if (!unlocked) {
spi_flash_guard_start();
esp_rom_spiflash_result_t rc = esp_rom_spiflash_unlock();
bootloader_flash_unlock();
spi_flash_guard_end();
if (rc != ESP_ROM_SPIFLASH_RESULT_OK) {
return rc;
}
unlocked = true;
}
return ESP_ROM_SPIFLASH_RESULT_OK;