1# ST Microelectronics STM32 MCUs Flash driver config
2
3# Copyright (c) 2016 RnDity Sp. z o.o.
4# Copyright (c) 2017 BayLibre, SAS
5# Copyright (c) 2022 Linaro Limited
6# Copyright (c) 2023 Google Inc
7# SPDX-License-Identifier: Apache-2.0
8
9config SOC_FLASH_STM32
10	bool "STM32 flash driver"
11	depends on DT_HAS_ST_STM32_FLASH_CONTROLLER_ENABLED
12	select FLASH_HAS_DRIVER_ENABLED
13	default y
14	select FLASH_PAGE_LAYOUT
15	select FLASH_HAS_PAGE_LAYOUT
16	select FLASH_HAS_EX_OP if SOC_SERIES_STM32F4X
17	select MPU_ALLOW_FLASH_WRITE if ARM_MPU
18	help
19	  Enable flash driver for STM32 series
20
21if SOC_FLASH_STM32
22
23config FLASH_STM32_WRITE_PROTECT
24	bool "Extended operation for flash write protection control"
25	depends on SOC_SERIES_STM32F4X
26	default n
27	help
28	  Enables flash extended operation for enabling/disabling flash write
29	  protection.
30
31config FLASH_STM32_WRITE_PROTECT_DISABLE_PREVENTION
32	bool "Prevent from disabling flash write protection"
33	depends on FLASH_STM32_WRITE_PROTECT
34	default n
35	help
36	  If enabled, all requests to disable flash write protection will be
37	  blocked.
38
39config FLASH_STM32_READOUT_PROTECTION
40	bool "Extended operation for flash readout protection control"
41	depends on SOC_SERIES_STM32F4X
42	default n
43	help
44	  Enables flash extended operation for enabling/disabling flash readout
45	  protection.
46
47config FLASH_STM32_READOUT_PROTECTION_DISABLE_ALLOW
48	bool "Allow disabling readout protection"
49	depends on FLASH_STM32_READOUT_PROTECTION
50	default n
51	help
52	  With this option enabled it will be possible to disable readout
53	  protection. On STM32 devices it will trigger flash mass erase!
54
55config FLASH_STM32_READOUT_PROTECTION_PERMANENT_ALLOW
56	bool "Allow enabling readout protection permanently"
57	depends on FLASH_STM32_READOUT_PROTECTION
58	default n
59	help
60	  With this option enabled it will be possible to enable readout
61	  protection permanently.
62
63config FLASH_STM32_BLOCK_REGISTERS
64	bool "Extended operation for blocking option and control registers"
65	default n
66	help
67	  Enables flash extended operations that can be used to disable access
68	  to option and control registers until reset. Disabling access to these
69	  registers improves system security, because flash content (or
70	  protection settings) can't be changed even when exploit was found.
71
72endif # SOC_FLASH_STM32
73