Skip to content

Commit a43103f

Browse files
committed
TFM: MUSCA: Import partition maps from upstream
Import the latest partition headers from upstream. We no longer need to patch the headers to define the BL2 macro as we now define it in the scatter files for the MUSCA targets.
1 parent 33e57ee commit a43103f

File tree

4 files changed

+153
-81
lines changed

4 files changed

+153
-81
lines changed

targets/TARGET_ARM_SSG/TARGET_MUSCA_B1/partition/flash_layout.h

Lines changed: 95 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
#ifndef __FLASH_LAYOUT_H__
2121
#define __FLASH_LAYOUT_H__
2222

23-
/* Flash layout on Musca-B1 with BL2 (multiple image boot, boot from eFlash 0):
23+
#ifndef FORWARD_PROT_MSG
24+
/* Flash layouts if FORWARD_PROT_MSG is OFF
25+
*
26+
*
27+
* Flash layout on Musca-B1 with BL2 (multiple image boot, boot from eFlash 0):
2428
*
2529
* 0x0A00_0000 BL2 - MCUBoot (128 KB)
2630
* 0x0A02_0000 Secure image primary slot (384 KB)
@@ -81,7 +85,6 @@
8185
#define QSPI_FLASH_TOTAL_SIZE (0x800000) /* 8 MB */
8286

8387
/* Flash layout info for BL2 bootloader */
84-
/* Same as MUSCA_B1_EFLASH0_S_BASE */
8588
#define FLASH_BASE_ADDRESS (0x1A000000)
8689

8790
/* Offset and size definitions of the flash partitions that are handled by the
@@ -179,41 +182,39 @@
179182
* Note: Further documentation of these definitions can be found in the
180183
* TF-M PS Integration Guide.
181184
*/
182-
#define PS_FLASH_DEV_NAME Driver_QSPI_FLASH0
185+
#define TFM_HAL_PS_FLASH_DRIVER Driver_QSPI_FLASH0
183186

184187
/* In this target the CMSIS driver requires only the offset from the base
185188
* address instead of the full memory address.
186189
*/
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)
194-
/* Specifies the smallest flash programmable unit in bytes */
195-
#define PS_FLASH_PROGRAM_UNIT (0x1)
190+
/* Base address of dedicated flash area for PS */
191+
#define TFM_HAL_PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
192+
/* Size of dedicated flash area for PS */
193+
#define TFM_HAL_PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
194+
#define PS_RAM_FS_SIZE TFM_HAL_PS_FLASH_AREA_SIZE
195+
/* Number of physical erase sectors per logical FS block */
196+
#define TFM_HAL_PS_SECTORS_PER_BLOCK (1)
197+
/* Smallest flash programmable unit in bytes */
198+
#define TFM_HAL_PS_PROGRAM_UNIT (0x1)
196199

197200
/* Internal Trusted Storage (ITS) Service definitions
198201
* Note: Further documentation of these definitions can be found in the
199-
* TF-M ITS Integration Guide. The ITS should be in the internal flash, but is
200-
* allocated in the external flash just for development platforms that don't
201-
* have internal flash available.
202+
* TF-M ITS Integration Guide.
202203
*/
203-
#define ITS_FLASH_DEV_NAME Driver_EFLASH0
204+
#define TFM_HAL_ITS_FLASH_DRIVER Driver_EFLASH0
204205

205206
/* In this target the CMSIS driver requires only the offset from the base
206207
* address instead of the full memory address.
207208
*/
208-
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
209-
/* Dedicated flash area for ITS */
210-
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
211-
#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
212-
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
213-
/* Number of ITS_SECTOR_SIZE per block */
214-
#define ITS_SECTORS_PER_BLOCK (0x1)
215-
/* Specifies the smallest flash programmable unit in bytes */
216-
#define ITS_FLASH_PROGRAM_UNIT (0x4)
209+
/* Base address of dedicated flash area for ITS */
210+
#define TFM_HAL_ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
211+
/* Size of dedicated flash area for ITS */
212+
#define TFM_HAL_ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
213+
#define ITS_RAM_FS_SIZE TFM_HAL_ITS_FLASH_AREA_SIZE
214+
/* Number of physical erase sectors per logical FS block */
215+
#define TFM_HAL_ITS_SECTORS_PER_BLOCK (1)
216+
/* Smallest flash programmable unit in bytes */
217+
#define TFM_HAL_ITS_PROGRAM_UNIT (0x4)
217218

