mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
Merge branch 'bugfix/spiflash_kconfig' into 'master'
spi_flash: Fix Kconfig indentation Closes IDFGH-1307 See merge request idf/esp-idf!5195
This commit is contained in:
@@ -52,9 +52,9 @@ menu "SPI Flash driver"
|
|||||||
This option is needed to write to flash on ESP32-D2WD, and any configuration
|
This option is needed to write to flash on ESP32-D2WD, and any configuration
|
||||||
where external SPI flash is connected to non-default pins.
|
where external SPI flash is connected to non-default pins.
|
||||||
|
|
||||||
choice SPI_FLASH_WRITING_DANGEROUS_REGIONS
|
choice SPI_FLASH_DANGEROUS_WRITE
|
||||||
bool "Writing to dangerous flash regions"
|
bool "Writing to dangerous flash regions"
|
||||||
default SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS
|
default SPI_FLASH_DANGEROUS_WRITE_ABORTS
|
||||||
help
|
help
|
||||||
SPI flash APIs can optionally abort or return a failure code
|
SPI flash APIs can optionally abort or return a failure code
|
||||||
if erasing or writing addresses that fall at the beginning
|
if erasing or writing addresses that fall at the beginning
|
||||||
@@ -69,14 +69,12 @@ menu "SPI Flash driver"
|
|||||||
ROM functions. These functions should not be called directly from IDF
|
ROM functions. These functions should not be called directly from IDF
|
||||||
applications.
|
applications.
|
||||||
|
|
||||||
config SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS
|
config SPI_FLASH_DANGEROUS_WRITE_ABORTS
|
||||||
bool "Aborts"
|
bool "Aborts"
|
||||||
config SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS
|
config SPI_FLASH_DANGEROUS_WRITE_FAILS
|
||||||
bool "Fails"
|
bool "Fails"
|
||||||
config SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED
|
config SPI_FLASH_DANGEROUS_WRITE_ALLOWED
|
||||||
bool "Allowed"
|
bool "Allowed"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
|
||||||
|
@@ -77,7 +77,7 @@ const DRAM_ATTR spi_flash_guard_funcs_t g_flash_guard_default_ops = {
|
|||||||
.end = spi_flash_enable_interrupts_caches_and_other_cpu,
|
.end = spi_flash_enable_interrupts_caches_and_other_cpu,
|
||||||
.op_lock = spi_flash_op_lock,
|
.op_lock = spi_flash_op_lock,
|
||||||
.op_unlock = spi_flash_op_unlock,
|
.op_unlock = spi_flash_op_unlock,
|
||||||
#if !CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED
|
#if !CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED
|
||||||
.is_safe_write_address = is_safe_write_address
|
.is_safe_write_address = is_safe_write_address
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -87,14 +87,14 @@ const DRAM_ATTR spi_flash_guard_funcs_t g_flash_guard_no_os_ops = {
|
|||||||
.end = spi_flash_enable_interrupts_caches_no_os,
|
.end = spi_flash_enable_interrupts_caches_no_os,
|
||||||
.op_lock = 0,
|
.op_lock = 0,
|
||||||
.op_unlock = 0,
|
.op_unlock = 0,
|
||||||
#if !CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED
|
#if !CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED
|
||||||
.is_safe_write_address = 0
|
.is_safe_write_address = 0
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const spi_flash_guard_funcs_t *s_flash_guard_ops;
|
static const spi_flash_guard_funcs_t *s_flash_guard_ops;
|
||||||
|
|
||||||
#ifdef CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS
|
#ifdef CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS
|
||||||
#define UNSAFE_WRITE_ADDRESS abort()
|
#define UNSAFE_WRITE_ADDRESS abort()
|
||||||
#else
|
#else
|
||||||
#define UNSAFE_WRITE_ADDRESS return false
|
#define UNSAFE_WRITE_ADDRESS return false
|
||||||
@@ -104,7 +104,7 @@ static const spi_flash_guard_funcs_t *s_flash_guard_ops;
|
|||||||
/* CHECK_WRITE_ADDRESS macro to fail writes which land in the
|
/* CHECK_WRITE_ADDRESS macro to fail writes which land in the
|
||||||
bootloader, partition table, or running application region.
|
bootloader, partition table, or running application region.
|
||||||
*/
|
*/
|
||||||
#if CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED
|
#if CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED
|
||||||
#define CHECK_WRITE_ADDRESS(ADDR, SIZE)
|
#define CHECK_WRITE_ADDRESS(ADDR, SIZE)
|
||||||
#else /* FAILS or ABORTS */
|
#else /* FAILS or ABORTS */
|
||||||
#define CHECK_WRITE_ADDRESS(ADDR, SIZE) do { \
|
#define CHECK_WRITE_ADDRESS(ADDR, SIZE) do { \
|
||||||
@@ -112,7 +112,7 @@ static const spi_flash_guard_funcs_t *s_flash_guard_ops;
|
|||||||
return ESP_ERR_INVALID_ARG; \
|
return ESP_ERR_INVALID_ARG; \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
#endif // CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED
|
#endif // CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED
|
||||||
|
|
||||||
static __attribute__((unused)) bool is_safe_write_address(size_t addr, size_t size)
|
static __attribute__((unused)) bool is_safe_write_address(size_t addr, size_t size)
|
||||||
{
|
{
|
||||||
|
@@ -336,7 +336,7 @@ typedef bool (*spi_flash_is_safe_write_address_t)(size_t addr, size_t size);
|
|||||||
* - 'op_unlock' unlocks access to flash API internal data.
|
* - 'op_unlock' unlocks access to flash API internal data.
|
||||||
* These two functions are recursive and can be used around the outside of multiple calls to
|
* These two functions are recursive and can be used around the outside of multiple calls to
|
||||||
* 'start' & 'end', in order to create atomic multi-part flash operations.
|
* 'start' & 'end', in order to create atomic multi-part flash operations.
|
||||||
* 3) When CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is disabled, flash writing/erasing
|
* 3) When CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is disabled, flash writing/erasing
|
||||||
* API checks for addresses provided by user to avoid corruption of critical flash regions
|
* API checks for addresses provided by user to avoid corruption of critical flash regions
|
||||||
* (bootloader, partition table, running application etc.).
|
* (bootloader, partition table, running application etc.).
|
||||||
*
|
*
|
||||||
@@ -354,7 +354,7 @@ typedef struct {
|
|||||||
spi_flash_guard_end_func_t end; /**< critical section end function. */
|
spi_flash_guard_end_func_t end; /**< critical section end function. */
|
||||||
spi_flash_op_lock_func_t op_lock; /**< flash access API lock function.*/
|
spi_flash_op_lock_func_t op_lock; /**< flash access API lock function.*/
|
||||||
spi_flash_op_unlock_func_t op_unlock; /**< flash access API unlock function.*/
|
spi_flash_op_unlock_func_t op_unlock; /**< flash access API unlock function.*/
|
||||||
#if !CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED
|
#if !CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED
|
||||||
spi_flash_is_safe_write_address_t is_safe_write_address; /**< checks flash write addresses.*/
|
spi_flash_is_safe_write_address_t is_safe_write_address; /**< checks flash write addresses.*/
|
||||||
#endif
|
#endif
|
||||||
} spi_flash_guard_funcs_t;
|
} spi_flash_guard_funcs_t;
|
||||||
|
7
components/spi_flash/sdkconfig.rename
Normal file
7
components/spi_flash/sdkconfig.rename
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# sdkconfig replacement configurations for deprecated options formatted as
|
||||||
|
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
||||||
|
|
||||||
|
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS CONFIG_SPI_FLASH_DANGEROUS_WRITE
|
||||||
|
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS
|
||||||
|
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS
|
||||||
|
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED
|
@@ -4,11 +4,11 @@
|
|||||||
#include "esp_spi_flash.h"
|
#include "esp_spi_flash.h"
|
||||||
#include "esp_ota_ops.h"
|
#include "esp_ota_ops.h"
|
||||||
|
|
||||||
#if CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS || CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS
|
#if CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS || CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS
|
||||||
|
|
||||||
static const char *data = "blah blah blah";
|
static const char *data = "blah blah blah";
|
||||||
|
|
||||||
#if CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS
|
#if CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS
|
||||||
#define TEST_TAGS "[spi_flash]"
|
#define TEST_TAGS "[spi_flash]"
|
||||||
#else // ABORTS
|
#else // ABORTS
|
||||||
#define TEST_TAGS "[spi_flash][ignore]"
|
#define TEST_TAGS "[spi_flash][ignore]"
|
||||||
|
@@ -494,9 +494,9 @@ CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072
|
|||||||
CONFIG_SPI_FLASH_VERIFY_WRITE=
|
CONFIG_SPI_FLASH_VERIFY_WRITE=
|
||||||
CONFIG_SPI_FLASH_ENABLE_COUNTERS=
|
CONFIG_SPI_FLASH_ENABLE_COUNTERS=
|
||||||
CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y
|
CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y
|
||||||
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y
|
CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y
|
||||||
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS=
|
CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS=
|
||||||
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED=
|
CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=
|
||||||
|
|
||||||
#
|
#
|
||||||
# SPIFFS Configuration
|
# SPIFFS Configuration
|
||||||
|
@@ -19,7 +19,7 @@ CONFIG_MBEDTLS_HARDWARE_SHA=y
|
|||||||
CONFIG_SPI_FLASH_ENABLE_COUNTERS=y
|
CONFIG_SPI_FLASH_ENABLE_COUNTERS=y
|
||||||
CONFIG_ESP32_ULP_COPROC_ENABLED=y
|
CONFIG_ESP32_ULP_COPROC_ENABLED=y
|
||||||
CONFIG_ESP_TASK_WDT=n
|
CONFIG_ESP_TASK_WDT=n
|
||||||
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS=y
|
CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS=y
|
||||||
CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=7
|
CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=7
|
||||||
CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y
|
CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y
|
||||||
CONFIG_COMPILER_STACK_CHECK=y
|
CONFIG_COMPILER_STACK_CHECK=y
|
||||||
|
Reference in New Issue
Block a user