Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_bootloader_failed_read_image_data' into 'mas…
Browse files Browse the repository at this point in the history
…ter'

fix(spi_flash): Fix bootloader failed to read image data

See merge request sdk/ESP8266_RTOS_SDK!1665
  • Loading branch information
donghengqaz committed Sep 20, 2022
2 parents 971db98 + 92ac9ee commit 7085cc7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/spi_flash/src/spi_flash_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ uint32_t spi_flash_get_id_raw(esp_rom_spiflash_chip_t *chip)
{
uint32_t rdid = 0;

#ifndef BOOTLOADER_BUILD
Cache_Read_Disable();
#endif

Wait_SPI_Idle(chip);

Expand All @@ -49,7 +51,9 @@ uint32_t spi_flash_get_id_raw(esp_rom_spiflash_chip_t *chip)

rdid = READ_PERI_REG(PERIPHS_SPI_FLASH_C0)&0xffffff;

#ifndef BOOTLOADER_BUILD
Cache_Read_Enable_New();
#endif

return rdid;
}
Expand Down Expand Up @@ -150,8 +154,11 @@ bool spi_user_cmd_raw(esp_rom_spiflash_chip_t *chip, spi_cmd_dir_t mode, spi_cmd
{
int idx = 0;

#ifndef BOOTLOADER_BUILD
// Cache Disable
Cache_Read_Disable_2();
#endif

//wait spi idle
if((mode & SPI_RAW) == 0) {
Wait_SPI_Idle(chip);
Expand Down Expand Up @@ -272,8 +279,11 @@ bool spi_user_cmd_raw(esp_rom_spiflash_chip_t *chip, spi_cmd_dir_t mode, spi_cmd
if((mode & SPI_RAW) == 0) {
Wait_SPI_Idle(chip);
}

#ifndef BOOTLOADER_BUILD
//enable icache
Cache_Read_Enable_2();
#endif

return true;
}
Expand Down

0 comments on commit 7085cc7

Please sign in to comment.