218219
/* NV Counters definitions */
219220
#define TFM_NV_COUNTERS_AREA_ADDR FLASH_NV_COUNTERS_AREA_OFFSET
@@ -232,4 +233,73 @@
232233
#define TOTAL_ROM_SIZE FLASH_TOTAL_SIZE
233234
#define TOTAL_RAM_SIZE (0x80000) /* 512 KB */
234235

236+
#else /* FORWARD_PROT_MSG */
237+
238+
/* Flash layout information if FORWARD_PROT_MSG is ON.
239+
* For information you can check Musca-B1 Secure Enclave's flash_layout.h
240+
*/
241+
242+
#define FLASH_S_PARTITION_SIZE (0x30000) /* S partition: 192 KB */
243+
#define FLASH_NS_PARTITION_SIZE (0x50000) /* NS partition: 320 KB */
244+
245+
/* Offset and size definition in flash area used by assemble.py */
246+
#define SECURE_IMAGE_OFFSET (0x0)
247+
#define SECURE_IMAGE_MAX_SIZE FLASH_S_PARTITION_SIZE
248+
249+
#define NON_SECURE_IMAGE_OFFSET (SECURE_IMAGE_OFFSET + \
250+
SECURE_IMAGE_MAX_SIZE)
251+
#define NON_SECURE_IMAGE_MAX_SIZE FLASH_NS_PARTITION_SIZE
252+
253+
/* Image placed in eFlash 1 */
254+
#define FLASH_BASE_ADDRESS (0x1A200000)
255+
256+
#if (MCUBOOT_IMAGE_NUMBER != 1)
257+
#error "If FORWARD_PROT_MSG is ON MCUBOOT_IMAGE_NUMBER must be 1"
258+
#endif
259+
260+
/* Secure + Non-secure image primary slot */
261+
#define FLASH_AREA_0_ID (1)
262+
#define FLASH_AREA_0_OFFSET (0x60000) /* Address comes from SE */
263+
#define FLASH_AREA_0_SIZE (FLASH_S_PARTITION_SIZE + \
264+
FLASH_NS_PARTITION_SIZE)
265+
/* Secure + Non-secure secondary slot */
266+
#define FLASH_AREA_2_ID (FLASH_AREA_0_ID + 1)
267+
#define FLASH_AREA_2_OFFSET (0x160000) /* Address comes from SE */
268+
#define FLASH_AREA_2_SIZE (FLASH_S_PARTITION_SIZE + \
269+
FLASH_NS_PARTITION_SIZE)
270+
271+
/* Image placed in eFlash 1 */
272+
#define S_ROM_ALIAS_BASE (0x1A200000)
273+
#define NS_ROM_ALIAS_BASE (0x0A200000)
274+
275+
#define S_RAM_ALIAS_BASE (0x30000000)
276+
#define NS_RAM_ALIAS_BASE (0x20000000)
277+
278+
#define TOTAL_RAM_SIZE (0x80000) /* 512 KB */
279+
280+
/* Macros needed for BL2 build with dummy values.
281+
* This BL2 instance is not used, but the BL2 macro needs to be set, and this
282+
* macro and BL2 build is entangled. If this is fixed the following macros can
283+
* be deleted.
284+
*/
285+
#define FLASH_AREA_IMAGE_SECTOR_SIZE 0
286+
287+
#define MCUBOOT_STATUS_MAX_ENTRIES 0
288+
#define MCUBOOT_MAX_IMG_SECTORS 32
289+
290+
#define FLASH_AREA_SCRATCH_ID 0
291+
#define FLASH_AREA_SCRATCH_OFFSET 0
292+
#define FLASH_AREA_SCRATCH_SIZE 0
293+
294+
#define FLASH_DEV_NAME Driver_EFLASH0
295+
#define FLASH_AREA_BL2_OFFSET 0
296+
#define FLASH_AREA_BL2_SIZE 0x20000
297+
298+
#define TFM_NV_COUNTERS_AREA_ADDR 0
299+
#define TFM_NV_COUNTERS_AREA_SIZE 8
300+
#define TFM_NV_COUNTERS_SECTOR_ADDR 0
301+
#define TFM_NV_COUNTERS_SECTOR_SIZE 8
302+
303+
#endif /* FORWARD_PROT_MSG */
304+
235305
#endif /* __FLASH_LAYOUT_H__ */

