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_CALLBACKS 18 bool "Provide callback mechanism" 19 help 20 If selected the flash_simulator_set_callbacks is implemented allowing 21 to change write and erase functions behavior. 22 This option is meant to be used with tests when checking module reaction 23 to different write/erase errors in the memory. 24 25config FLASH_SIMULATOR_UNALIGNED_READ 26 bool "Allow read access to be unaligned" 27 default y 28 help 29 If selected, the reading operation does not check if access is aligned. 30 Disable this option only if you want to simulate 31 a specific FLASH interface that requires aligned read access. 32 33config FLASH_SIMULATOR_EXPLICIT_ERASE 34 bool "Program-erase device" 35 select FLASH_HAS_EXPLICIT_ERASE 36 default y 37 help 38 Explicit erase (non-erase-on-write) Flash, which is device that requires erase 39 to erase-value prior to write as it only allows to change bits from erase-value 40 to the opposite. 41 42config FLASH_SIMULATOR_RAMLIKE 43 bool 44 default y if !FLASH_SIMULATOR_EXPLICIT_ERASE 45 select FLASH_HAS_NO_EXPLICIT_ERASE 46 select FLASH_SIMULATOR_DOUBLE_WRITES 47 help 48 This is used for setting FLASH_HAS_NO_EXPLICIT_ERASE. 49 50config FLASH_SIMULATOR_DOUBLE_WRITES 51 bool "Allow program units to be programmed more than once" 52 help 53 If selected, writing to a non-erased program unit will succeed, otherwise, it will return an error. 54 Keep in mind that write operations can only change value of a bit from erase-value to the 55 opposite. 56 This option does not impact FLASH_SIMULATOR_RAMLIKE. 57 In case when FLASH_SIMULATOR_EXPLICIT_ERASE is selected multiple writes to the same bit 58 but only change from erase-value to opposite will be registered. 59 60config FLASH_SIMULATOR_SIMULATE_TIMING 61 bool "Hardware timing simulation" 62 63if FLASH_SIMULATOR_SIMULATE_TIMING 64 65config FLASH_SIMULATOR_MIN_READ_TIME_US 66 int "Minimum read time (µS)" 67 default 2 68 range 1 1000000 69 70config FLASH_SIMULATOR_MIN_WRITE_TIME_US 71 int "Minimum write time (µS)" 72 default 100 73 range 1 1000000 74 75config FLASH_SIMULATOR_MIN_ERASE_TIME_US 76 int "Minimum erase time (µS)" 77 default 2000 78 range 1 1000000 79 80endif 81 82config FLASH_SIMULATOR_STATS 83 bool "flash operations statistic" 84 default y 85 select STATS 86 select STATS_NAMES 87 help 88 Gather statistic measurement for flash simulator operations using the 89 statistic subsystem. 90 91config FLASH_SIMULATOR_STAT_PAGE_COUNT 92 int "Pages under statistic" 93 depends on FLASH_SIMULATOR_STATS 94 range 1 256 95 default 256 96 help 97 Only up to this number of beginning pages will be tracked 98 while catching dedicated flash operations and thresholds. 99 This number is not automatic because implementation uses 100 UNTIL_REPEAT() macro, which is limited to take explicitly 101 number of iterations. 102 This is why it's not possible to calculate the number of pages with 103 preprocessor using DT properties. 104 105endif # FLASH_SIMULATOR 106