Flash Partitions on Series 3 Devices#
This page describes the flash partitions on series 3 devices including:
how to configure code and data regions
how to account for the size of AXiP MAC data
how to determine the size requirements for the partitions to support bootloader, OTA, NVM3 and possibly different applications switched by bank
Bonded flash devices (2, 3, and 4 MB) come with a default partition. External flash devices will need to be partitioned before use. All devices can be repartitioned after the initial partitioning. The maximum flash size is 128 MB, but due to the address space of the SE, the maximum space that is usable by the bootloader, application, and data is 112 MB
For more information on the security aspects of flash partitioning and AXiP and EXiP, see AN1509: Series 3 AXiP.
SE#
The SE is stored in flash, in the first 192kB of the device. Due to addressing, it takes the first 16 MB of address space on flash. The SE can be upgraded, but the SE code space is inaccessible to firmware.
Bootloader#
The bootloader is stored in the first region of flash, typically 32 kB. The bootloader can be upgraded. The bootloader space defaults to AXiP, but can be EXiP or unprotected. Bootloader space is erasable in 32 kB logical pages. With AXiP, the 32 kB logical space will take 36 kB of physical space.
Application#
Applications can be stored in any other code region. Applications default to AXiP but can be EXiP or unprotected. AXiP takes more space due to the MAC data. Every 32 bytes of code require an additional 4 bytes of MAC data. The partition must be bigger for it, but the logical addressing does not map the MAC data. MAC data cannot be read from a flash address. Application space is erasable in 32 kB pages.
Data#
Data space is not a code region. Data is not encrypted or authenticated by the storage, but can be encrypted by other means (NVM3 or encrypted GBL). The data space includes OTA slots, and can include multiple OTA slots. The OTA size needs to be enough to handle SE upgrades, bootloader upgrades, and SE upgrades. It is possible that not all 3 will be stored in a single OTA slot, and upgrades will be done sequentially. To upgrade the bootloader, there needs to be a 32 kB staging space for the bootloader image to be decrypted and verified, as the SE currently does not support decryption and verification on the fly. Data can be erased in 4 kB pages. Compression of the OTA images can reduce the amount of space needed for each slot.
The data space can contain an NVM3 instance or multiple instances. These will be located after the OTA data. NVM3 instances must use at least 3 flash pages. For more information, see the NVM3 documentation.
Configuring regions#
The default configuration for bonded flash devices is two AiXP enabled regions. The typical use case will be one region for the bootloader and one for the application. Devices using external flash will have to be configured before use. The code regions are contiguous, and the data region is all the flash not allocated to the code regions.
Using Simplicity Commander is the most likely way to configure flash partitions. Commander will read the current configuration with the commander security readregionconfig
and write with the command commander security writeregionconfig
. The config file is stored in YAML format. For more information, see the Simplicity Commander Documentation or AN1509: Series 3 AXiP.
SE API functions can be called from firmware to change partitioning, but we do not recommend OTA updates to partitioning due to the inability to recover if there is an issue. See the SE manager documentation for more information.
Configuring regions in a Simplicity Studio Project#
Simplicity Studio does not currently have tools that support managing the project's code region.
To configure a Simplicity Studio project to fit in the appropriate code region, do the following:
Edit the .slcp file with a text editor or by right clicking the slcp and selecting Open With > Plain Text Editor.
Add the code regions as template contributions. The sizes should match the configuration returned by Simplicity Commander: template_contribution:
- name: code_region0_size
value: 32768
- name: code_region1_size
value: 1048576
In Simplicity Studio, close and reopen the project
In the Overview tab of the project, right click the three dots to the right of the Project Details tile and select Force Generation.