targets/TARGET_ARM_SSG/TARGET_MUSCA_B1/partition/region_defs.h

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121

2222
#include "flash_layout.h"
2323

24-
#ifndef BL2
25-
#define BL2
26-
#endif
27-
2824
#define BL2_HEAP_SIZE (0x0001000)
2925
#define BL2_MSP_STACK_SIZE (0x0001800)
3026

@@ -89,7 +85,7 @@
8985
#define IMAGE_NS_CODE_SIZE \
9086
(FLASH_NS_PARTITION_SIZE - BL2_HEADER_SIZE - BL2_TRAILER_SIZE)
9187

92-
#define CMSE_VENEER_REGION_SIZE (0x340)
88+
#define CMSE_VENEER_REGION_SIZE (0x380)
9389

9490
/* Alias definitions for secure and non-secure areas*/
9591
#define S_ROM_ALIAS(x) (S_ROM_ALIAS_BASE + (x))
@@ -112,6 +108,12 @@
112108
/* CMSE Veneers region */
113109
#define CMSE_VENEER_REGION_START (S_CODE_LIMIT + 1)
114110

111+
/* Shared memory used by PSA Proxy partition */
112+
#ifdef TFM_PARTITION_PSA_PROXY
113+
#define PSA_PROXY_SHARED_MEMORY_BASE (0x1A408000)
114+
#define PSA_PROXY_SHARED_MEMORY_SIZE (0x00078000) /* 476 KiB */
115+
#endif /* TFM_PARTITION_PSA_PROXY */
116+
115117
/* Non-secure regions */
116118
#define NS_IMAGE_PRIMARY_AREA_OFFSET \
117119
(NS_IMAGE_PRIMARY_PARTITION_OFFSET + BL2_HEADER_SIZE)
@@ -157,11 +159,23 @@
157159
#define BL2_DATA_LIMIT (BL2_DATA_START + BL2_DATA_SIZE - 1)
158160
#endif /* BL2 */
159161

162+
/* Shared symbol area between bootloader and runtime firmware. Global variables
163+
* in the shared code can be placed here.
164+
*/
165+
#ifdef CODE_SHARING
166+
#define SHARED_SYMBOL_AREA_BASE S_RAM_ALIAS_BASE
167+
#define SHARED_SYMBOL_AREA_SIZE 0x20
168+
#else
169+
#define SHARED_SYMBOL_AREA_BASE S_RAM_ALIAS_BASE
170+
#define SHARED_SYMBOL_AREA_SIZE 0x0
171+
#endif /* CODE_SHARING */
172+
160173
/* Shared data area between bootloader and runtime firmware.
161-
* Shared data area is allocated at the beginning of the RAM, it is overlapping
174+
* These areas are allocated at the beginning of the RAM, it is overlapping
162175
* with TF-M Secure code's MSP stack
163176
*/
164-
#define BOOT_TFM_SHARED_DATA_BASE S_RAM_ALIAS_BASE
177+
#define BOOT_TFM_SHARED_DATA_BASE (SHARED_SYMBOL_AREA_BASE + \
178+
SHARED_SYMBOL_AREA_SIZE)
165179
#define BOOT_TFM_SHARED_DATA_SIZE (0x400)
166180
#define BOOT_TFM_SHARED_DATA_LIMIT (BOOT_TFM_SHARED_DATA_BASE + \
167181
BOOT_TFM_SHARED_DATA_SIZE - 1)

targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/partition/flash_layout.h

Lines changed: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@
2727
* 0x0A10_0000 Secure image secondary (384 KB)
2828
* 0x0A16_0000 Non-secure image secondary (512 KB)
2929
* 0x0A1E_0000 Scratch Area (16 KB)
30-
* 0x0A1E_4000 Protected Storage Area (20 KB)
31-
* 0x0A1E_9000 Internal Trusted Storage Area (16 KB)
32-
* 0x0A1E_D000 NV counters area (4 KB)
33-
* 0x0A1E_E000 TF-M key area (256 bytes) This area is referred to in
34-
* /lib/ext/cryptocell-312-runtime/shared/hw/include/musca_s1/ \
30+
* 0x0A1E_4000 Internal Trusted Storage Area (16 KB)
31+
* 0x0A1E_8000 NV counters area (4 KB)
32+
* 0x0A1E_9000 TF-M key area (256 bytes) This area is referred to in
33+
* /lib/ext/cryptocell-312-runtime/shared/hw/include/arm/musca_s1/ \
3534
* dx_reg_base_host.h Do not change one without changing the other.
36-
* 0x0A1E_E100 Unused
35+
* 0x0A1E_9100 Unused
36+
* 0x0020_0000 Protected storage area (20 KB) This area is placed in the QSPI
37+
* flash
3738
*
3839
* Flash layout on Musca-S1 with BL2(single image boot):
3940
* 0x0A00_0000 BL2 - MCUBoot(128 KB)
@@ -44,13 +45,14 @@
4445
* 0x0A10_0000 Secure image secondary (384 KB)
4546
* 0x0A16_0000 Non-secure image secondary (512 KB)
4647
* 0x0A1E_0000 Scratch Area (16 KB)
47-
* 0x0A1E_4000 Protected Storage Area (20 KB)
48-
* 0x0A1E_9000 Internal Trusted Storage Area (16 KB)
49-
* 0x0A1E_D000 NV counters area (4 KB)
50-
* 0x0A1E_E000 TF-M key area (256 bytes) This area is referred to in
51-
* /lib/ext/cryptocell-312-runtime/shared/hw/include/musca_s1/ \
48+
* 0x0A1E_4000 Internal Trusted Storage Area (16 KB)
49+
* 0x0A1E_8000 NV counters area (4 KB)
50+
* 0x0A1E_9000 TF-M key area (256 bytes) This area is referred to in
51+
* /lib/ext/cryptocell-312-runtime/shared/hw/include/arm/musca_s1/ \
5252
* dx_reg_base_host.h Do not change one without changing the other.
53-
* 0x0A1E_E100 Unused
53+
* 0x0A1E_9100 Unused
54+
* 0x0020_0000 Protected storage area (20 KB) This area is placed in the QSPI
55+
* flash
5456
*
5557
* Flash layout on Musca-S1 without BL2:
5658
* 0x0A00_0000 Secure image
@@ -142,17 +144,9 @@
142144
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
143145
#endif /* MCUBOOT_IMAGE_NUMBER */
144146

145-
/* Note: FLASH_PS_AREA_OFFSET, FLASH_ITS_AREA_OFFSET and
146-
* FLASH_NV_COUNTERS_AREA_OFFSET point to offsets in flash, but reads and writes
147-
* to these addresses are redirected to Code SRAM by Driver_Flash.c.
148-
*/
149-
#define FLASH_PS_AREA_OFFSET (FLASH_AREA_SCRATCH_OFFSET + \
150-
FLASH_AREA_SCRATCH_SIZE)
151-
#define FLASH_PS_AREA_SIZE (0x5000) /* 20 KB */
152-
153147
/* Internal Trusted Storage (ITS) Service definitions */
154-
#define FLASH_ITS_AREA_OFFSET (FLASH_PS_AREA_OFFSET + \
155-
FLASH_PS_AREA_SIZE)
148+
#define FLASH_ITS_AREA_OFFSET (FLASH_AREA_SCRATCH_OFFSET + \
149+
FLASH_AREA_SCRATCH_SIZE)
156150
#define FLASH_ITS_AREA_SIZE (0x4000) /* 16 KB */
157151

