Skip to content

Commit 4125fd0

Browse files
authored
Merge pull request #14972 from OpenNuvoton/nuvoton_m2354_tfm_psa_fwu
M2354: Support PSA Firmware Update
2 parents 159f832 + 5114e4c commit 4125fd0

20 files changed

+676
-200
lines changed

targets/TARGET_NUVOTON/TARGET_M2354/TARGET_TFM/TARGET_NU_M2354/COMPONENT_TFM_S_FW/CMakeLists.txt

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,35 @@ target_link_libraries(mbed-m2354-tfm
88
${CMAKE_CURRENT_SOURCE_DIR}/s_veneers.o
99
)
1010

11-
mbed_post_build_nuvoton_tfm_sign_image_tgt(
12-
NU_M2354
13-
${CMAKE_CURRENT_SOURCE_DIR}
14-
nuvoton_m2354-root-rsa-3072.pem
15-
)
16-
11+
# Must align with TF-M import assets
1712
set(bl2 true)
18-
set(mcuboot_image_number 1)
13+
set(mcuboot_image_number 2)
1914
set(region_defs_h_path "${CMAKE_CURRENT_SOURCE_DIR}/partition/region_defs.h")
15+
set(update_stage_sdh true)
16+
set(update_stage_flash false)
17+
18+
if(mcuboot_image_number EQUAL 2)
19+
mbed_post_build_nuvoton_tfm_sign_image(
20+
NU_M2354
21+
${CMAKE_CURRENT_SOURCE_DIR}
22+
nuvoton_m2354-root-rsa-3072.pem
23+
nuvoton_m2354-root-rsa-3072_1.pem
24+
)
25+
else()
26+
mbed_post_build_nuvoton_tfm_sign_image(
27+
NU_M2354
28+
${CMAKE_CURRENT_SOURCE_DIR}
29+
nuvoton_m2354-root-rsa-3072.pem
30+
NOTFOUND
31+
)
32+
endif()
2033

2134
target_compile_definitions(mbed-m2354-tfm
2235
INTERFACE
2336
NU_TFM_S_BL2=$<IF:$<BOOL:${bl2}>,1,0>
2437
NU_TFM_S_MCUBOOT_IMAGE_NUMBER=${mcuboot_image_number}
2538
# TODO: Fix escape sequence in NU_TFM_S_REGION_DEFS_H_PATH
2639
#NU_TFM_S_REGION_DEFS_H_PATH=\"${region_defs_h_path}\"
40+
NU_TFM_S_UPDATE_STAGE_SDH=$<IF:$<BOOL:${update_stage_sdh}>,1,0>
41+
NU_TFM_S_UPDATE_STAGE_FLASH=$<IF:$<BOOL:${update_stage_flash}>,1,0>
2742
)

targets/TARGET_NUVOTON/TARGET_M2354/TARGET_TFM/TARGET_NU_M2354/COMPONENT_TFM_S_FW/README.md

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Rebuild TF-M and integrate with Mbed on M2354
1+
# Rebuild TF-M and integrate with Mbed for M2354
22

3-
This document guides how to rebuild TF-M and integrate with Mbed on M2354.
3+
This document guides how to rebuild TF-M and integrate with Mbed for M2354.
44

55
### Downloading TF-M source
66

77
The M2354 port in TF-M must patch to enable TF-M integration with Mbed.
8-
For TF-M 1.3/Mbed integration on M2354, the [mainstream TF-M](https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git) is patched as follows:
8+
For TF-M 1.3/Mbed integration for M2354, the [mainstream TF-M](https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git) is patched as follows:
99
- Apply Mbed-enabled patch to `nuvoton/m2354` TF-M target.
1010

