#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

menuconfig SUIT_STORAGE
	bool "Enable SUIT storage module"
	depends on ZCBOR
	depends on ZCBOR_CANONICAL
	depends on SUIT_METADATA
	depends on SUIT_UTILS
	depends on FLASH
	depends on SUIT_PLATFORM_VARIANT_SDFW

if SUIT_STORAGE

choice SUIT_STORAGE_LAYOUT
	prompt "MCU-specific layout of the SUIT storage"
	default SUIT_STORAGE_LAYOUT_NRF54H20 if SOC_SERIES_NRF54HX
	default SUIT_STORAGE_LAYOUT_TEST if !SOC_SERIES_NRF54HX

config SUIT_STORAGE_LAYOUT_NRF54H20
	bool "nRF54H20"
	depends on SUIT_CRYPTO
	select PSA_WANT_ALG_SHA_256

config SUIT_STORAGE_LAYOUT_TEST
	bool "tests"
	help
	  Configuration to be used for running SUIT tests

endchoice # SUIT_STORAGE_LAYOUT

config SUIT_STORAGE_N_UPDATE_REGIONS
	int "Maximum number of memory regions, describing the update candidate"
	default 7
	help
	  The memory region may describe SUIT envelope as well as the SUIT cache.

config SUIT_STORAGE_N_ENVELOPES
	int "Number of envelopes, possible to store in SUIT storage"
	default 11 if SOC_SERIES_NRF54HX
	default 5 if SOC_NRF52840
	default 5 if SOC_POSIX
	help
	  Since it is not supported to reserve more memory after the device
	  is deployed, use larger value than it is necessary.

	  For nRF54H20 the following envelopes may be defined:
	    - Nordic Top
	    - SecDom: firmware + recovery
	    - SysCtlr: firmware
	    - Radio: recovery
	    * Radio: firmware (A)
	    * Radio: firmware (B)
	    - ROOT
	    - Application: recovery
	    - Application: firmware (A)
	    - Application: firmware (B)
	    * Application: user data

	  Manifests marked with (*) are not available in legacy SUIT storage format.

	  For debug and test platforms (POSIX, nRF52840) the following envelopes may be defined:
	    - ROOT
	    - Application: recovery
	    - Application: firmware (A)
	    - Application: firmware (B)
	    - Application: user data

config SUIT_STORAGE_ENVELOPE_SIZE
	int "The maximum size of envelope that can be stored in a single SUIT storage slot"
	default 2048

config SUIT_STORAGE_CONFIG_SIZE
	int "The size of the SUIT configuration area, stored inside the SUIT storage partition"
	default 128

endif # SUIT_STORAGE
