1# Flash simulator config
2
3# Copyright (c) 2018 Nordic Semiconductor ASA
4# SPDX-License-Identifier: Apache-2.0
5
6menuconfig FLASH_SIMULATOR
7	bool "Flash simulator"
8	default y
9	depends on DT_HAS_ZEPHYR_SIM_FLASH_ENABLED
10	select FLASH_HAS_PAGE_LAYOUT
11	select FLASH_HAS_DRIVER_ENABLED
12	help
13	  Enable the flash simulator.
14
15if FLASH_SIMULATOR
16
17config FLASH_SIMULATOR_UNALIGNED_READ
18	bool "Allow read access to be unaligned"
19	default y
20	help
21	 If selected, the reading operation does not check if access is aligned.
22	 Disable this option only if you want to simulate
23	 a specific FLASH interface that requires aligned read access.
24
25config FLASH_SIMULATOR_DOUBLE_WRITES
26	bool "Allow program units to be programmed more than once"
27	help
28	 If selected, writing to a non-erased program unit will succeed, otherwise, it will return an error.
29	 Keep in mind that write operations can only pull bits to zero, regardless.
30
31config FLASH_SIMULATOR_SIMULATE_TIMING
32	bool "Hardware timing simulation"
33
34if FLASH_SIMULATOR_SIMULATE_TIMING
35
36config FLASH_SIMULATOR_MIN_READ_TIME_US
37	int "Minimum read time (µS)"
38	default 2
39	range 1 1000000
40
41config FLASH_SIMULATOR_MIN_WRITE_TIME_US
42	int "Minimum write time (µS)"
43	default 100
44	range 1 1000000
45
46config FLASH_SIMULATOR_MIN_ERASE_TIME_US
47	int "Minimum erase time (µS)"
48	default 2000
49	range 1 1000000
50
51endif
52
53config FLASH_SIMULATOR_STATS
54	bool "flash operations statistic"
55	default y
56	select STATS
57	select STATS_NAMES
58	help
59	  Gather statistic measurement for flash simulator operations using the
60	  statistic subsystem.
61
62config FLASH_SIMULATOR_STAT_PAGE_COUNT
63	int "Pages under statistic"
64	depends on FLASH_SIMULATOR_STATS
65	range 1 256
66	default 256
67	help
68	  Only up to this number of beginning pages will be tracked
69	  while catching dedicated flash operations and thresholds.
70	  This number is not automatic because implementation uses
71	  UNTIL_REPEAT() macro, which is limited to take explicitly
72	  number of iterations.
73	  This is why it's not possible to calculate the number of pages with
74	  preprocessor using DT properties.
75
76endif # FLASH_SIMULATOR
77