Skip to content

Commit 8620561

Browse files
simensrostadArekBalysNordic
authored andcommitted
boards: modules: tfm: reduce secure RAM for minimal profile
Shrink TF-M stack sizes, IO vector buffer, and shared-data region when `TFM_PROFILE_TYPE_MINIMAL` is selected. This makes it possible to reduce the TF-M SRAM partition for minimal profile from 16 to 8 KiB. The minimal profile only runs a small fixed set of services (RNG, hash crypto, platform reset, SPM logging), so the larger defaults waste RAM. Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
1 parent d3e4e6e commit 8620561

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

modules/trusted-firmware-m/Kconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ config TFM_PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE
5252

5353
config TFM_PLATFORM_SP_STACK_SIZE
5454
hex "Stack size"
55+
default 0x400 if TFM_PROFILE_TYPE_MINIMAL
5556
default 0x500
5657

5758
config TFM_PLATFORM_NV_COUNTER_MODULE_DISABLED
@@ -114,7 +115,7 @@ config TFM_CRYPTO_CONC_OPER_NUM
114115
config TFM_CRYPTO_IOVEC_BUFFER_SIZE
115116
int
116117
prompt "TF-M Crypto - PSA FF IO vector buffer size" if !TFM_PROFILE_TYPE_MINIMAL
117-
default 1024 if TFM_PROFILE_TYPE_MINIMAL
118+
default 512 if TFM_PROFILE_TYPE_MINIMAL
118119
default 8192 if TFM_PARTITION_PROTECTED_STORAGE && TFM_PS_MAX_ASSET_SIZE > 2048
119120
default 5120
120121
help
@@ -127,7 +128,7 @@ config TFM_CRYPTO_IOVEC_BUFFER_SIZE
127128
config TFM_CRYPTO_PARTITION_STACK_SIZE
128129
hex
129130
prompt "TF-M Crypto Partition - Stack size" if !TFM_PROFILE_TYPE_MINIMAL
130-
default 0x800 if TFM_PROFILE_TYPE_MINIMAL
131+
default 0x600 if TFM_PROFILE_TYPE_MINIMAL
131132
default 0x4000 if PSA_WANT_RSA_KEY_SIZE_4096 || PSA_WANT_RSA_KEY_SIZE_3072
132133
default 0x2000
133134
help

modules/trusted-firmware-m/tfm_boards/partition/region_defs.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@
1313
#define S_HEAP_SIZE (0x00001000)
1414
#endif
1515

16+
#ifdef CONFIG_TFM_PROFILE_TYPE_MINIMAL
17+
#define S_MSP_STACK_SIZE (0x00000500)
18+
#define S_PSP_STACK_SIZE (0x00000400)
19+
#else
1620
#define S_MSP_STACK_SIZE (0x00000800)
1721
#define S_PSP_STACK_SIZE (0x00000800)
22+
#endif
1823

1924
#define NS_HEAP_SIZE (0x00001000)
2025
#define NS_STACK_SIZE (0x000001E0)
@@ -171,7 +176,11 @@
171176
#else
172177
#define BOOT_TFM_SHARED_DATA_BASE TFM_DT_REG_ADDR(TFM_DT_NODELABEL(sram0_s))
173178
#endif
179+
#ifdef CONFIG_TFM_PROFILE_TYPE_MINIMAL
180+
#define BOOT_TFM_SHARED_DATA_SIZE (0x100)
181+
#else
174182
#define BOOT_TFM_SHARED_DATA_SIZE (0x400)
183+
#endif
175184
#define BOOT_TFM_SHARED_DATA_LIMIT (BOOT_TFM_SHARED_DATA_BASE + BOOT_TFM_SHARED_DATA_SIZE - 1)
176185

177186
/* Regions used by psa-arch-tests to keep state */

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ manifest:
159159
- name: matter
160160
repo-path: sdk-connectedhomeip
161161
path: modules/lib/matter
162-
revision: 106cf3d26c6b3354fc2006aa71684a9905d1af64
162+
revision: pull/717/head
163163
west-commands: scripts/west/west-commands.yml
164164
submodules:
165165
- name: nlio

0 commit comments

Comments
 (0)