Kconfig 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. menu "SPI Flash driver"
  2. config SPI_FLASH_VERIFY_WRITE
  3. bool "Verify SPI flash writes"
  4. default n
  5. help
  6. If this option is enabled, any time SPI flash is written then the data will be read
  7. back and verified. This can catch hardware problems with SPI flash, or flash which
  8. was not erased before verification.
  9. config SPI_FLASH_LOG_FAILED_WRITE
  10. bool "Log errors if verification fails"
  11. depends on SPI_FLASH_VERIFY_WRITE
  12. default n
  13. help
  14. If this option is enabled, if SPI flash write verification fails then a log error line
  15. will be written with the address, expected & actual values. This can be useful when
  16. debugging hardware SPI flash problems.
  17. config SPI_FLASH_WARN_SETTING_ZERO_TO_ONE
  18. bool "Log warning if writing zero bits to ones"
  19. depends on SPI_FLASH_VERIFY_WRITE
  20. default n
  21. help
  22. If this option is enabled, any SPI flash write which tries to set zero bits in the flash to
  23. ones will log a warning. Such writes will not result in the requested data appearing identically
  24. in flash once written, as SPI NOR flash can only set bits to one when an entire sector is erased.
  25. After erasing, individual bits can only be written from one to zero.
  26. Note that some software (such as SPIFFS) which is aware of SPI NOR flash may write one bits as an
  27. optimisation, relying on the data in flash becoming a bitwise AND of the new data and any existing data.
  28. Such software will log spurious warnings if this option is enabled.
  29. config SPI_FLASH_ENABLE_COUNTERS
  30. bool "Enable operation counters"
  31. default 0
  32. help
  33. This option enables the following APIs:
  34. - spi_flash_reset_counters
  35. - spi_flash_dump_counters
  36. - spi_flash_get_counters
  37. These APIs may be used to collect performance data for spi_flash APIs
  38. and to help understand behaviour of libraries which use SPI flash.
  39. config SPI_FLASH_ROM_DRIVER_PATCH
  40. bool "Enable SPI flash ROM driver patched functions"
  41. default y
  42. help
  43. Enable this flag to use patched versions of SPI flash ROM driver functions.
  44. This option should be enabled, if any one of the following is true: (1) need to write
  45. to flash on ESP32-D2WD; (2) main SPI flash is connected to non-default pins; (3) main
  46. SPI flash chip is manufactured by ISSI.
  47. choice SPI_FLASH_DANGEROUS_WRITE
  48. bool "Writing to dangerous flash regions"
  49. default SPI_FLASH_DANGEROUS_WRITE_ABORTS
  50. help
  51. SPI flash APIs can optionally abort or return a failure code
  52. if erasing or writing addresses that fall at the beginning
  53. of flash (covering the bootloader and partition table) or that
  54. overlap the app partition that contains the running app.
  55. It is not recommended to ever write to these regions from an IDF app,
  56. and this check prevents logic errors or corrupted firmware memory from
  57. damaging these regions.
  58. Note that this feature *does not* check calls to the esp_rom_xxx SPI flash
  59. ROM functions. These functions should not be called directly from IDF
  60. applications.
  61. config SPI_FLASH_DANGEROUS_WRITE_ABORTS
  62. bool "Aborts"
  63. config SPI_FLASH_DANGEROUS_WRITE_FAILS
  64. bool "Fails"
  65. config SPI_FLASH_DANGEROUS_WRITE_ALLOWED
  66. bool "Allowed"
  67. endchoice
  68. config SPI_FLASH_USE_LEGACY_IMPL
  69. bool "Use the legacy implementation before IDF v4.0"
  70. default n
  71. help
  72. The implementation of SPI flash has been greatly changed in IDF v4.0.
  73. Enable this option to use the legacy implementation.
  74. config SPI_FLASH_SHARE_SPI1_BUS
  75. bool "Support other devices attached to SPI1 bus"
  76. default n
  77. # The bus lock on SPI1 is meaningless when the legacy implementation is used, or the SPI
  78. # driver does not support SPI1.
  79. depends on !SPI_FLASH_USE_LEGACY_IMPL && !IDF_TARGET_ESP32S2
  80. select FREERTOS_SUPPORT_STATIC_ALLOCATION
  81. help
  82. Each SPI bus needs a lock for arbitration among devices. This allows multiple
  83. devices on a same bus, but may reduce the speed of esp_flash driver access to the
  84. main flash chip.
  85. If you only need to use esp_flash driver to access the main flash chip, disable
  86. this option, and the lock will be bypassed on SPI1 bus. Otherwise if extra devices
  87. are needed to attach to SPI1 bus, enable this option.
  88. config SPI_FLASH_BYPASS_BLOCK_ERASE
  89. bool "Bypass a block erase and always do sector erase"
  90. default n
  91. help
  92. Some flash chips can have very high "max" erase times, especially for block erase (32KB or 64KB).
  93. This option allows to bypass "block erase" and always do sector erase commands.
  94. This will be much slower overall in most cases, but improves latency for other code to run.
  95. config SPI_FLASH_YIELD_DURING_ERASE
  96. bool "Enables yield operation during flash erase"
  97. default y
  98. help
  99. This allows to yield the CPUs between erase commands.
  100. Prevents starvation of other tasks.
  101. config SPI_FLASH_ERASE_YIELD_DURATION_MS
  102. int "Duration of erasing to yield CPUs (ms)"
  103. depends on SPI_FLASH_YIELD_DURING_ERASE
  104. default 20
  105. help
  106. If a duration of one erase command is large
  107. then it will yield CPUs after finishing a current command.
  108. config SPI_FLASH_ERASE_YIELD_TICKS
  109. int "CPU release time (tick)"
  110. depends on SPI_FLASH_YIELD_DURING_ERASE
  111. default 1
  112. help
  113. Defines how many ticks will be before returning to continue a erasing.
  114. config SPI_FLASH_WRITE_CHUNK_SIZE
  115. int "Flash write chunk size"
  116. default 8192
  117. range 256 8192
  118. help
  119. Flash write is broken down in terms of multiple (smaller) write operations.
  120. This configuration options helps to set individual write chunk size, smaller
  121. value here ensures that cache (and non-IRAM resident interrupts) remains
  122. disabled for shorter duration.
  123. config SPI_FLASH_SIZE_OVERRIDE
  124. bool "Override flash size in bootloader header by ESPTOOLPY_FLASHSIZE"
  125. default n
  126. help
  127. SPI Flash driver uses the flash size configured in bootloader header by default.
  128. Enable this option to override flash size with latest ESPTOOLPY_FLASHSIZE value from
  129. the app header if the size in the bootloader header is incorrect.
  130. config SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED
  131. bool "Flash timeout checkout disabled"
  132. depends on !SPI_FLASH_USE_LEGACY_IMPL
  133. default n
  134. help
  135. This option is helpful if you are using a flash chip whose timeout is quite large or unpredictable.
  136. menu "Auto-detect flash chips"
  137. config SPI_FLASH_SUPPORT_ISSI_CHIP
  138. bool "ISSI"
  139. default y
  140. help
  141. Enable this to support auto detection of ISSI chips if chip vendor not directly
  142. given by ``chip_drv`` member of the chip struct. This adds support for variant
  143. chips, however will extend detecting time.
  144. config SPI_FLASH_SUPPORT_MXIC_CHIP
  145. bool "MXIC"
  146. default y
  147. help
  148. Enable this to support auto detection of MXIC chips if chip vendor not directly
  149. given by ``chip_drv`` member of the chip struct. This adds support for variant
  150. chips, however will extend detecting time.
  151. config SPI_FLASH_SUPPORT_GD_CHIP
  152. bool "GigaDevice"
  153. default y
  154. help
  155. Enable this to support auto detection of GD (GigaDevice) chips if chip vendor not
  156. directly given by ``chip_drv`` member of the chip struct. If you are using Wrover
  157. modules, please don't disable this, otherwise your flash may not work in 4-bit
  158. mode.
  159. This adds support for variant chips, however will extend detecting time and image
  160. size. Note that the default chip driver supports the GD chips with product ID
  161. 60H.
  162. config SPI_FLASH_SUPPORT_WINBOND_CHIP
  163. bool "Winbond"
  164. default y
  165. help
  166. Enable this to support auto detection of Winbond chips if chip vendor not directly
  167. given by ``chip_drv`` member of the chip struct. This adds support for variant
  168. chips, however will extend detecting time.
  169. endmenu #auto detect flash chips
  170. endmenu