158152
/* NV Counters definitions */
@@ -182,41 +176,39 @@
182176
* Note: Further documentation of these definitions can be found in the
183177
* TF-M PS Integration Guide.
184178
*/
185-
#define PS_FLASH_DEV_NAME Driver_FLASH0
179+
#define TFM_HAL_PS_FLASH_DRIVER Driver_QSPI_FLASH0
186180

187181
/* In this target the CMSIS driver requires only the offset from the base
188182
* address instead of the full memory address.
189183
*/
190-
#define PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
191-
/* Dedicated flash area for PS */
192-
#define PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
193-
#define PS_RAM_FS_SIZE PS_FLASH_AREA_SIZE
194-
#define PS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
195-
/* Number of PS_SECTOR_SIZE per block */
196-
#define PS_SECTORS_PER_BLOCK (0x1)
197-
/* Specifies the smallest flash programmable unit in bytes */
198-
#define PS_FLASH_PROGRAM_UNIT (0x1)
184+
/* Base address of dedicated flash area for PS */
185+
#define TFM_HAL_PS_FLASH_AREA_ADDR 0x0
186+
/* Size of dedicated flash area for PS */
187+
#define TFM_HAL_PS_FLASH_AREA_SIZE (0x5000) /* 20 KB */
188+
#define PS_RAM_FS_SIZE TFM_HAL_PS_FLASH_AREA_SIZE
189+
/* Number of physical erase sectors per logical FS block */
190+
#define TFM_HAL_PS_SECTORS_PER_BLOCK (1)
191+
/* Smallest flash programmable unit in bytes */
192+
#define TFM_HAL_PS_PROGRAM_UNIT (0x1)
199193

200194
/* Internal Trusted Storage (ITS) Service definitions
201195
* Note: Further documentation of these definitions can be found in the
202-
* TF-M ITS Integration Guide. The ITS should be in the internal flash, but is
203-
* allocated in the external flash just for development platforms that don't
204-
* have internal flash available.
196+
* TF-M ITS Integration Guide.
205197
*/
206-
#define ITS_FLASH_DEV_NAME Driver_FLASH0
198+
#define TFM_HAL_ITS_FLASH_DRIVER Driver_FLASH0
207199

208200
/* In this target the CMSIS driver requires only the offset from the base
209201
* address instead of the full memory address.
210202
*/
211-
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
212-
/* Dedicated flash area for ITS */
213-
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
214-
#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
215-
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
216-
/* Number of ITS_SECTOR_SIZE per block */
217-
#define ITS_SECTORS_PER_BLOCK (0x1)
218-
/* Specifies the smallest flash programmable unit in bytes */
219-
#define ITS_FLASH_PROGRAM_UNIT (0x1)
203+
/* Base address of dedicated flash area for ITS */
204+
#define TFM_HAL_ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
205+
/* Size of dedicated flash area for ITS */
206+
#define TFM_HAL_ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
207+
#define ITS_RAM_FS_SIZE TFM_HAL_ITS_FLASH_AREA_SIZE
208+
/* Number of physical erase sectors per logical FS block */
209+
#define TFM_HAL_ITS_SECTORS_PER_BLOCK (1)
210+
/* Smallest flash programmable unit in bytes */
211+
#define TFM_HAL_ITS_PROGRAM_UNIT (0x1)
220212

221213
/* NV Counters definitions */
222214
#define TFM_NV_COUNTERS_AREA_ADDR FLASH_NV_COUNTERS_AREA_OFFSET

targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/partition/region_defs.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
#ifndef __REGION_DEFS_H__
2020
#define __REGION_DEFS_H__
2121

22-
#ifndef BL2
23-
#define BL2
24-
#endif
25-
2622
#include "flash_layout.h"
2723

2824
#define BL2_HEAP_SIZE (0x0001000)

0 commit comments

Comments
 (0)