1111
Run the following command to fetch and switch to the intended version:
12-
```sh
13-
git clone https://github.com/OpenNuvoton/trusted-firmware-m -b nuvoton_mbed_m2354_tfm-1.3
12+
```
13+
$ git clone https://github.com/OpenNuvoton/trusted-firmware-m -b nuvoton_mbed_m2354_tfm-1.3
1414
```
1515

1616
## Customizing TF-M
@@ -36,6 +36,7 @@ In TF-M, by default, the M2354 hardware is partitioned as follows:
3636
- **PDMA1**: Configured to nonsecure for Mbed asynchronous transfer.
3737
- **CRYPTO**: Configured to secure. Inaccessible to Mbed.
3838
- **TRNG**: Hardwired to secure. Accessible to Mbed indirectly through PSA Cryptography API.
39+
- **SDH**: Configured to secure to enable PSA Firmware Update. Inaccessible to Mbed.
3940

4041
### Defining Flash for TF-M/Mbed
4142

@@ -75,14 +76,22 @@ To define memory spec of SRAM for TF-M/Mbed, search/change the line:
7576
Navigate [TF-M](https://www.trustedfirmware.org/projects/tf-m/).
7677
Then go through **DOCS****Getting Started Guides****Software requirements** for TF-M build environment setup.
7778

79+
**NOTE**: **GNU Arm Embedded Toolchain 9 2020-q2-update** and earlier built code **FAILS** to run with `-Os`. Avoid these toolchain versions. Check [their bug report](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95646).
80+
7881
**NOTE**: **GNU Arm Embedded Toolchain 10-2020-q4-major** built code **FAILS** to run. Avoid this toolchain version. Check [its bug report](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99157).
7982

80-
### Compile
83+
### Default relevant build configurations
84+
85+
- Enabled BL2 (MCUboot)
86+
- Enabled multiple image boot
87+
- Enabled SDH (SD card) as update staging area for PSA Firmware Update
88+
89+
### Compiling
8190

82-
To compile TF-M on M2354, run:
91+
To compile TF-M for M2354, run:
8392

84-
```sh
85-
cmake -S . \
93+
```
94+
$ cmake -S . \
8695
-B cmake_build \
8796
-DTFM_PLATFORM=nuvoton/m2354 \
8897
-DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake \
@@ -93,8 +102,8 @@ cmake -S . \
93102

94103
Then:
95104

96-
```sh
97-
cmake --build cmake_build -- install
105+
```
106+
$ cmake --build cmake_build -- install
98107
```
99108

100109
## Integrating with Mbed
@@ -111,21 +120,41 @@ The following TF-M exported stuffs must update into Mbed:
111120

112121
- partition/: Flash layout for image signing and concatenating in post-build process
113122

114-
**NOTE**: On import, `signing_layout_s_ns.o` is renamed to `signing_layout_preprocessed.h` for the following reasons:
115-
- Post-build script checks file name with `_s`/`_ns` to resolve `sw_type` as `SPE`/`NSPE` respectively.
116-
To recognize as `NSPE_SPE`, don't use `_s_ns`/`_ns_s` file name to avoid mis-recognized.
117-
- Use `.h` instead of `.c` as file extension name.
118-
This is to enable custom TF-M build where the locatioin of this directory can change elsewhere.
119-
In Greentea build process, `.c` file isn't but`.h` file is copied into `BUILD` directory, so that post-build script can still access the file.
123+
**NOTE**: On import, `signing_layout_*.o` are renamed to `signing_layout_*.h`.
124+
This is to use `.h` instead of `.c`/`.o` as file extension name and avoid adding into compile/link list.
125+
126+
**NOTE**: On import for single image boot, `signing_layout_s_ns.o` is renamed to `signing_layout_preprocessed.h`.
127+
Post-build script checks file name with `_s`/`_ns` to resolve `sw_type` as `SPE`/`NSPE` respectively.
128+
To recognize as `NSPE_SPE`, don't use `_s_ns`/`_ns_s` file name to avoid mis-recognized.
120129

121130
- [signing_key/](signing_key/nuvoton_m2354-root-rsa-3072.md)
122131

123-
Below summarizes the copy paths from TF-M into Mbed:
132+
Below summarize the copy paths from TF-M into Mbed:
124133

125-
- trusted-firmware-m/cmake_build/bin/bl2.bin → bl2.bin
126-
- trusted-firmware-m/cmake_build/install/export/tfm/lib/s_veneers.os_veneers.o
127-
- trusted-firmware-m/cmake_build/bin/tfm_s.bintfm_s.bin
134+
- trusted-firmware-m/cmake_build/install/outputs/NUVOTON/M2354/bl2.bin → bl2.bin
135+
- trusted-firmware-m/cmake_build/install/outputs/NUVOTON/M2354/tfm_s.bintfm_s.bin
136+
- trusted-firmware-m/cmake_build/install/interface/lib/s_veneers.os_veneers.o
128137
- trusted-firmware-m/platform/ext/target/nuvoton/m2354/partition/flash_layout.h → partition/flash_layout.h
129138
- trusted-firmware-m/platform/ext/target/nuvoton/m2354/partition/region_defs.h → partition/region_defs.h
130-
- trusted-firmware-m/cmake_build/bl2/ext/mcuboot/CMakeFiles/signing_layout_s.dir/signing_layout_s_ns.o → partition/signing_layout_preprocessed.h
131-
- trusted-firmware-m/bl2/ext/mcuboot/root-RSA-3072.pem → signing_key/nuvoton_m2354-root-rsa-3072.pem
139+
- trusted-firmware-m/cmake_build/install/image_signing/layout_files/signing_layout_s.o → partition/signing_layout_s_preprocessed.h
140+
- trusted-firmware-m/cmake_build/install/image_signing/layout_files/signing_layout_ns.o → partition/signing_layout_ns_preprocessed.h
141+
- trusted-firmware-m/cmake_build/install/image_signing/keys/root-RSA-3072.pem → signing_key/nuvoton_m2354-root-rsa-3072.pem
142+
- trusted-firmware-m/cmake_build/install/image_signing/keys/root-RSA-3072_1.pem → signing_key/nuvoton_m2354-root-rsa-3072_1.pem
143+
144+
**NOTE**: `trusted-firmware-m/cmake_build/install/image_signing/keys/root-RSA-3072.pem` can be missing due to TF-M build tool issue.
145+
Try to get it from `trusted-firmware-m/bl2/ext/mcuboot/root-RSA-3072.pem` instead if it is just the original source.
146+
147+
## PSA Firmware Update
148+
149+
### Requirement
150+
151+
- SD card: Used for update staging area according to above TF-M build configurations.
152+
153+
### Update binary files
154+
155+
After finishing Mbed build, you will find the following files under build directory.
156+
They are to write to update staging area through PSA Firmware Update API for firmware upgrade.
157+
158+
- `tfm_s_update.bin`: TF-M secure binary file for update separately when multiple image boot is enabled
159+
- `<application>_update.bin`: Mbed non-secure binary file for update separately when multiple image boot is enabled or
160+
combined TF-M secure+Mbed non-secure binary file for update together when single image boot is enabled

targets/TARGET_NUVOTON/TARGET_M2354/TARGET_TFM/TARGET_NU_M2354/COMPONENT_TFM_S_FW/partition/flash_layout.h

Lines changed: 132 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/*
2-
* @copyright SPDX-License-Identifier: Apache-2.0
32
* Copyright (c) 2017-2020 Arm Limited. All rights reserved.
43
* Copyright (c) 2020 Nuvoton Technology Corp. All rights reserved.
54
*
@@ -21,15 +20,42 @@
2120

2221
/* Flash layout on M2354 with BL2 (single image boot):
2322
*
24-
* 0x0000_0000 BL2 - MCUBoot (64KB)
25-
* 0x0001_0000 Protected Storage Area (32 KB)
26-
* 0x0000_8000 Internal Trusted Storage Area (28 KB)
27-
* 0x0000_F000 NV counters area (4 KB)
28-
* 0x0002_0000 Primary image area (320KB):
29-
* 0x0002_0000 Secure image primary
30-
* 0x0007_0000 Non-secure image primary
31-
* 0x0010_0000 Scratch area (4KB)
23+
* Internal Flash:
24+
* 0x0000_0000 BL2 - MCUBoot (48KB)
25+
* 0x0000_C000 Protected Storage Area (56 KB)
26+
* 0x0001_A000 Internal Trusted Storage Area (20 KB)
27+
* 0x0001_F000 NV counters area (4 KB)
28+
* 0x0002_0000 Primary image area (896KB):
29+
* 0x0002_0000 Secure image primary (320KB)
30+
* 0x0007_0000 Non-secure image primary (576KB)
31+
* 0x0010_0000 Secondary image area (2KB):
32+
* 0x0010_0000 Secure image secondary (320KB) (Dummy)
33+
* 0x0015_0000 Non-secure image secondary (576KB) (Dummy)
34+
* 0x001E_0000 Scratch area (4KB) (Dummy)
3235
*
36+
* SDH Flash:
37+
* 0x0000_0000 Secondary image area (896KB)
38+
* 0x0000_0000 Secure image secondary (320KB)
39+
* 0x0005_0000 Non-secure image secondary (576KB)
40+
* 0x0020_0000 Scratch area (4 KB)
41+
*
42+
* Flash layout on M2354 with BL2 (multiple image boot):
43+
*
44+
* Internal Flash:
45+
* 0x0000_0000 BL2 - MCUBoot (48KB)
46+
* 0x0000_C000 Protected Storage Area (56 KB)
47+
* 0x0001_A000 Internal Trusted Storage Area (20 KB)
48+
* 0x0001_F000 NV counters area (4 KB)
49+
* 0x0002_0000 Secure image primary slot (320KB)
50+
* 0x0007_0000 Non-secure image primary slot (576KB)
51+
* 0x0010_0000 Secure image secondary slot (320KB) (Dummy)
52+
* 0x0015_0000 Non-secure image secondary slot (576KB) (Dummy)
53+
* 0x001E_0000 Scratch area (4KB) (Dummy)
54+
*
55+
* SDH Flash:
56+
* 0x0000_0000 Secure image secondary slot (320KB)
57+
* 0x0010_0000 Non-secure image secondary slot (576KB)
58+
* 0x0020_0000 Scratch area (2 KB)
3359
*/
3460

3561
/* This header file is included from linker scatter file as well, where only a
@@ -40,8 +66,13 @@
4066
*/
4167

4268
/* Size of a Secure and of a Non-secure image */
43-
#define FLASH_S_PARTITION_SIZE (0x50000) /* S partition : 192+64+64 KB */
44-
#define FLASH_NS_PARTITION_SIZE (0x90000) /* NS partition: 768-64-64 KB */
69+
#if !NU_UPDATE_STAGE_FLASH
70+
#define FLASH_S_PARTITION_SIZE (0x50000) /* S partition : 320 KB */
71+
#define FLASH_NS_PARTITION_SIZE (0x90000) /* NS partition: 576 KB */
72+
#else
73+
#define FLASH_S_PARTITION_SIZE (0x46000) /* S partition : 280 KB */
74+
#define FLASH_NS_PARTITION_SIZE (0x28000) /* NS partition: 160 KB */
75+
#endif
4576
#define FLASH_MAX_PARTITION_SIZE ((FLASH_S_PARTITION_SIZE > \
4677
FLASH_NS_PARTITION_SIZE) ? \
4778
FLASH_S_PARTITION_SIZE : \
@@ -50,34 +81,56 @@
5081
/* Sector size of the flash hardware; same as FLASH0_SECTOR_SIZE */
5182
#define FLASH_AREA_IMAGE_SECTOR_SIZE (0x800) /* 2 KB */
5283
/* Same as FLASH0_SIZE */
53-
#define FLASH_TOTAL_SIZE (0x00100000) /* 512 KB */
84+
#define FLASH_TOTAL_SIZE (0x00100000) /* 1024 KB */
5485

5586
/* Flash layout info for BL2 bootloader */
5687
/* Same as FLASH0_BASE_S */
5788
#define FLASH_BASE_ADDRESS (0x00000000)
5889

90+
#if NU_UPDATE_STAGE_SDH
91+
#define SDH_FLASH_DEVICE_ID (FLASH_DEVICE_ID + 1)
92+
#define SDH_FLASH_DEV_NAME Driver_SDH_FLASH0
93+
#define SDH_FLASH_BASE_ADDRESS (0x00000000)
94+
#endif
95+
5996
/* Offset and size definitions of the flash partitions that are handled by the
6097
* bootloader. The image swapping is done between IMAGE_PRIMARY and
6198
* IMAGE_SECONDARY, SCRATCH is used as a temporary storage during image
6299
* swapping.
63100
*/
64101
#define FLASH_AREA_BL2_OFFSET (0x0)
65-
#define FLASH_AREA_BL2_SIZE (0x10000) /* 64 KB */
102+
#define FLASH_AREA_BL2_SIZE (0xC000) /* 48 KB */
66103

67104
#if !defined(MCUBOOT_IMAGE_NUMBER) || (MCUBOOT_IMAGE_NUMBER == 1)
68105
/* Secure + Non-secure image primary slot */
69106
#define FLASH_AREA_0_ID (1)
70-
#define FLASH_AREA_0_OFFSET (FLASH_AREA_BL2_OFFSET + FLASH_AREA_BL2_SIZE + 0x10000) /* 0x10000 */
71-
#define FLASH_AREA_0_SIZE (FLASH_S_PARTITION_SIZE + FLASH_NS_PARTITION_SIZE) /* 480 KB */
107+
#define FLASH_AREA_0_OFFSET (FLASH_AREA_BL2_OFFSET + FLASH_AREA_BL2_SIZE + 0x14000) /* Reserved for storage */
108+
#define FLASH_AREA_0_SIZE (FLASH_S_PARTITION_SIZE + FLASH_NS_PARTITION_SIZE)
72109
/* Secure + Non-secure secondary slot */
110+
#if NU_UPDATE_STAGE_SDH
73111
#define FLASH_AREA_2_ID (FLASH_AREA_0_ID + 1)
74-
#define FLASH_AREA_2_OFFSET (0x100000)
75-
#define FLASH_AREA_2_SIZE (0x800)
112+
#define FLASH_AREA_2_OFFSET (0x0)
113+
#define FLASH_AREA_2_SIZE (FLASH_S_PARTITION_SIZE + FLASH_NS_PARTITION_SIZE)
114+
#define FLASH_DEVICE_ID_2 SDH_FLASH_DEVICE_ID
115+
#define FLASH_DEV_NAME_2 SDH_FLASH_DEV_NAME
116+
#else
117+
#define FLASH_AREA_2_ID (FLASH_AREA_0_ID + 1)
118+
#define FLASH_AREA_2_OFFSET (FLASH_AREA_0_OFFSET + FLASH_AREA_0_SIZE)
119+
#define FLASH_AREA_2_SIZE (FLASH_S_PARTITION_SIZE + FLASH_NS_PARTITION_SIZE)
120+
#endif
76121

77122
/* Scratch area */
123+
#if NU_UPDATE_STAGE_SDH
124+
#define FLASH_AREA_SCRATCH_ID (FLASH_AREA_2_ID + 1)
125+
#define FLASH_AREA_SCRATCH_OFFSET (0x200000)
126+
#define FLASH_AREA_SCRATCH_SIZE (0x1000)
127+
#define FLASH_DEVICE_ID_SCRATCH SDH_FLASH_DEVICE_ID
128+
#define FLASH_DEV_NAME_SCRATCH SDH_FLASH_DEV_NAME
129+
#else
78130
#define FLASH_AREA_SCRATCH_ID (FLASH_AREA_2_ID + 1)
79-
#define FLASH_AREA_SCRATCH_OFFSET (0x100800)
80-
#define FLASH_AREA_SCRATCH_SIZE (0x800)
131+
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_2_OFFSET + FLASH_AREA_2_SIZE)
132+
#define FLASH_AREA_SCRATCH_SIZE (0x1000)
133+
#endif
81134

82135
/* The maximum number of status entries supported by the bootloader. */
83136
#define MCUBOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
@@ -88,24 +141,79 @@
88141
#define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
89142
FLASH_NS_PARTITION_SIZE) / \
90143
FLASH_AREA_IMAGE_SECTOR_SIZE)
144+
#elif (MCUBOOT_IMAGE_NUMBER == 2)
145+
/* Secure image primary slot */
146+
#define FLASH_AREA_0_ID (1)
147+
#define FLASH_AREA_0_OFFSET (FLASH_AREA_BL2_OFFSET + FLASH_AREA_BL2_SIZE + 0x14000) /* Reserved for storage */
148+
#define FLASH_AREA_0_SIZE (FLASH_S_PARTITION_SIZE)
149+
/* Non-secure image primary slot */
150+
#define FLASH_AREA_1_ID (FLASH_AREA_0_ID + 1)
151+
#define FLASH_AREA_1_OFFSET (FLASH_AREA_0_OFFSET + FLASH_AREA_0_SIZE)
152+
#define FLASH_AREA_1_SIZE (FLASH_NS_PARTITION_SIZE)
91153

