2016-09-22 20:44:45 -04:00
|
|
|
menu "SPI Flash driver"
|
|
|
|
|
2019-01-25 11:10:53 -05:00
|
|
|
config SPI_FLASH_VERIFY_WRITE
|
|
|
|
bool "Verify SPI flash writes"
|
|
|
|
default n
|
|
|
|
help
|
|
|
|
If this option is enabled, any time SPI flash is written then the data will be read
|
|
|
|
back and verified. This can catch hardware problems with SPI flash, or flash which
|
|
|
|
was not erased before verification.
|
2017-10-06 00:38:01 -04:00
|
|
|
|
2019-01-25 11:10:53 -05:00
|
|
|
config SPI_FLASH_LOG_FAILED_WRITE
|
|
|
|
bool "Log errors if verification fails"
|
|
|
|
depends on SPI_FLASH_VERIFY_WRITE
|
|
|
|
default n
|
|
|
|
help
|
|
|
|
If this option is enabled, if SPI flash write verification fails then a log error line
|
|
|
|
will be written with the address, expected & actual values. This can be useful when
|
|
|
|
debugging hardware SPI flash problems.
|
2017-10-06 00:38:01 -04:00
|
|
|
|
2019-01-25 11:10:53 -05:00
|
|
|
config SPI_FLASH_WARN_SETTING_ZERO_TO_ONE
|
|
|
|
bool "Log warning if writing zero bits to ones"
|
|
|
|
depends on SPI_FLASH_VERIFY_WRITE
|
|
|
|
default n
|
|
|
|
help
|
|
|
|
If this option is enabled, any SPI flash write which tries to set zero bits in the flash to
|
|
|
|
ones will log a warning. Such writes will not result in the requested data appearing identically
|
|
|
|
in flash once written, as SPI NOR flash can only set bits to one when an entire sector is erased.
|
|
|
|
After erasing, individual bits can only be written from one to zero.
|
2017-11-28 22:26:57 -05:00
|
|
|
|
2019-01-25 11:10:53 -05:00
|
|
|
Note that some software (such as SPIFFS) which is aware of SPI NOR flash may write one bits as an
|
|
|
|
optimisation, relying on the data in flash becoming a bitwise AND of the new data and any existing data.
|
|
|
|
Such software will log spurious warnings if this option is enabled.
|
2017-11-28 22:26:57 -05:00
|
|
|
|
2019-01-25 11:10:53 -05:00
|
|
|
config SPI_FLASH_ENABLE_COUNTERS
|
|
|
|
bool "Enable operation counters"
|
|
|
|
default 0
|
|
|
|
help
|
|
|
|
This option enables the following APIs:
|
2016-09-22 20:44:45 -04:00
|
|
|
|
2019-01-25 11:10:53 -05:00
|
|
|
- spi_flash_reset_counters
|
|
|
|
- spi_flash_dump_counters
|
|
|
|
- spi_flash_get_counters
|
2017-03-09 02:29:00 -05:00
|
|
|
|
2019-01-25 11:10:53 -05:00
|
|
|
These APIs may be used to collect performance data for spi_flash APIs
|
|
|
|
and to help understand behaviour of libraries which use SPI flash.
|
2017-10-25 03:22:30 -04:00
|
|
|
|
2019-01-25 11:10:53 -05:00
|
|
|
config SPI_FLASH_ROM_DRIVER_PATCH
|
|
|
|
bool "Enable SPI flash ROM driver patched functions"
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
Enable this flag to use patched versions of SPI flash ROM driver functions.
|
|
|
|
This option is needed to write to flash on ESP32-D2WD, and any configuration
|
|
|
|
where external SPI flash is connected to non-default pins.
|
2017-10-25 03:22:30 -04:00
|
|
|
|
2019-06-11 04:45:26 -04:00
|
|
|
choice SPI_FLASH_DANGEROUS_WRITE
|
2019-01-25 11:10:53 -05:00
|
|
|
bool "Writing to dangerous flash regions"
|
2019-06-11 04:45:26 -04:00
|
|
|
default SPI_FLASH_DANGEROUS_WRITE_ABORTS
|
2019-01-25 11:10:53 -05:00
|
|
|
help
|
|
|
|
SPI flash APIs can optionally abort or return a failure code
|
|
|
|
if erasing or writing addresses that fall at the beginning
|
|
|
|
of flash (covering the bootloader and partition table) or that
|
|
|
|
overlap the app partition that contains the running app.
|
2017-10-25 03:22:30 -04:00
|
|
|
|
2019-01-25 11:10:53 -05:00
|
|
|
It is not recommended to ever write to these regions from an IDF app,
|
|
|
|
and this check prevents logic errors or corrupted firmware memory from
|
|
|
|
damaging these regions.
|
|
|
|
|
|
|
|
Note that this feature *does not* check calls to the esp_rom_xxx SPI flash
|
|
|
|
ROM functions. These functions should not be called directly from IDF
|
|
|
|
applications.
|
|
|
|
|
2019-06-11 04:45:26 -04:00
|
|
|
config SPI_FLASH_DANGEROUS_WRITE_ABORTS
|
2019-06-11 04:32:59 -04:00
|
|
|
bool "Aborts"
|
2019-06-11 04:45:26 -04:00
|
|
|
config SPI_FLASH_DANGEROUS_WRITE_FAILS
|
2019-06-11 04:32:59 -04:00
|
|
|
bool "Fails"
|
2019-06-11 04:45:26 -04:00
|
|
|
config SPI_FLASH_DANGEROUS_WRITE_ALLOWED
|
2019-06-11 04:32:59 -04:00
|
|
|
bool "Allowed"
|
2019-01-25 11:10:53 -05:00
|
|
|
endchoice
|
2017-10-25 03:22:30 -04:00
|
|
|
|
2019-01-08 05:29:25 -05:00
|
|
|
config SPI_FLASH_USE_LEGACY_IMPL
|
|
|
|
bool "Use the legacy implementation before IDF v4.0"
|
|
|
|
default n
|
|
|
|
help
|
|
|
|
The implementation of SPI flash has been greatly changed in IDF v4.0.
|
|
|
|
Enable this option to use the legacy implementation.
|
|
|
|
|
2020-04-09 01:30:12 -04:00
|
|
|
config SPI_FLASH_SHARE_SPI1_BUS
|
|
|
|
bool "Support other devices attached to SPI1 bus"
|
|
|
|
default n
|
|
|
|
# The bus lock on SPI1 is meaningless when the legacy implementation is used, or the SPI
|
|
|
|
# driver does not support SPI1.
|
|
|
|
depends on !SPI_FLASH_USE_LEGACY_IMPL && !IDF_TARGET_ESP32S2
|
|
|
|
select FREERTOS_SUPPORT_STATIC_ALLOCATION
|
|
|
|
help
|
|
|
|
Each SPI bus needs a lock for arbitration among devices. This allows multiple
|
|
|
|
devices on a same bus, but may reduce the speed of esp_flash driver access to the
|
|
|
|
main flash chip.
|
|
|
|
|
|
|
|
If you only need to use esp_flash driver to access the main flash chip, disable
|
|
|
|
this option, and the lock will be bypassed on SPI1 bus. Otherwise if extra devices
|
|
|
|
are needed to attach to SPI1 bus, enable this option.
|
|
|
|
|
2020-04-23 14:09:15 -04:00
|
|
|
config SPI_FLASH_BYPASS_BLOCK_ERASE
|
|
|
|
bool "Bypass a block erase and always do sector erase"
|
|
|
|
default n
|
|
|
|
help
|
|
|
|
Some flash chips can have very high "max" erase times, especially for block erase (32KB or 64KB).
|
|
|
|
This option allows to bypass "block erase" and always do sector erase commands.
|
|
|
|
This will be much slower overall in most cases, but improves latency for other code to run.
|
|
|
|
|
2020-04-02 02:27:33 -04:00
|
|
|
config SPI_FLASH_YIELD_DURING_ERASE
|
|
|
|
bool "Enables yield operation during flash erase"
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
This allows to yield the CPUs between erase commands.
|
|
|
|
Prevents starvation of other tasks.
|
|
|
|
|
|
|
|
config SPI_FLASH_ERASE_YIELD_DURATION_MS
|
|
|
|
int "Duration of erasing to yield CPUs (ms)"
|
|
|
|
depends on SPI_FLASH_YIELD_DURING_ERASE
|
|
|
|
default 20
|
|
|
|
help
|
|
|
|
If a duration of one erase command is large
|
|
|
|
then it will yield CPUs after finishing a current command.
|
|
|
|
|
|
|
|
config SPI_FLASH_ERASE_YIELD_TICKS
|
|
|
|
int "CPU release time (tick)"
|
|
|
|
depends on SPI_FLASH_YIELD_DURING_ERASE
|
|
|
|
default 1
|
|
|
|
help
|
|
|
|
Defines how many ticks will be before returning to continue a erasing.
|
|
|
|
|
2019-01-08 05:29:25 -05:00
|
|
|
menu "Auto-detect flash chips"
|
|
|
|
|
|
|
|
config SPI_FLASH_SUPPORT_ISSI_CHIP
|
|
|
|
bool "ISSI"
|
|
|
|
default y
|
|
|
|
help
|
2019-09-09 12:56:46 -04:00
|
|
|
Enable this to support auto detection of ISSI chips if chip vendor not directly
|
|
|
|
given by ``chip_drv`` member of the chip struct. This adds support for variant
|
|
|
|
chips, however will extend detecting time.
|
|
|
|
|
2020-03-19 10:49:25 -04:00
|
|
|
config SPI_FLASH_SUPPORT_MXIC_CHIP
|
|
|
|
bool "MXIC"
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
Enable this to support auto detection of MXIC chips if chip vendor not directly
|
|
|
|
given by ``chip_drv`` member of the chip struct. This adds support for variant
|
|
|
|
chips, however will extend detecting time.
|
|
|
|
|
2019-09-09 12:56:46 -04:00
|
|
|
config SPI_FLASH_SUPPORT_GD_CHIP
|
|
|
|
bool "GigaDevice"
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
Enable this to support auto detection of GD (GigaDevice) chips if chip vendor not
|
|
|
|
directly given by ``chip_drv`` member of the chip struct. If you are using Wrover
|
|
|
|
modules, please don't disable this, otherwise your flash may not work in 4-bit
|
|
|
|
mode.
|
|
|
|
|
|
|
|
This adds support for variant chips, however will extend detecting time and image
|
|
|
|
size. Note that the default chip driver supports the GD chips with product ID
|
|
|
|
60H.
|
|
|
|
|
2019-01-08 05:29:25 -05:00
|
|
|
endmenu #auto detect flash chips
|
|
|
|
|
2021-01-22 05:14:27 -05:00
|
|
|
config SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE
|
|
|
|
bool "Enable encrypted partition read/write operations"
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
This option enables flash read/write operations to encrypted partition/s. This option
|
|
|
|
is kept enabled irrespective of state of flash encryption feature. However, in case
|
|
|
|
application is not using flash encryption feature and is in need of some additional
|
|
|
|
memory from IRAM region (~1KB) then this config can be disabled.
|
|
|
|
|
2016-09-22 20:44:45 -04:00
|
|
|
endmenu
|