|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2018-2020 Arm Limited. All rights reserved. |
| 2 | + * Copyright (c) 2018-2021 Arm Limited. All rights reserved. |
| 3 | + * Copyright (c) 2020 Cypress Semiconductor Corporation. All rights reserved. |
3 | 4 | *
|
4 | 5 | * SPDX-License-Identifier: Apache-2.0
|
5 | 6 | *
|
|
19 | 20 | #ifndef __FLASH_LAYOUT_H__
|
20 | 21 | #define __FLASH_LAYOUT_H__
|
21 | 22 |
|
22 |
| -/* Flash layout on Musca-B1 with BL2(single image boot, boot from eFlash 0): |
| 23 | +/* Flash layout on Musca-B1 with BL2 (multiple image boot, boot from eFlash 0): |
| 24 | + * |
| 25 | + * 0x0A00_0000 BL2 - MCUBoot (128 KB) |
| 26 | + * 0x0A02_0000 Secure image primary slot (384 KB) |
| 27 | + * 0x0A08_0000 Non-secure image primary slot (512 KB) |
| 28 | + * 0x0A10_0000 Secure image secondary slot (384 KB) |
| 29 | + * 0x0A16_0000 Non-secure image secondary slot (512 KB) |
| 30 | + * 0x0A1E_0000 Scratch area (64 KB) |
| 31 | + * 0x0A1F_0000 Internal Trusted Storage Area (32 KB) |
| 32 | + * 0x0A1F_8000 NV counters area (16 KB) |
| 33 | + * 0x0A1F_C000 Unused (32 KB) |
| 34 | + * |
| 35 | + * Flash layout on Musca-B1 with BL2 (single image boot): |
23 | 36 | *
|
24 | 37 | * 0x0A00_0000 BL2 - MCUBoot (128 KB)
|
25 | 38 | * 0x0A02_0000 Primary image area (896 KB):
|
|
28 | 41 | * 0x0A10_0000 Secondary image area (896 KB):
|
29 | 42 | * 0x0A10_0000 Secure image secondary (384 KB)
|
30 | 43 | * 0x0A16_0000 Non-secure image secondary (512 KB)
|
31 |
| - * 0x0A1E_0000 Internal Trusted Storage Area (32 KB) |
32 |
| - * 0x0A1E_8000 NV counters area (16 KB) |
| 44 | + * 0x0A1E_0000 Scratch area (64 KB) |
| 45 | + * 0x0A1F_0000 Internal Trusted Storage Area (32 KB) |
| 46 | + * 0x0A1F_8000 NV counters area (16 KB) |
| 47 | + * 0x0A1F_C000 Unused (32 KB) |
33 | 48 | *
|
34 | 49 | * Note: As eFlash is written at runtime, the eFlash driver code is placed
|
35 |
| - * in code sram to avoid any interference. |
| 50 | + * in code SRAM to avoid any interference. |
36 | 51 | *
|
37 | 52 | * Flash layout on Musca-B1 without BL2:
|
38 | 53 | * 0x0A00_0000 Secure image
|
39 |
| - * 0x0A07_0000 Non-secure image |
| 54 | + * 0x0A08_0000 Non-secure image |
40 | 55 | *
|
41 | 56 | * QSPI Flash layout
|
42 |
| - * 0x0000_0000 Secure Storage Area (20 KB) |
| 57 | + * 0x0000_0000 Protected Storage Area (20 KB) |
43 | 58 | */
|
44 | 59 |
|
45 | 60 | /* This header file is included from linker scatter file as well, where only a
|
|
88 | 103 | #define FLASH_AREA_2_OFFSET (FLASH_AREA_0_OFFSET + FLASH_AREA_0_SIZE)
|
89 | 104 | #define FLASH_AREA_2_SIZE (FLASH_S_PARTITION_SIZE + \
|
90 | 105 | FLASH_NS_PARTITION_SIZE)
|
91 |
| -/* Not used, only the Non-swapping firmware upgrade operation |
92 |
| - * is supported on Musca-B1. |
93 |
| - */ |
| 106 | +/* Scratch area */ |
94 | 107 | #define FLASH_AREA_SCRATCH_ID (FLASH_AREA_2_ID + 1)
|
95 | 108 | #define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_2_OFFSET + FLASH_AREA_2_SIZE)
|
96 |
| -#define FLASH_AREA_SCRATCH_SIZE (0) |
| 109 | +#define FLASH_AREA_SCRATCH_SIZE (4 * FLASH_AREA_IMAGE_SECTOR_SIZE) |
| 110 | +/* The maximum number of status entries supported by the bootloader. */ |
| 111 | +#define MCUBOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \ |
| 112 | + FLASH_NS_PARTITION_SIZE) / \ |
| 113 | + FLASH_AREA_SCRATCH_SIZE) |
97 | 114 | /* Maximum number of image sectors supported by the bootloader. */
|
98 | 115 | #define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
|
99 | 116 | FLASH_NS_PARTITION_SIZE) / \
|
|
115 | 132 | #define FLASH_AREA_3_ID (FLASH_AREA_2_ID + 1)
|
116 | 133 | #define FLASH_AREA_3_OFFSET (FLASH_AREA_2_OFFSET + FLASH_AREA_2_SIZE)
|
117 | 134 | #define FLASH_AREA_3_SIZE (FLASH_NS_PARTITION_SIZE)
|
118 |
| -/* Not used, only the Non-swapping firmware upgrade operation |
119 |
| - * is supported on Musca-B1. |
120 |
| - */ |
| 135 | +/* Scratch area */ |
121 | 136 | #define FLASH_AREA_SCRATCH_ID (FLASH_AREA_3_ID + 1)
|
122 | 137 | #define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_3_OFFSET + FLASH_AREA_3_SIZE)
|
123 |
| -#define FLASH_AREA_SCRATCH_SIZE (0) |
| 138 | +#define FLASH_AREA_SCRATCH_SIZE (4 * FLASH_AREA_IMAGE_SECTOR_SIZE) |
| 139 | +/* The maximum number of status entries supported by the bootloader. */ |
| 140 | +#define MCUBOOT_STATUS_MAX_ENTRIES (FLASH_MAX_PARTITION_SIZE / \ |
| 141 | + FLASH_AREA_SCRATCH_SIZE) |
124 | 142 | /* Maximum number of image sectors supported by the bootloader. */
|
125 | 143 | #define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
|
126 | 144 | FLASH_AREA_IMAGE_SECTOR_SIZE)
|
127 | 145 | #else /* MCUBOOT_IMAGE_NUMBER > 2 */
|
128 | 146 | #error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
|
129 | 147 | #endif /* MCUBOOT_IMAGE_NUMBER */
|
130 | 148 |
|
131 |
| -/* Not used, only the Non-swapping firmware upgrade operation |
132 |
| - * is supported on Musca-B1. The maximum number of status entries |
133 |
| - * supported by the bootloader. |
134 |
| - */ |
135 |
| -#define MCUBOOT_STATUS_MAX_ENTRIES (0) |
136 |
| - |
137 | 149 | /* Internal Trusted Storage (ITS) Service definitions (32 KB) */
|
138 | 150 | #define FLASH_ITS_AREA_OFFSET (FLASH_AREA_SCRATCH_OFFSET + \
|
139 | 151 | FLASH_AREA_SCRATCH_SIZE)
|
|
152 | 164 | SECURE_IMAGE_MAX_SIZE)
|
153 | 165 | #define NON_SECURE_IMAGE_MAX_SIZE FLASH_NS_PARTITION_SIZE
|
154 | 166 |
|
155 |
| -/* Secure Storage (SST) Service definitions size is 20 KB. */ |
| 167 | +/* Protected Storage (PS) Service definitions size is 20 KB. */ |
156 | 168 | /* Same as MUSCA_B1_QSPI_FLASH_S_BASE */
|
157 | 169 | #define QSPI_FLASH_BASE_ADDRESS (0x10000000)
|
158 |
| -#define FLASH_SST_AREA_OFFSET (0x0) |
159 |
| -#define FLASH_SST_AREA_SIZE (5 * QSPI_FLASH_AREA_IMAGE_SECTOR_SIZE) |
| 170 | +#define FLASH_PS_AREA_OFFSET (0x0) |
| 171 | +#define FLASH_PS_AREA_SIZE (5 * QSPI_FLASH_AREA_IMAGE_SECTOR_SIZE) |
160 | 172 |
|
161 | 173 | /* Flash device name used by BL2
|
162 | 174 | * Name is defined in flash driver file: Driver_Flash.c
|
163 | 175 | */
|
164 | 176 | #define FLASH_DEV_NAME Driver_EFLASH0
|
165 | 177 |
|
166 |
| -/* Secure Storage (SST) Service definitions |
| 178 | +/* Protected Storage (PS) Service definitions |
167 | 179 | * Note: Further documentation of these definitions can be found in the
|
168 |
| - * TF-M SST Integration Guide. |
| 180 | + * TF-M PS Integration Guide. |
169 | 181 | */
|
170 |
| -#define SST_FLASH_DEV_NAME Driver_QSPI_FLASH0 |
| 182 | +#define PS_FLASH_DEV_NAME Driver_QSPI_FLASH0 |
171 | 183 |
|
172 | 184 | /* In this target the CMSIS driver requires only the offset from the base
|
173 | 185 | * address instead of the full memory address.
|
174 | 186 | */
|
175 |
| -#define SST_FLASH_AREA_ADDR FLASH_SST_AREA_OFFSET |
176 |
| -/* Dedicated flash area for SST */ |
177 |
| -#define SST_FLASH_AREA_SIZE FLASH_SST_AREA_SIZE |
178 |
| -#define SST_SECTOR_SIZE QSPI_FLASH_AREA_IMAGE_SECTOR_SIZE |
179 |
| -/* Number of SST_SECTOR_SIZE per block */ |
180 |
| -#define SST_SECTORS_PER_BLOCK (0x1) |
| 187 | +#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET |
| 188 | +/* Dedicated flash area for PS */ |
| 189 | +#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE |
| 190 | +#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE |
| 191 | +#define PS_SECTOR_SIZE QSPI_FLASH_AREA_IMAGE_SECTOR_SIZE |
| 192 | +/* Number of PS_SECTOR_SIZE per block */ |
| 193 | +#define PS_SECTORS_PER_BLOCK (0x1) |
181 | 194 | /* Specifies the smallest flash programmable unit in bytes */
|
182 |
| -#define SST_FLASH_PROGRAM_UNIT (0x4) |
183 |
| -/* The maximum asset size to be stored in the SST area */ |
184 |
| -#define SST_MAX_ASSET_SIZE (2048) |
185 |
| -/* The maximum number of assets to be stored in the SST area */ |
186 |
| -#define SST_NUM_ASSETS (10) |
| 195 | +#define PS_FLASH_PROGRAM_UNIT (0x1) |
187 | 196 |
|
188 | 197 | /* Internal Trusted Storage (ITS) Service definitions
|
189 | 198 | * Note: Further documentation of these definitions can be found in the
|
|
199 | 208 | #define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
|
200 | 209 | /* Dedicated flash area for ITS */
|
201 | 210 | #define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
|
| 211 | +#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE |
202 | 212 | #define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
|
203 | 213 | /* Number of ITS_SECTOR_SIZE per block */
|
204 | 214 | #define ITS_SECTORS_PER_BLOCK (0x1)
|
205 | 215 | /* Specifies the smallest flash programmable unit in bytes */
|
206 | 216 | #define ITS_FLASH_PROGRAM_UNIT (0x4)
|
207 |
| -/* The maximum asset size to be stored in the ITS area */ |
208 |
| -#define ITS_MAX_ASSET_SIZE (512) |
209 |
| -/* The maximum number of assets to be stored in the ITS area */ |
210 |
| -#define ITS_NUM_ASSETS (10) |
211 | 217 |
|
212 | 218 | /* NV Counters definitions */
|
213 | 219 | #define TFM_NV_COUNTERS_AREA_ADDR FLASH_NV_COUNTERS_AREA_OFFSET
|
|
0 commit comments