Partition Layout
Overview
Zephyr provides a flexible scheme to define non-volatile memory partitions for application and subsystem use. The partitions define image and data storage. Partitions defined in a board’s final device tree use Atmosic-provided DTSI files, overlays and headers. Some partitions are configurable through DTS flags passed during the application build process. When dealing with multiple images to run on a given board, all images must have the same partition layout view. The DTS flags must be passed to each build to ensure that the layout is consistent for all images.
The following DTS flags can resize pre-defined partitions
DTS Flag |
Description |
|---|---|
ATM_SPE_SIZE |
Set Secure Application partition size |
ATM_FACTORY_SIZE |
Set Factory Data partition size |
ATM_STORAGE_SIZE |
Set Settings database partition size |
FLASH_SIZE |
Total flash size (stacked or external) |
ATM_MCUBOOT_SIZE |
MCUboot partition size |
ATM_MCUBOOT_SCRATCH_SIZE |
MCUboot scratch partition size |
ATM_FAST_CODE_SIZE |
Fast code partition size (flash XIP with split images mode only) |
Example of passing DTS flags to west command
west build ... -DDTS_EXTRA_CPPFLAGS="-DFLASH_SIZE=0x100000;-DATM_MCUBOOT_SCRATCH_SIZE=0" ...
For XIP (Execute In Place) configurations, the ATM_APP_FLASH_XIP flag enables flash XIP with split images mode
west build ... -DDTS_EXTRA_CPPFLAGS="-DATM_APP_FLASH_XIP;-DFLASH_SIZE=0x300000" ...
During the application build process a non-volatile storage layout summary is auto generated in the build folder. This file layout_info file graphically shows memory partitioning in RRAM and Flash regions and is generated based on the partition_info.map file.
Standard Layout Example
Following layout example is generated during application build using ATM34/e SOC + MCUboot + staging partition and MCUboot scratch partition in external flash
TOTAL_RRAM EXT_FLASH
*────────────────────* 0x90000 *────────────────────* 0x276000
│░░░░░░░░░░░░░░░░░░░░│ │░░░░░░░░░░░░░░░░░░░░│
│░░░░SEC SIDELOAD░░░░│(0x00100 0K) │░░░EXT FLASH OTA░░░░│(0x72000 456K)
│░░░░░░░░KEYS░░░░░░░░│ │░░░░░░STAGING░░░░░░░│
│░░░░░░░░░░░░░░░░░░░░│ │░░░░░░░░░░░░░░░░░░░░│
├────────────────────┤ 0x8ff00 ├────────────────────┤ 0x204000
│░░░░░░░░░░░░░░░░░░░░│ │░░░░░░░░░░░░░░░░░░░░│
│░░░░░SEC CNTRS░░░░░░│(0x00010 0K) │░░░░░EXT FLASH░░░░░░│(0x04000 16K)
│░░░░░░░░░░░░░░░░░░░░│ │░░MCUBOOT SCRATCH░░░│
├────────────────────┤ 0x8fef0 │░░░░░░░░░░░░░░░░░░░░│
│░░░░░░░░░░░░░░░░░░░░│ *────────────────────* 0x200000
│░░░░░░SEC JRNL░░░░░░│(0x006f0 1K)
│░░░░░░░░░░░░░░░░░░░░│
├────────────────────┤ 0x8f800
│░░░░░░░░░░░░░░░░░░░░│
│░░░░STORAGE DATA░░░░│(0x00800 2K)
│░░░░░░░░░░░░░░░░░░░░│
├--------------------┤ 0x8e800
│░░░░░░░░░░░░░░░░░░░░│
│░░░░FACTORY DATA░░░░│(0x00800 2K)
│░░░░░░░░░░░░░░░░░░░░│
├--------------------┤ 0x8e000
│░░░░░░░░░░░░░░░░░░░░│
│░░░SLOT0 TRAILER░░░░│(0x01000 4K)
│░░░░░░░░░░░░░░░░░░░░│
├--------------------┤ 0x8d000
│░░░░░░░░░░░░░░░░░░░░│
│░░░░░░░NS APP░░░░░░░│(0x6b000 428K)
│░░░░░░░░░░░░░░░░░░░░│
├--------------------┤ 0x22000
│░░░░░░░░░░░░░░░░░░░░│
│░░░░░░░░SPE░░░░░░░░░│(0x06000 24K)
│░░░░░░░░░░░░░░░░░░░░│
├--------------------┤ 0x1c000
│░░░░░░░░░░░░░░░░░░░░│
│░░░░░░MCUBOOT░░░░░░░│(0x0c000 48K)
│░░░░░░░░░░░░░░░░░░░░│
*────────────────────* 0x10000
Flash XIP with Split Images Layout Examples
When using flash XIP with split images mode (ATM_APP_FLASH_XIP), the partition layout changes to support
a split image configuration where security, power, and performance critical code continues to execute
in on-chip RRAM and the remaining user application logic executes from external flash memory.
Flash XIP with Split Images and MCUboot Configuration
The following example shows ATM34/e SOC with MCUboot + flash XIP with split images configuration
TOTAL_RRAM EXT_FLASH
*____________________* 0x90000 *____________________* 0x300000
| | | |
| SEC SIDELOAD |(0x00100 0K) | EXT FLASH NSPE |(0x45000 276K)
| KEYS | | STAGING |
| | | |
|____________________| 0x8ff00 |____________________| 0x2bb000
| | | |
| SEC CNTRS |(0x00010 0K) | EXT FLASH OTA |(0x72000 456K)
| | | STAGING |
|____________________| 0x8fef0 | |
| | |____________________| 0x249000
| SEC JRNL |(0x006f0 1K) | |
| | | EXT FLASH |(0x04000 16K)
|____________________| 0x8f800 | MCUBOOT SCRATCH |
| | | |
| STORAGE DATA |(0x00800 2K) |____________________| 0x245000
| | | |
|--------------------| 0x8e800 | NS APP |(0x45000 276K)
| | | |
| FACTORY DATA |(0x00800 2K) *____________________* 0x200000
| |
|--------------------| 0x8e000
| |
| SLOT0 TRAILER |(0x01000 4K)
| |
|--------------------| 0x8d000
| |
| FAST CODE |(0x6b000 428K)
| |
|--------------------| 0x22000
| |
| SPE |(0x06000 24K)
| |
|--------------------| 0x1c000
| |
| MCUBOOT |(0x0c000 48K)
| |
*____________________* 0x10000
Flash XIP with Split Images without MCUboot Configuration
The following example shows ATM34/e SOC with flash XIP with split images but no MCUboot configuration. In this mode, the application runs directly without bootloader support
TOTAL_RRAM EXT_FLASH
*____________________* 0x90000 *____________________* 0x300000
| | | |
| SEC SIDELOAD |(0x00100 0K) | NS APP |(0x100000 1024K)
| KEYS | | |
| | *____________________* 0x200000
|____________________| 0x8ff00
| |
| SEC CNTRS |(0x00010 0K)
| |
|____________________| 0x8fef0
| |
| SEC JRNL |(0x006f0 1K)
| |
|____________________| 0x8f800
| |
| STORAGE DATA |(0x00800 2K)
| |
|--------------------| 0x8f000
| |
| FACTORY DATA |(0x00800 2K)
| |
|--------------------| 0x8e800
| |
| FAST CODE |(0x78800 482K)
| |
|--------------------| 0x16000
| |
| SPE |(0x06000 24K)
| |
*____________________* 0x10000
In flash XIP with split images mode, the application is split between RRAM and external flash:
RRAM: Contains SPE, fast code (performance-critical code), and data partitions
External Flash: Contains the user application code
Fast Code: Includes Zephyr kernel, subsystems, C-runtime, HAL drivers and BLE link controller stacks
MCUboot Support: When enabled, provides multi-image upgrade with staging partitions and scratch partition in external flash
For detailed information on flash XIP with split images configuration, multi-image support, building, and version dependencies, refer to Flash XIP with Split Images.
GLOSSARY
ATMWSTK: Atmosic Bluetooth Stack (only for certain platform)
EXT_FLASH: External/Stack flash memory
EXT FLASH NSPE STAGING: Staging area for NSPE image updates (flash XIP with split images + MCUboot mode)
EXT FLASH OTA STAGING: Staging area for OTA image updates (flash XIP with split images + MCUboot mode)
FACTORY DATA: Application specific data partition using NVS. This data partition is read-only and write protected
FAST CODE: Performance-critical code partition in RRAM (flash XIP with split images mode only). Contains Zephyr kernel, subsystems, C-runtime, HAL drivers and BLE link controller stacks
MCUBOOT: MCUboot bootloader
MCUBOOT SCRATCH: Scratch partition storage used by MCUboot. Can be located in RRAM (ATM33 only) or in external Flash (all products)
NS APP: Non Secure Application code space (TrustZone). In flash XIP with split images mode, this runs from external flash
OTA STAGING: Storage for downloaded image (merged/signed SPE and NS APP binary) Staging area can be located in RRAM (ATM33 only) or in external flash (all products)
SEC JRNL: Secure journal.
SEC CNTRS: Secure counters.
SEC SIDELOAD KEYS: Area to store unique device specific side loaded keys
SLOT0/1/2/3: MCUboot image slots for multi-image upgrade support (flash XIP with split images mode)
SPE: Secure Application code space (TrustZone). Always runs from RRAM for security
SLOT0 TRAILER: Image trailer reservation used by MCUBOOT. Trailer covers Secure as well as non Secure application code space
STORAGE DATA: Partition used to hold Zephyr settings read/write database
Storage and Factory Data
Subpages: