Skip to content

Commit 875baf3

Browse files
committed
ARM_MUSCA_B1: partition files update
1 parent 5766592 commit 875baf3

File tree

5 files changed

+59
-48
lines changed

5 files changed

+59
-48
lines changed

targets/TARGET_ARM_SSG/TARGET_MUSCA_B1/partition/flash_layout.h

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
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.
34
*
45
* SPDX-License-Identifier: Apache-2.0
56
*
@@ -19,7 +20,19 @@
1920
#ifndef __FLASH_LAYOUT_H__
2021
#define __FLASH_LAYOUT_H__
2122

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):
2336
*
2437
* 0x0A00_0000 BL2 - MCUBoot (128 KB)
2538
* 0x0A02_0000 Primary image area (896 KB):
@@ -28,18 +41,20 @@
2841
* 0x0A10_0000 Secondary image area (896 KB):
2942
* 0x0A10_0000 Secure image secondary (384 KB)
3043
* 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)
3348
*
3449
* 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.
3651
*
3752
* Flash layout on Musca-B1 without BL2:
3853
* 0x0A00_0000 Secure image
39-
* 0x0A07_0000 Non-secure image
54+
* 0x0A08_0000 Non-secure image
4055
*
4156
* QSPI Flash layout
42-
* 0x0000_0000 Secure Storage Area (20 KB)
57+
* 0x0000_0000 Protected Storage Area (20 KB)
4358
*/
4459

4560
/* This header file is included from linker scatter file as well, where only a
@@ -88,12 +103,14 @@
88103
#define FLASH_AREA_2_OFFSET (FLASH_AREA_0_OFFSET + FLASH_AREA_0_SIZE)
89104
#define FLASH_AREA_2_SIZE (FLASH_S_PARTITION_SIZE + \
90105
FLASH_NS_PARTITION_SIZE)
91-
/* Not used, only the Non-swapping firmware upgrade operation
92-
* is supported on Musca-B1.
93-
*/
106+
/* Scratch area */
94107
#define FLASH_AREA_SCRATCH_ID (FLASH_AREA_2_ID + 1)
95108
#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)
97114
/* Maximum number of image sectors supported by the bootloader. */
98115
#define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
99116
FLASH_NS_PARTITION_SIZE) / \
@@ -115,25 +132,20 @@
115132
#define FLASH_AREA_3_ID (FLASH_AREA_2_ID + 1)
116133
#define FLASH_AREA_3_OFFSET (FLASH_AREA_2_OFFSET + FLASH_AREA_2_SIZE)
117134
#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 */
121136
#define FLASH_AREA_SCRATCH_ID (FLASH_AREA_3_ID + 1)
122137
#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)
124142
/* Maximum number of image sectors supported by the bootloader. */
125143
#define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
126144
FLASH_AREA_IMAGE_SECTOR_SIZE)
127145
#else /* MCUBOOT_IMAGE_NUMBER > 2 */
128146
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
129147
#endif /* MCUBOOT_IMAGE_NUMBER */
130148

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-
137149
/* Internal Trusted Storage (ITS) Service definitions (32 KB) */
138150
#define FLASH_ITS_AREA_OFFSET (FLASH_AREA_SCRATCH_OFFSET + \
139151
FLASH_AREA_SCRATCH_SIZE)
@@ -152,38 +164,35 @@
152164
SECURE_IMAGE_MAX_SIZE)
153165
#define NON_SECURE_IMAGE_MAX_SIZE FLASH_NS_PARTITION_SIZE
154166

155-
/* Secure Storage (SST) Service definitions size is 20 KB. */
167+
/* Protected Storage (PS) Service definitions size is 20 KB. */
156168
/* Same as MUSCA_B1_QSPI_FLASH_S_BASE */
157169
#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)
160172

161173
/* Flash device name used by BL2
162174
* Name is defined in flash driver file: Driver_Flash.c
163175
*/
164176
#define FLASH_DEV_NAME Driver_EFLASH0
165177

166-
/* Secure Storage (SST) Service definitions
178+
/* Protected Storage (PS) Service definitions
167179
* Note: Further documentation of these definitions can be found in the
168-
* TF-M SST Integration Guide.
180+
* TF-M PS Integration Guide.
169181
*/
170-
#define SST_FLASH_DEV_NAME Driver_QSPI_FLASH0
182+
#define PS_FLASH_DEV_NAME Driver_QSPI_FLASH0
171183

172184
/* In this target the CMSIS driver requires only the offset from the base
173185
* address instead of the full memory address.
174186
*/
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)
181194
/* 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)
187196

188197
/* Internal Trusted Storage (ITS) Service definitions
189198
* Note: Further documentation of these definitions can be found in the
@@ -199,15 +208,12 @@
199208
#define ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
200209
/* Dedicated flash area for ITS */
201210
#define ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
211+
#define ITS_RAM_FS_SIZE ITS_FLASH_AREA_SIZE
202212
#define ITS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
203213
/* Number of ITS_SECTOR_SIZE per block */
204214
#define ITS_SECTORS_PER_BLOCK (0x1)
205215
/* Specifies the smallest flash programmable unit in bytes */
206216
#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)
211217

212218
/* NV Counters definitions */
213219
#define TFM_NV_COUNTERS_AREA_ADDR FLASH_NV_COUNTERS_AREA_OFFSET

targets/TARGET_ARM_SSG/TARGET_MUSCA_B1/partition/region_defs.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017-2020 Arm Limited. All rights reserved.
2+
* Copyright (c) 2017-2021 Arm Limited. All rights reserved.
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -21,6 +21,10 @@
2121

2222
#include "flash_layout.h"
2323

24+
#ifndef BL2
25+
#define BL2
26+
#endif
27+
2428
#define BL2_HEAP_SIZE (0x0001000)
2529
#define BL2_MSP_STACK_SIZE (0x0001800)
2630

@@ -30,8 +34,8 @@
3034
#define S_PSP_STACK_SIZE (0x0000800)
3135

3236
#define NS_HEAP_SIZE (0x0001000)
33-
#define NS_MSP_STACK_SIZE (0x0000400)
34-
#define NS_PSP_STACK_SIZE (0x0000C00)
37+
#define NS_MSP_STACK_SIZE (0x00000A0)
38+
#define NS_PSP_STACK_SIZE (0x0000140)
3539

3640
/* This size of buffer is big enough to store an attestation
3741
* token produced by initial attestation service
@@ -73,11 +77,11 @@
7377
*/
7478
#ifdef BL2
7579
#define BL2_HEADER_SIZE (0x400) /* 1 KB */
76-
#define BL2_TRAILER_SIZE (0x400) /* 1 KB */
80+
#define BL2_TRAILER_SIZE (0x800) /* 2 KB */
7781
#else
7882
/* No header if no bootloader, but keep IMAGE_CODE_SIZE the same */
7983
#define BL2_HEADER_SIZE (0x0)
80-
#define BL2_TRAILER_SIZE (0x800)
84+
#define BL2_TRAILER_SIZE (0xC00)
8185
#endif /* BL2 */
8286

8387
#define IMAGE_S_CODE_SIZE \

targets/targets.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4628,7 +4628,8 @@
46284628
"CMSIS_NVIC_VIRTUAL",
46294629
"LPTICKER_DELAY_TICKS=3",
46304630
"MBED_MPU_CUSTOM",
4631-
"BL2"
4631+
"BL2",
4632+
"MCUBOOT_IMAGE_NUMBER=2"
46324633
],
46334634
"extra_labels_add": [
46344635
"ARM_SSG",

0 commit comments

Comments
 (0)