kopia lustrzana https://github.com/espressif/esp-idf
rom, spi_flash: add a patch for esp_flash_erase_region for C3, S3, H2
rodzic
118fafef07
commit
7534c4467f
|
@ -20,3 +20,4 @@
|
|||
#define ESP_ROM_UART_CLK_IS_XTAL (1) // UART clock source is selected to XTAL in ROM
|
||||
#define ESP_ROM_USB_SERIAL_DEVICE_NUM (3) // UART uses USB_SERIAL_JTAG port in ROM.
|
||||
#define ESP_ROM_HAS_RETARGETABLE_LOCKING (1) // ROM was built with retargetable locking
|
||||
#define ESP_ROM_HAS_ERASE_0_REGION_BUG (1) // ROM has esp_flash_erase_region(size=0) bug
|
||||
|
|
|
@ -260,7 +260,7 @@ PROVIDE( esp_flash_chip_driver_initialized = 0x400002fc );
|
|||
PROVIDE( esp_flash_read_id = 0x40000300 );
|
||||
PROVIDE( esp_flash_get_size = 0x40000304 );
|
||||
PROVIDE( esp_flash_erase_chip = 0x40000308 );
|
||||
PROVIDE( esp_flash_erase_region = 0x4000030c );
|
||||
PROVIDE( rom_esp_flash_erase_region = 0x4000030c );
|
||||
PROVIDE( esp_flash_get_chip_write_protect = 0x40000310 );
|
||||
PROVIDE( esp_flash_set_chip_write_protect = 0x40000314 );
|
||||
PROVIDE( esp_flash_get_protectable_regions = 0x40000318 );
|
||||
|
|
|
@ -20,3 +20,4 @@
|
|||
#define ESP_ROM_UART_CLK_IS_XTAL (1) // UART clock source is selected to XTAL in ROM
|
||||
#define ESP_ROM_USB_SERIAL_DEVICE_NUM (3) // UART uses USB_SERIAL_JTAG port in ROM.
|
||||
#define ESP_ROM_HAS_RETARGETABLE_LOCKING (1) // ROM was built with retargetable locking
|
||||
#define ESP_ROM_HAS_ERASE_0_REGION_BUG (1) // ROM has esp_flash_erase_region(size=0) bug
|
||||
|
|
|
@ -267,7 +267,7 @@ PROVIDE( esp_flash_chip_driver_initialized = 0x400002f8 );
|
|||
PROVIDE( esp_flash_read_id = 0x400002fc );
|
||||
PROVIDE( esp_flash_get_size = 0x40000300 );
|
||||
PROVIDE( esp_flash_erase_chip = 0x40000304 );
|
||||
PROVIDE( esp_flash_erase_region = 0x40000308 );
|
||||
PROVIDE( rom_esp_flash_erase_region = 0x40000308 );
|
||||
PROVIDE( esp_flash_get_chip_write_protect = 0x4000030c );
|
||||
PROVIDE( esp_flash_set_chip_write_protect = 0x40000310 );
|
||||
PROVIDE( esp_flash_get_protectable_regions = 0x40000314 );
|
||||
|
|
|
@ -21,3 +21,4 @@
|
|||
#define ESP_ROM_UART_CLK_IS_XTAL (1) // UART clock source is selected to XTAL in ROM
|
||||
#define ESP_ROM_HAS_RETARGETABLE_LOCKING (1) // ROM was built with retargetable locking
|
||||
#define ESP_ROM_USB_SERIAL_DEVICE_NUM (4) // The serial port ID (UART, USB, ...) of USB_SERIAL_JTAG in the ROM.
|
||||
#define ESP_ROM_HAS_ERASE_0_REGION_BUG (1) // ROM has esp_flash_erase_region(size=0) bug
|
||||
|
|
|
@ -334,7 +334,7 @@ PROVIDE( esp_flash_chip_driver_initialized = 0x400010bc );
|
|||
PROVIDE( esp_flash_read_id = 0x400010c8 );
|
||||
PROVIDE( esp_flash_get_size = 0x400010d4 );
|
||||
PROVIDE( esp_flash_erase_chip = 0x400010e0 );
|
||||
PROVIDE( esp_flash_erase_region = 0x400010ec );
|
||||
PROVIDE( rom_esp_flash_erase_region = 0x400010ec );
|
||||
PROVIDE( esp_flash_get_chip_write_protect = 0x400010f8 );
|
||||
PROVIDE( esp_flash_set_chip_write_protect = 0x40001104 );
|
||||
PROVIDE( esp_flash_get_protectable_regions = 0x40001110 );
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "sdkconfig.h"
|
||||
#include "esp_flash_internal.h"
|
||||
#include "spi_flash_defs.h"
|
||||
#include "esp_rom_caps.h"
|
||||
#if CONFIG_IDF_TARGET_ESP32S2
|
||||
#include "esp_crypto_lock.h" // for locking flash encryption peripheral
|
||||
#endif //CONFIG_IDF_TARGET_ESP32S2
|
||||
|
@ -545,6 +546,28 @@ esp_err_t IRAM_ATTR esp_flash_erase_region(esp_flash_t *chip, uint32_t start, ui
|
|||
return rom_spiflash_api_funcs->flash_end_flush_cache(chip, err, bus_acquired, start, len);
|
||||
}
|
||||
|
||||
#endif // !CONFIG_SPI_FLASH_ROM_IMPL
|
||||
|
||||
#if defined(CONFIG_SPI_FLASH_ROM_IMPL) && ESP_ROM_HAS_ERASE_0_REGION_BUG
|
||||
|
||||
/* ROM esp_flash_erase_region implementation doesn't handle 0 erase size correctly.
|
||||
* Check the size and call ROM function instead of overriding it completely.
|
||||
* The behavior is slightly different from esp_flash_erase_region above, thought:
|
||||
* here the check for 0 size is done first, but in esp_flash_erase_region the check is
|
||||
* done after the other arguments are checked.
|
||||
*/
|
||||
extern esp_err_t rom_esp_flash_erase_region(esp_flash_t *chip, uint32_t start, uint32_t len);
|
||||
esp_err_t IRAM_ATTR esp_flash_erase_region(esp_flash_t *chip, uint32_t start, uint32_t len)
|
||||
{
|
||||
if (len == 0) {
|
||||
return ESP_OK;
|
||||
}
|
||||
return rom_esp_flash_erase_region(chip, start, len);
|
||||
}
|
||||
#endif // defined(CONFIG_SPI_FLASH_ROM_IMPL) && ESP_ROM_HAS_ERASE_0_REGION_BUG
|
||||
|
||||
#ifndef CONFIG_SPI_FLASH_ROM_IMPL
|
||||
|
||||
esp_err_t IRAM_ATTR esp_flash_get_chip_write_protect(esp_flash_t *chip, bool *out_write_protected)
|
||||
{
|
||||
esp_err_t err = rom_spiflash_api_funcs->chip_check(&chip);
|
||||
|
|
Ładowanie…
Reference in New Issue