Kconfig 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. config SPI_FLASH_ROM_IMPL
  48. bool "Use esp_flash implementation in ROM"
  49. depends on IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C3
  50. default n
  51. help
  52. Enable this flag to use new SPI flash driver functions from ROM instead of ESP-IDF.
  53. If keeping this as "n" in your project, you will have less free IRAM.
  54. But you can use all of our flash features.
  55. If making this as "y" in your project, you will increase free IRAM.
  56. But you may miss out on some flash features and support for new flash chips.
  57. Currently the ROM cannot support the following features:
  58. - SPI_FLASH_AUTO_SUSPEND (C3, S3)
  59. choice SPI_FLASH_DANGEROUS_WRITE
  60. bool "Writing to dangerous flash regions"
  61. default SPI_FLASH_DANGEROUS_WRITE_ABORTS
  62. help
  63. SPI flash APIs can optionally abort or return a failure code
  64. if erasing or writing addresses that fall at the beginning
  65. of flash (covering the bootloader and partition table) or that
  66. overlap the app partition that contains the running app.
  67. It is not recommended to ever write to these regions from an IDF app,
  68. and this check prevents logic errors or corrupted firmware memory from
  69. damaging these regions.
  70. Note that this feature *does not* check calls to the esp_rom_xxx SPI flash
  71. ROM functions. These functions should not be called directly from IDF
  72. applications.
  73. config SPI_FLASH_DANGEROUS_WRITE_ABORTS
  74. bool "Aborts"
  75. config SPI_FLASH_DANGEROUS_WRITE_FAILS
  76. bool "Fails"
  77. config SPI_FLASH_DANGEROUS_WRITE_ALLOWED
  78. bool "Allowed"
  79. endchoice
  80. config SPI_FLASH_USE_LEGACY_IMPL
  81. bool "Use the legacy implementation before IDF v4.0"
  82. default n
  83. help
  84. The implementation of SPI flash has been greatly changed in IDF v4.0.
  85. Enable this option to use the legacy implementation.
  86. config SPI_FLASH_SHARE_SPI1_BUS
  87. bool "Support other devices attached to SPI1 bus"
  88. default n
  89. # The bus lock on SPI1 is meaningless when the legacy implementation is used, or the SPI
  90. # driver does not support SPI1.
  91. depends on !SPI_FLASH_USE_LEGACY_IMPL && !IDF_TARGET_ESP32S2
  92. help
  93. Each SPI bus needs a lock for arbitration among devices. This allows multiple
  94. devices on a same bus, but may reduce the speed of esp_flash driver access to the
  95. main flash chip.
  96. If you only need to use esp_flash driver to access the main flash chip, disable
  97. this option, and the lock will be bypassed on SPI1 bus. Otherwise if extra devices
  98. are needed to attach to SPI1 bus, enable this option.
  99. config SPI_FLASH_BYPASS_BLOCK_ERASE
  100. bool "Bypass a block erase and always do sector erase"
  101. default n
  102. help
  103. Some flash chips can have very high "max" erase times, especially for block erase (32KB or 64KB).
  104. This option allows to bypass "block erase" and always do sector erase commands.
  105. This will be much slower overall in most cases, but improves latency for other code to run.
  106. config SPI_FLASH_YIELD_DURING_ERASE
  107. bool "Enables yield operation during flash erase"
  108. default y
  109. help
  110. This allows to yield the CPUs between erase commands.
  111. Prevents starvation of other tasks.
  112. config SPI_FLASH_ERASE_YIELD_DURATION_MS
  113. int "Duration of erasing to yield CPUs (ms)"
  114. depends on SPI_FLASH_YIELD_DURING_ERASE
  115. default 20
  116. help
  117. If a duration of one erase command is large
  118. then it will yield CPUs after finishing a current command.
  119. config SPI_FLASH_ERASE_YIELD_TICKS
  120. int "CPU release time (tick) for an erase operation"
  121. depends on SPI_FLASH_YIELD_DURING_ERASE
  122. default 1
  123. help
  124. Defines how many ticks will be before returning to continue a erasing.
  125. config SPI_FLASH_AUTO_SUSPEND
  126. bool "Auto suspend long erase/write operations (READ DOCS FIRST)"
  127. default n
  128. depends on IDF_TARGET_ESP32C3 && !SPI_FLASH_USE_LEGACY_IMPL && !SPI_FLASH_ROM_IMPL
  129. help
  130. This option is default n before ESP32-C3, because it needs bootloader support.
  131. CAUTION: If you want to OTA to an app with this feature turned on, please make
  132. sure the bootloader has the support for it. (later than IDF v4.3)
  133. Auto-suspend feature only supported by XMC chip.
  134. If you are using an official module, please contact Espressif Business support.
  135. Also reading auto suspend part in `SPI Flash API` document before you enable this function.
  136. config SPI_FLASH_WRITE_CHUNK_SIZE
  137. int "Flash write chunk size"
  138. default 8192
  139. range 256 8192
  140. help
  141. Flash write is broken down in terms of multiple (smaller) write operations.
  142. This configuration options helps to set individual write chunk size, smaller
  143. value here ensures that cache (and non-IRAM resident interrupts) remains
  144. disabled for shorter duration.
  145. config SPI_FLASH_SIZE_OVERRIDE
  146. bool "Override flash size in bootloader header by ESPTOOLPY_FLASHSIZE"
  147. default n
  148. help
  149. SPI Flash driver uses the flash size configured in bootloader header by default.
  150. Enable this option to override flash size with latest ESPTOOLPY_FLASHSIZE value from
  151. the app header if the size in the bootloader header is incorrect.
  152. config SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED
  153. bool "Flash timeout checkout disabled"
  154. depends on !SPI_FLASH_USE_LEGACY_IMPL
  155. default n
  156. help
  157. This option is helpful if you are using a flash chip whose timeout is quite large or unpredictable.
  158. config SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST
  159. bool "Override default chip driver list"
  160. depends on !SPI_FLASH_USE_LEGACY_IMPL
  161. default n
  162. help
  163. This option allows the chip driver list to be customized, instead of using the default list provided by
  164. ESP-IDF.
  165. When this option is enabled, the default list is no longer compiled or linked. Instead, the
  166. `default_registered_chips` structure must be provided by the user.
  167. See example: custom_chip_driver under examples/storage for more details.
  168. menu "Auto-detect flash chips"
  169. visible if !SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST
  170. config SPI_FLASH_SUPPORT_ISSI_CHIP
  171. bool "ISSI"
  172. default y
  173. help
  174. Enable this to support auto detection of ISSI chips if chip vendor not directly
  175. given by ``chip_drv`` member of the chip struct. This adds support for variant
  176. chips, however will extend detecting time.
  177. config SPI_FLASH_SUPPORT_MXIC_CHIP
  178. bool "MXIC"
  179. default y
  180. help
  181. Enable this to support auto detection of MXIC chips if chip vendor not directly
  182. given by ``chip_drv`` member of the chip struct. This adds support for variant
  183. chips, however will extend detecting time.
  184. config SPI_FLASH_SUPPORT_GD_CHIP
  185. bool "GigaDevice"
  186. default y
  187. help
  188. Enable this to support auto detection of GD (GigaDevice) chips if chip vendor not
  189. directly given by ``chip_drv`` member of the chip struct. If you are using Wrover
  190. modules, please don't disable this, otherwise your flash may not work in 4-bit
  191. mode.
  192. This adds support for variant chips, however will extend detecting time and image
  193. size. Note that the default chip driver supports the GD chips with product ID
  194. 60H.
  195. config SPI_FLASH_SUPPORT_WINBOND_CHIP
  196. bool "Winbond"
  197. default y
  198. help
  199. Enable this to support auto detection of Winbond chips if chip vendor not directly
  200. given by ``chip_drv`` member of the chip struct. This adds support for variant
  201. chips, however will extend detecting time.
  202. config SPI_FLASH_SUPPORT_BOYA_CHIP
  203. bool "BOYA"
  204. depends on !IDF_TARGET_ESP32
  205. default y
  206. help
  207. Enable this to support auto detection of BOYA chips if chip vendor not directly
  208. given by ``chip_drv`` member of the chip struct. This adds support for variant
  209. chips, however will extend detecting time.
  210. config SPI_FLASH_SUPPORT_MXIC_OPI_CHIP
  211. bool "mxic (opi)"
  212. depends on IDF_TARGET_ESP32S3
  213. default y
  214. help
  215. Enable this to support auto detection of Octal MXIC chips if chip vendor not directly
  216. given by ``chip_drv`` member of the chip struct. This adds support for variant
  217. chips, however will extend detecting time.
  218. endmenu #auto detect flash chips
  219. config SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE
  220. bool "Enable encrypted partition read/write operations"
  221. default y
  222. help
  223. This option enables flash read/write operations to encrypted partition/s. This option
  224. is kept enabled irrespective of state of flash encryption feature. However, in case
  225. application is not using flash encryption feature and is in need of some additional
  226. memory from IRAM region (~1KB) then this config can be disabled.
  227. endmenu