154+
/* Secure image secondary slot */
155+
#if NU_UPDATE_STAGE_SDH
156+
#define FLASH_AREA_2_ID (FLASH_AREA_1_ID + 1)
157+
#define FLASH_AREA_2_OFFSET (0x0)
158+
#define FLASH_AREA_2_SIZE (FLASH_S_PARTITION_SIZE)
159+
#define FLASH_DEVICE_ID_2 SDH_FLASH_DEVICE_ID
160+
#define FLASH_DEV_NAME_2 SDH_FLASH_DEV_NAME
92161
#else
93-
#error "Only MCUBOOT_IMAGE_NUMBER 1 are supported!"
162+
#define FLASH_AREA_2_ID (FLASH_AREA_1_ID + 1)
163+
#define FLASH_AREA_2_OFFSET (FLASH_AREA_1_OFFSET + FLASH_AREA_1_SIZE)
164+
#define FLASH_AREA_2_SIZE (FLASH_S_PARTITION_SIZE)
165+
#endif
166+
167+
/* Non-secure image secondary slot */
168+
#if NU_UPDATE_STAGE_SDH
169+
#define FLASH_AREA_3_ID (FLASH_AREA_2_ID + 1)
170+
#define FLASH_AREA_3_OFFSET (0x100000)
171+
#define FLASH_AREA_3_SIZE (FLASH_NS_PARTITION_SIZE)
172+
#define FLASH_DEVICE_ID_3 SDH_FLASH_DEVICE_ID
173+
#define FLASH_DEV_NAME_3 SDH_FLASH_DEV_NAME
174+
#else
175+
#define FLASH_AREA_3_ID (FLASH_AREA_2_ID + 1)
176+
#define FLASH_AREA_3_OFFSET (FLASH_AREA_2_OFFSET + FLASH_AREA_2_SIZE)
177+
#define FLASH_AREA_3_SIZE (FLASH_NS_PARTITION_SIZE)
178+
#endif
179+
180+
/* Scratch area */
181+
#if NU_UPDATE_STAGE_SDH
182+
#define FLASH_AREA_SCRATCH_ID (FLASH_AREA_3_ID + 1)
183+
#define FLASH_AREA_SCRATCH_OFFSET (0x200000)
184+
#define FLASH_AREA_SCRATCH_SIZE (0x1000)
185+
#define FLASH_DEVICE_ID_SCRATCH SDH_FLASH_DEVICE_ID
186+
#define FLASH_DEV_NAME_SCRATCH SDH_FLASH_DEV_NAME
187+
#else
188+
#define FLASH_AREA_SCRATCH_ID (FLASH_AREA_3_ID + 1)
189+
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_3_OFFSET + FLASH_AREA_3_SIZE)
190+
#define FLASH_AREA_SCRATCH_SIZE (0x1000)
191+
#endif
192+
193+
/* The maximum number of status entries supported by the bootloader. */
194+
#define MCUBOOT_STATUS_MAX_ENTRIES (FLASH_MAX_PARTITION_SIZE / \
195+
FLASH_AREA_SCRATCH_SIZE)
196+
197+
/* Maximum number of image sectors supported by the bootloader. */
198+
#define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
199+
FLASH_AREA_IMAGE_SECTOR_SIZE)
200+
#else /* MCUBOOT_IMAGE_NUMBER > 2 */
201+
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
94202
#endif /* MCUBOOT_IMAGE_NUMBER */
95203

96204
/* Protected Storage (PS) Service definitions */
97-
#define FLASH_PS_AREA_OFFSET (0x10000)
98-
#define FLASH_PS_AREA_SIZE (0x8000)
205+
#define FLASH_PS_AREA_OFFSET (FLASH_AREA_BL2_OFFSET + FLASH_AREA_BL2_SIZE)
206+
#define FLASH_PS_AREA_SIZE (0xE000)
99207

100208
/* Internal Trusted Storage (ITS) Service definitions */
101209
#define FLASH_ITS_AREA_OFFSET (FLASH_PS_AREA_OFFSET + \
102210
FLASH_PS_AREA_SIZE)
103-
#define FLASH_ITS_AREA_SIZE (0x7000)
211+
#define FLASH_ITS_AREA_SIZE (0x5000)
104212

105213
/* NV Counters definitions */
106214
#define FLASH_NV_COUNTERS_AREA_OFFSET (FLASH_ITS_AREA_OFFSET + \
107215
FLASH_ITS_AREA_SIZE)
108-
#define FLASH_NV_COUNTERS_AREA_SIZE (FLASH_AREA_IMAGE_SECTOR_SIZE)
216+
#define FLASH_NV_COUNTERS_AREA_SIZE (0x1000)
109217

110218
/* Offset and size definition in flash area used by assemble.py */
111219
#define SECURE_IMAGE_OFFSET (0x0)

0 commit comments

Comments
 (0)