浏览代码

spi_flash: RAM loadable ELF should have dangerous writes option allowed

For RAM loadable ELF case, there is no application or the bootloader on
the flash. And hence the check for getting current running OTA partition
or looking up partition table fails during dangerous writes option.

We are disabling the dangerous writes option for RAM loadable ELF case
and allowing writes to entire flash memory.
Mahavir Jain 2 年之前
父节点
当前提交
bad4cd7072
共有 2 个文件被更改,包括 2 次插入0 次删除
  1. 1 0
      components/spi_flash/Kconfig
  2. 1 0
      docs/en/api-reference/peripherals/spi_flash/spi_flash_idf_vs_rom.rst

+ 1 - 0
components/spi_flash/Kconfig

@@ -74,6 +74,7 @@ menu "SPI Flash driver"
 
     choice SPI_FLASH_DANGEROUS_WRITE
         bool  "Writing to dangerous flash regions"
+        default SPI_FLASH_DANGEROUS_WRITE_ALLOWED if APP_BUILD_TYPE_RAM
         default SPI_FLASH_DANGEROUS_WRITE_ABORTS
         help
             SPI flash APIs can optionally abort or return a failure code

+ 1 - 0
docs/en/api-reference/peripherals/spi_flash/spi_flash_idf_vs_rom.rst

@@ -19,6 +19,7 @@ Feature Supported by ESP-IDF but not in Chip-ROM
     - :ref:`CONFIG_SPI_FLASH_VERIFY_WRITE`, enabling this option helps you detect bad writing.
     - :ref:`CONFIG_SPI_FLASH_LOG_FAILED_WRITE`, enabling this option will print the bad writing.
     - :ref:`CONFIG_SPI_FLASH_WARN_SETTING_ZERO_TO_ONE`, enabling this option will check if you're writing zero to one.
+    - :ref:`CONFIG_SPI_FLASH_DANGEROUS_WRITE`, enabling this option will check for flash programming to certain protected regions like bootloader, partition table or application itself.
     :esp32h2 or esp32c6: - Flash MMAP driver isn't ready in Chip-ROM.