Skip to content

Commit 6c4a3a9

Browse files
committed
[nrf fromtree] platform: nordic_nrf: nrf7120: Fix RAM and NS storage partition layout
Define S_RAM_PARTITION_SIZE (64 kB) so non-secure gets the rest of the 768 kB M33 SRAM map for Wi-Fi. Place non-secure storage at the end of the TF-M image layout instead of FLASH_TOTAL_SIZE. Change-Id: I7c176dbddb38cfc0e6bb333b3f87c895968d53e5 Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no> (cherry picked from commit 1dacb6fd2a4dc41810d25154b9b0396a606db313)
1 parent c9f7307 commit 6c4a3a9

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

platform/ext/target/nordic_nrf/common/nrf7120/partition/flash_layout.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
* 0x0008_A000 Non-secure image primary (844 KB)
3131
* 0x0015_D000 Non-secure storage, used when built with NRF_NS_STORAGE=ON,
3232
* otherwise unused (32 KB)
33+
*
34+
* RAM layout on nRF7120 Application MCU (768 kB M33 SRAM):
35+
*
36+
* 0x2000_0000 Secure RAM (64 kB)
37+
* 0x2001_0000 Non-secure RAM (704 kB, remainder of TOTAL_RAM_SIZE)
38+
*
39+
* Secure RAM is kept to 64 kB so the non-secure application (Wi-Fi stack)
40+
* gets as much of the M33 SRAM map as TF-M can grant.
3341
*/
3442

3543
/* This header file is included from linker scatter file as well, where only a
@@ -53,6 +61,7 @@
5361
* with TF-M later FLPR volatile memory is not used by TF-M. */
5462
#define SRAM_BASE_ADDRESS (0x20000000)
5563
#define TOTAL_RAM_SIZE (0x000C0000) /* 768 kB, since other 256 kB are reserved for FLPR */
64+
#define S_RAM_PARTITION_SIZE (0x10000) /* 64 kB secure RAM */
5665

5766
#define FLASH_S_PARTITION_SIZE (0x80000) /* S partition: 512 kB*/
5867
#define FLASH_NS_PARTITION_SIZE (0xD3000) /* NS partition: 844 kB*/
@@ -101,8 +110,8 @@
101110

102111
/* Non-secure storage region */
103112
#define NRF_FLASH_NS_STORAGE_AREA_SIZE (0x8000) /* 32 KB */
104-
#define NRF_FLASH_NS_STORAGE_AREA_OFFSET (FLASH_TOTAL_SIZE - \
105-
NRF_FLASH_NS_STORAGE_AREA_SIZE)
113+
#define NRF_FLASH_NS_STORAGE_AREA_OFFSET (SECURE_STORAGE_PARTITIONS_END + \
114+
FLASH_NS_PARTITION_SIZE)
106115

107116
/* Flash device name used by BL2
108117
* Name is defined in flash driver file: Driver_Flash.c

platform/ext/target/nordic_nrf/common/nrf7120/partition/region_defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#define S_CODE_LIMIT (S_CODE_START + S_CODE_SIZE - 1)
5151

5252
#define S_DATA_START (S_RAM_ALIAS(0x0))
53-
#define S_DATA_SIZE (TOTAL_RAM_SIZE / 2)
53+
#define S_DATA_SIZE (S_RAM_PARTITION_SIZE)
5454
#define S_DATA_LIMIT (S_DATA_START + S_DATA_SIZE - 1)
5555

5656
/* Copied from the CONFIG_TFM_S_CODE_VECTOR_TABLE_SIZE in sdk-nrf */

0 commit comments

Comments
 (0)