Skip to content

Commit 5b9b5d9

Browse files
committed
spi_flash: esp32: fix regression in encrypted flash write
In commit 309376f, it seems like regression was added to use ROM level API for disabling flash write protection. This started random firmware crashes (on specific modules) with exception `IllegalInstruction` during encrypted flash writes. Fix here removes relevant ROM API call, since disabling flash write protection is already ensured by caller of this API. Closes espressif/esp-idf#5467
1 parent 49d69bb commit 5b9b5d9

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

components/spi_flash/esp32/flash_ops_esp32.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,11 @@ static inline void IRAM_ATTR spi_flash_guard_end(void)
3535
esp_rom_spiflash_result_t IRAM_ATTR spi_flash_write_encrypted_chip(size_t dest_addr, const void *src, size_t size)
3636
{
3737
const uint8_t *ssrc = (const uint8_t *)src;
38-
esp_rom_spiflash_result_t rc;
38+
esp_rom_spiflash_result_t rc = ESP_ROM_SPIFLASH_RESULT_OK;
3939

4040
assert((dest_addr % 16) == 0);
4141
assert((size % 16) == 0);
4242

43-
rc = esp_rom_spiflash_unlock();
44-
if (rc != ESP_ROM_SPIFLASH_RESULT_OK) {
45-
return rc;
46-
}
4743
/* esp_rom_spiflash_write_encrypted encrypts data in RAM as it writes,
4844
so copy to a temporary buffer - 32 bytes at a time.
4945

0 commit comments

Comments
 (0)