File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -1094,14 +1094,35 @@ config BOOT_FIH_PROFILE_DEFAULT_HIGH
10941094
10951095endmenu
10961096
1097+ config MCUBOOT_LOGICAL_SECTOR_SIZE
1098+ int "Size of a logical sector"
1099+ default 0
1100+ help
1101+ Set to 0 to use hardware sectors. Any other value here should be
1102+ aligned to hardware sectors in size and alignment.
1103+
1104+ config MCUBOOT_LOGICAL_SECTOR_SIZE_SET
1105+ bool
1106+ default y if MCUBOOT_LOGICAL_SECTOR_SIZE != 0
1107+
1108+ config MCUBOOT_LOGICAL_SECTOR_VALIDATION
1109+ bool "Validate logical sector layout"
1110+ default true if MCUBOOT_LOGICAL_SECTOR_SIZE != 0
1111+ depends on MCUBOOT_LOGICAL_SECTOR_SIZE_SET
1112+ help
1113+ Validation of logical sector size against hardware constrains.
1114+ Should be used to validate compile-time configuration against run-time
1115+ system.
1116+
10971117config MCUBOOT_DEVICE_SETTINGS
10981118 # Hidden selector for device-specific settings
10991119 bool
11001120 default y
11011121 # CPU options
11021122 select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
11031123 # Enable flash page layout if available
1104- select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
1124+ select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT && !MCUBOOT_LOGICAL_SECTOR_SIZE_SET
1125+ select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT && MCUBOOT_LOGICAL_SECTOR_VALIDATION
11051126 # Enable flash_map module as flash I/O back-end
11061127 select FLASH_MAP
11071128
Original file line number Diff line number Diff line change 357357# endif
358358#endif
359359
360+ /* If set to non-0 it will use logical sectors rather than querying
361+ * device for sector sizes. This slightly reduces code and RAM usage.
362+ * Note that the logical sector size has to be multiply of erase
363+ * sector size that is biggest for of all devices in the system.
364+ */
365+ #if defined(CONFIG_MCUBOOT_LOGICAL_SECTOR_SIZE )
366+ #define MCUBOOT_LOGICAL_SECTOR_SIZE CONFIG_MCUBOOT_LOGICAL_SECTOR_SIZE
367+ #endif
368+
369+ /* Enable to validate compile time logical sector setup vs the real device layout.
370+ * This increases the size of bootloader but is useful to check whether
371+ * selected logical sector size can be used with provided partitions
372+ * and devices they are placed on.
373+ * Once layout is tested, this option should be disabled, for production
374+ * devices, as it is pointless to re-validate non-changing setup on
375+ * every MCUboot run.
376+ */
377+ #if defined(CONFIG_MCUBOOT_LOGICAL_SECTOR_VALIDATION )
378+ #define MCUBOOT_LOGICAL_SECTOR_VALIDATION 1
379+ #endif
380+
360381#if defined(CONFIG_BOOT_MAX_IMG_SECTORS_AUTO ) && defined(MIN_SECTOR_COUNT )
361382
362383#define MCUBOOT_MAX_IMG_SECTORS MIN_SECTOR_COUNT
You can’t perform that action at this time.
0 commit comments