|  | # ST Microelectronics STM32 MCUs Flash driver config | 
|  |  | 
|  | # Copyright (c) 2016 RnDity Sp. z o.o. | 
|  | # Copyright (c) 2017 BayLibre, SAS | 
|  | # Copyright (c) 2022 Linaro Limited | 
|  | # Copyright (c) 2023 Google Inc | 
|  | # SPDX-License-Identifier: Apache-2.0 | 
|  |  | 
|  | config STM32_MEMMAP | 
|  | bool "NOR Flash in MemoryMapped" | 
|  | depends on DT_HAS_ST_STM32_QSPI_NOR_ENABLED || \ | 
|  | DT_HAS_ST_STM32_OSPI_NOR_ENABLED || \ | 
|  | DT_HAS_ST_STM32_XSPI_NOR_ENABLED | 
|  | help | 
|  | This option enables the MemoryMapped mode for the external NOR flash | 
|  | mounted on STM32 boards. | 
|  |  | 
|  | menuconfig SOC_FLASH_STM32 | 
|  | bool "STM32 flash driver" | 
|  | depends on DT_HAS_ST_STM32_FLASH_CONTROLLER_ENABLED | 
|  | select FLASH_HAS_DRIVER_ENABLED | 
|  | default y | 
|  | select FLASH_HAS_PAGE_LAYOUT | 
|  | select FLASH_HAS_EXPLICIT_ERASE | 
|  | select MPU_ALLOW_FLASH_WRITE if ARM_MPU | 
|  | select USE_STM32_HAL_FLASH if BT_STM32WBA | 
|  | select USE_STM32_HAL_FLASH_EX if BT_STM32WBA | 
|  | help | 
|  | Enable flash driver for STM32 series | 
|  |  | 
|  | if SOC_FLASH_STM32 | 
|  |  | 
|  | config FLASH_STM32_WRITE_PROTECT | 
|  | bool "Extended operation for flash write protection control" | 
|  | depends on SOC_SERIES_STM32F4X || SOC_SERIES_STM32H7X | 
|  | select FLASH_HAS_EX_OP | 
|  | default n | 
|  | help | 
|  | Enables flash extended operation for enabling/disabling flash write | 
|  | protection. | 
|  |  | 
|  | config FLASH_STM32_WRITE_PROTECT_DISABLE_PREVENTION | 
|  | bool "Prevent from disabling flash write protection" | 
|  | depends on FLASH_STM32_WRITE_PROTECT | 
|  | default n | 
|  | help | 
|  | If enabled, all requests to disable flash write protection will be | 
|  | blocked. | 
|  |  | 
|  | config FLASH_STM32_READOUT_PROTECTION | 
|  | bool "Extended operation for flash readout protection control" | 
|  | depends on SOC_SERIES_STM32F4X || \ | 
|  | SOC_SERIES_STM32F7X || \ | 
|  | SOC_SERIES_STM32G0X || \ | 
|  | SOC_SERIES_STM32G4X || \ | 
|  | SOC_SERIES_STM32H7X || \ | 
|  | SOC_SERIES_STM32L4X | 
|  | select FLASH_HAS_EX_OP | 
|  | default n | 
|  | help | 
|  | Enables flash extended operation for enabling/disabling flash readout | 
|  | protection. | 
|  |  | 
|  | config FLASH_STM32_READOUT_PROTECTION_DISABLE_ALLOW | 
|  | bool "Allow disabling readout protection" | 
|  | depends on FLASH_STM32_READOUT_PROTECTION | 
|  | default n | 
|  | help | 
|  | With this option enabled it will be possible to disable readout | 
|  | protection. On STM32 devices it will trigger flash mass erase! | 
|  |  | 
|  | config FLASH_STM32_READOUT_PROTECTION_PERMANENT_ALLOW | 
|  | bool "Allow enabling readout protection permanently" | 
|  | depends on FLASH_STM32_READOUT_PROTECTION | 
|  | default n | 
|  | help | 
|  | With this option enabled it will be possible to enable readout | 
|  | protection permanently. | 
|  |  | 
|  | config FLASH_STM32_BLOCK_REGISTERS | 
|  | bool "Extended operation for blocking option and control registers" | 
|  | select FLASH_HAS_EX_OP | 
|  | default n | 
|  | help | 
|  | Enables flash extended operations that can be used to disable access | 
|  | to option and control registers until reset. Disabling access to these | 
|  | registers improves system security, because flash content (or | 
|  | protection settings) can't be changed even when exploit was found. | 
|  |  | 
|  | config FLASH_STM32_OPTION_BYTES | 
|  | bool "Extended operation for option bytes access" | 
|  | select FLASH_HAS_EX_OP | 
|  | default n | 
|  | help | 
|  | Enables flash extended operations that can be used to read and write | 
|  | STM32 option bytes. | 
|  |  | 
|  | config USE_MICROCHIP_QSPI_FLASH_WITH_STM32 | 
|  | bool "Include patch for Microchip qspi flash when running with stm32" | 
|  | depends on DT_HAS_ST_STM32_QSPI_NOR_ENABLED | 
|  | help | 
|  | Set to use Microchip qspi flash memories which supports | 
|  | the Global Block Protection Unlock instruction (ULBPR - 98H), | 
|  | and write with SPI_NOR_CMD_PP_1_1_4 on 4 lines | 
|  |  | 
|  | endif # SOC_FLASH_STM32 |