Skip to content

Commit 188eae4

Browse files
Vge0rgetomi-font
authored andcommitted
Revert "Revert "platform: nordic_nrf: Move partition folder for nordic boards""
This reverts commit 806fc7f.
1 parent 88ac039 commit 188eae4

File tree

14 files changed

+490
-17
lines changed

14 files changed

+490
-17
lines changed

platform/ext/target/nordic_nrf/common/nrf5340/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,5 @@ install(FILES nrfx_config_nrf5340_application.h
6363
)
6464

6565
install(DIRECTORY tests
66-
partition
6766
DESTINATION ${INSTALL_PLATFORM_NS_DIR}/common/nrf5340
6867
)

platform/ext/target/nordic_nrf/common/nrf91/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,5 @@ install(FILES nrfx_config_nrf91.h
6464
)
6565

6666
install(DIRECTORY tests
67-
partition
6867
DESTINATION ${INSTALL_PLATFORM_NS_DIR}/common/nrf91
6968
)

platform/ext/target/nordic_nrf/nrf5340dk_nrf5340_cpuapp/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ add_subdirectory(../common/nrf5340 nrf5340)
1414

1515
target_include_directories(platform_region_defs
1616
INTERFACE
17-
../common/nrf5340/partition
17+
partition
1818
)
1919

2020
target_sources(platform_s
@@ -25,14 +25,14 @@ target_sources(platform_s
2525
target_include_directories(platform_s
2626
PUBLIC
2727
.
28-
../common/nrf5340/partition
28+
partition
2929
services/include
3030
)
3131

3232
if(BL2)
3333
target_include_directories(platform_bl2
3434
PUBLIC
35-
../common/nrf5340/partition
35+
partition
3636
PRIVATE
3737
.
3838
)
@@ -64,6 +64,7 @@ install(FILES RTE_Device.h
6464
DESTINATION ${INSTALL_PLATFORM_NS_DIR}
6565
)
6666

67-
install(DIRECTORY tests
67+
install(DIRECTORY partition
68+
tests
6869
DESTINATION ${INSTALL_PLATFORM_NS_DIR}
6970
)

platform/ext/target/nordic_nrf/nrf5340dk_nrf5340_cpuapp/ns/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ target_link_libraries(platform_ns
2727

2828
target_include_directories(platform_region_defs
2929
INTERFACE
30-
${CMAKE_CURRENT_LIST_DIR}/common/nrf5340/partition
30+
${CMAKE_CURRENT_LIST_DIR}/partition
3131
)

platform/ext/target/nordic_nrf/nrf9160dk_nrf9160/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ add_subdirectory(../common/nrf91 nrf91)
1414

1515
target_include_directories(platform_region_defs
1616
INTERFACE
17-
../common/nrf91/partition
17+
partition
1818
)
1919

2020
target_sources(platform_s
@@ -25,14 +25,14 @@ target_sources(platform_s
2525
target_include_directories(platform_s
2626
PUBLIC
2727
.
28-
../common/nrf91/partition
28+
partition
2929
services/include
3030
)
3131

3232
if(BL2)
3333
target_include_directories(platform_bl2
3434
PUBLIC
35-
../common/nrf91/partition
35+
partition
3636
PRIVATE
3737
.
3838
)
@@ -69,6 +69,7 @@ install(FILES RTE_Device.h
6969
DESTINATION ${INSTALL_PLATFORM_NS_DIR}
7070
)
7171

72-
install(DIRECTORY tests
72+
install(DIRECTORY partition
73+
tests
7374
DESTINATION ${INSTALL_PLATFORM_NS_DIR}
7475
)

platform/ext/target/nordic_nrf/nrf9160dk_nrf9160/ns/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common/nrf91 nrf91)
1717

1818
target_include_directories(platform_region_defs
1919
INTERFACE
20-
${CMAKE_CURRENT_LIST_DIR}/common/nrf91/partition
20+
${CMAKE_CURRENT_LIST_DIR}/partition
2121
)
2222

2323
target_include_directories(platform_ns

platform/ext/target/nordic_nrf/nrf9161dk_nrf9161/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_subdirectory(../common/nrf91 nrf91)
1212

1313
target_include_directories(platform_region_defs
1414
INTERFACE
15-
../common/nrf91/partition
15+
partition
1616
)
1717

1818
target_sources(platform_s
@@ -23,14 +23,14 @@ target_sources(platform_s
2323
target_include_directories(platform_s
2424
PUBLIC
2525
.
26-
../common/nrf91/partition
26+
partition
2727
services/include
2828
)
2929

3030
if(BL2)
3131
target_include_directories(platform_bl2
3232
PUBLIC
33-
../common/nrf91/partition
33+
partition
3434
PRIVATE
3535
.
3636
)
@@ -67,6 +67,7 @@ install(FILES RTE_Device.h
6767
DESTINATION ${INSTALL_PLATFORM_NS_DIR}
6868
)
6969

70-
install(DIRECTORY tests
70+
install(DIRECTORY partition
71+
tests
7172
DESTINATION ${INSTALL_PLATFORM_NS_DIR}
7273
)

platform/ext/target/nordic_nrf/nrf9161dk_nrf9161/ns/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common/nrf91 nrf91)
1616

1717
target_include_directories(platform_region_defs
1818
INTERFACE
19-
${CMAKE_CURRENT_LIST_DIR}/common/nrf91/partition
19+
${CMAKE_CURRENT_LIST_DIR}/partition
2020
)
2121

2222
target_include_directories(platform_ns
Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
/*
2+
* Copyright (c) 2018-2022 Arm Limited. All rights reserved.
3+
* Copyright (c) 2020 Nordic Semiconductor ASA. All rights reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#ifndef __FLASH_LAYOUT_H__
19+
#define __FLASH_LAYOUT_H__
20+
21+
/* Flash layout on nRF91 with BL2:
22+
*
23+
* 0x0000_0000 BL2 - MCUBoot (64 KB)
24+
* 0x0001_0000 Primary image area (448 KB):
25+
* 0x0001_0000 Secure image primary (256 KB)
26+
* 0x0005_0000 Non-secure image primary (192 KB)
27+
* 0x0008_0000 Secondary image area (448 KB):
28+
* 0x0008_0000 Secure image secondary (256 KB)
29+
* 0x000c_0000 Non-secure image secondary (192 KB)
30+
* 0x000f_0000 Protected Storage Area (16 KB)
31+
* 0x000f_4000 Internal Trusted Storage Area (8 KB)
32+
* 0x000f_6000 OTP / NV counters area (8 KB)
33+
* 0x000f_8000 Non-secure storage, used when built with NRF_NS_STORAGE=ON,
34+
* otherwise unused (32 KB)
35+
*
36+
* Flash layout on nRF91 without BL2:
37+
*
38+
* 0x0000_0000 Primary image area (960 KB):
39+
* 0x0000_0000 Secure image primary (480 KB)
40+
* 0x0007_8000 Non-secure image primary (480 KB)
41+
* 0x000f_0000 Protected Storage Area (16 KB)
42+
* 0x000f_4000 Internal Trusted Storage Area (8 KB)
43+
* 0x000f_6000 OTP / NV counters area (8 KB)
44+
* 0x000f_8000 Non-secure storage, used when built with NRF_NS_STORAGE=ON,
45+
* otherwise unused (32 KB)
46+
*/
47+
48+
/* This header file is included from linker scatter file as well, where only a
49+
* limited C constructs are allowed. Therefore it is not possible to include
50+
* here the platform_base_address.h to access flash related defines. To resolve
51+
* this some of the values are redefined here with different names, these are
52+
* marked with comment.
53+
*/
54+
55+
/* Size of a Secure and of a Non-secure image */
56+
#ifdef PSA_API_TEST_IPC
57+
/* Firmware Framework test suites */
58+
#define FLASH_S_PARTITION_SIZE (0x48000) /* S partition: 288 kB*/
59+
#define FLASH_NS_PARTITION_SIZE (0x28000) /* NS partition: 160 kB*/
60+
#else
61+
#define FLASH_S_PARTITION_SIZE (0x40000) /* S partition: 256 kB*/
62+
#define FLASH_NS_PARTITION_SIZE (0x30000) /* NS partition: 192 kB*/
63+
#endif
64+
65+
#if (FLASH_S_PARTITION_SIZE > FLASH_NS_PARTITION_SIZE)
66+
#define FLASH_MAX_PARTITION_SIZE FLASH_S_PARTITION_SIZE
67+
#else
68+
#define FLASH_MAX_PARTITION_SIZE FLASH_NS_PARTITION_SIZE
69+
#endif
70+
/* Sector size of the embedded flash hardware (erase/program) */
71+
#define FLASH_AREA_IMAGE_SECTOR_SIZE (0x1000) /* 4 KB. Flash memory program/erase operations have a page granularity. */
72+
73+
/* FLASH size */
74+
#define FLASH_TOTAL_SIZE (0x100000) /* 1024 kB. */
75+
76+
/* Flash layout info for BL2 bootloader */
77+
#define FLASH_BASE_ADDRESS (0x00000000)
78+
79+
80+
/* Offset and size definitions of the flash partitions that are handled by the
81+
* bootloader. The image swapping is done between IMAGE_PRIMARY and
82+
* IMAGE_SECONDARY, SCRATCH is used as a temporary storage during image
83+
* swapping.
84+
*/
85+
#define FLASH_AREA_BL2_OFFSET (0x0)
86+
#define FLASH_AREA_BL2_SIZE (0x10000) /* 64 KB */
87+
88+
#if !defined(MCUBOOT_IMAGE_NUMBER) || (MCUBOOT_IMAGE_NUMBER == 1)
89+
/* Secure + Non-secure image primary slot */
90+
#define FLASH_AREA_0_ID (1)
91+
#define FLASH_AREA_0_OFFSET (FLASH_AREA_BL2_OFFSET + FLASH_AREA_BL2_SIZE)
92+
#define FLASH_AREA_0_SIZE (FLASH_S_PARTITION_SIZE + \
93+
FLASH_NS_PARTITION_SIZE)
94+
/* Secure + Non-secure secondary slot */
95+
#define FLASH_AREA_2_ID (FLASH_AREA_0_ID + 1)
96+
#define FLASH_AREA_2_OFFSET (FLASH_AREA_0_OFFSET + FLASH_AREA_0_SIZE)
97+
#define FLASH_AREA_2_SIZE (FLASH_S_PARTITION_SIZE + \
98+
FLASH_NS_PARTITION_SIZE)
99+
/* Not used, only the Non-swapping firmware upgrade operation
100+
* is supported on nRF91.
101+
*/
102+
#define FLASH_AREA_SCRATCH_ID (FLASH_AREA_2_ID + 1)
103+
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_2_OFFSET + FLASH_AREA_2_SIZE)
104+
#define FLASH_AREA_SCRATCH_SIZE (0)
105+
/* Maximum number of image sectors supported by the bootloader. */
106+
#define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
107+
FLASH_NS_PARTITION_SIZE) / \
108+
FLASH_AREA_IMAGE_SECTOR_SIZE)
109+
#elif (MCUBOOT_IMAGE_NUMBER == 2)
110+
/* Secure image primary slot */
111+
#define FLASH_AREA_0_ID (1)
112+
#define FLASH_AREA_0_OFFSET (FLASH_AREA_BL2_OFFSET + FLASH_AREA_BL2_SIZE)
113+
#define FLASH_AREA_0_SIZE (FLASH_S_PARTITION_SIZE)
114+
/* Non-secure image primary slot */
115+
#define FLASH_AREA_1_ID (FLASH_AREA_0_ID + 1)
116+
#define FLASH_AREA_1_OFFSET (FLASH_AREA_0_OFFSET + FLASH_AREA_0_SIZE)
117+
#define FLASH_AREA_1_SIZE (FLASH_NS_PARTITION_SIZE)
118+
/* Secure image secondary slot */
119+
#define FLASH_AREA_2_ID (FLASH_AREA_1_ID + 1)
120+
#define FLASH_AREA_2_OFFSET (FLASH_AREA_1_OFFSET + FLASH_AREA_1_SIZE)
121+
#define FLASH_AREA_2_SIZE (FLASH_S_PARTITION_SIZE)
122+
/* Non-secure image secondary slot */
123+
#define FLASH_AREA_3_ID (FLASH_AREA_2_ID + 1)
124+
#define FLASH_AREA_3_OFFSET (FLASH_AREA_2_OFFSET + FLASH_AREA_2_SIZE)
125+
#define FLASH_AREA_3_SIZE (FLASH_NS_PARTITION_SIZE)
126+
/* Not used, only the Non-swapping firmware upgrade operation
127+
* is supported on nRF91.
128+
*/
129+
#define FLASH_AREA_SCRATCH_ID (FLASH_AREA_3_ID + 1)
130+
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_3_OFFSET + FLASH_AREA_3_SIZE)
131+
#define FLASH_AREA_SCRATCH_SIZE (0)
132+
/* Maximum number of image sectors supported by the bootloader. */
133+
#define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
134+
FLASH_AREA_IMAGE_SECTOR_SIZE)
135+
#else /* MCUBOOT_IMAGE_NUMBER > 2 */
136+
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
137+
#endif /* MCUBOOT_IMAGE_NUMBER */
138+
139+
/* Not used, only the Non-swapping firmware upgrade operation
140+
* is supported on nRF91. The maximum number of status entries
141+
* supported by the bootloader.
142+
*/
143+
#define MCUBOOT_STATUS_MAX_ENTRIES (0)
144+
145+
146+
/* Protected Storage (PS) Service definitions */
147+
#define FLASH_PS_AREA_OFFSET (FLASH_AREA_SCRATCH_OFFSET + \
148+
FLASH_AREA_SCRATCH_SIZE)
149+
#define FLASH_PS_AREA_SIZE (0x4000) /* 16 KB */
150+
151+
/* Internal Trusted Storage (ITS) Service definitions */
152+
#define FLASH_ITS_AREA_OFFSET (FLASH_PS_AREA_OFFSET + \
153+
FLASH_PS_AREA_SIZE)
154+
#define FLASH_ITS_AREA_SIZE (0x2000) /* 8 KB */
155+
156+
/* OTP_definitions */
157+
#define FLASH_OTP_NV_COUNTERS_AREA_OFFSET (FLASH_ITS_AREA_OFFSET + \
158+
FLASH_ITS_AREA_SIZE)
159+
#define FLASH_OTP_NV_COUNTERS_AREA_SIZE (FLASH_AREA_IMAGE_SECTOR_SIZE * 2)
160+
#define FLASH_OTP_NV_COUNTERS_SECTOR_SIZE FLASH_AREA_IMAGE_SECTOR_SIZE
161+
162+
/* Non-secure storage region */
163+
#define NRF_FLASH_NS_STORAGE_AREA_OFFSET (FLASH_TOTAL_SIZE - \
164+
NRF_FLASH_NS_STORAGE_AREA_SIZE)
165+
#define NRF_FLASH_NS_STORAGE_AREA_SIZE (0x8000) /* 32 KB */
166+
167+
/* Offset and size definition in flash area used by assemble.py */
168+
#define SECURE_IMAGE_OFFSET (0x0)
169+
#define SECURE_IMAGE_MAX_SIZE FLASH_S_PARTITION_SIZE
170+
171+
#define NON_SECURE_IMAGE_OFFSET (SECURE_IMAGE_OFFSET + \
172+
SECURE_IMAGE_MAX_SIZE)
173+
#define NON_SECURE_IMAGE_MAX_SIZE FLASH_NS_PARTITION_SIZE
174+
175+
/* Flash device name used by BL2
176+
* Name is defined in flash driver file: Driver_Flash.c
177+
*/
178+
#define FLASH_DEV_NAME Driver_FLASH0
179+
/* Smallest flash programmable unit in bytes */
180+
#define TFM_HAL_FLASH_PROGRAM_UNIT (0x4)
181+
182+
/* Protected Storage (PS) Service definitions
183+
* Note: Further documentation of these definitions can be found in the
184+
* TF-M PS Integration Guide.
185+
*/
186+
#define TFM_HAL_PS_FLASH_DRIVER Driver_FLASH0
187+
188+
/* In this target the CMSIS driver requires only the offset from the base
189+
* address instead of the full memory address.
190+
*/
191+
/* Base address of dedicated flash area for PS */
192+
#define TFM_HAL_PS_FLASH_AREA_ADDR FLASH_PS_AREA_OFFSET
193+
/* Size of dedicated flash area for PS */
194+
#define TFM_HAL_PS_FLASH_AREA_SIZE FLASH_PS_AREA_SIZE
195+
#define PS_RAM_FS_SIZE TFM_HAL_PS_FLASH_AREA_SIZE
196+
/* Number of physical erase sectors per logical FS block */
197+
#define TFM_HAL_PS_SECTORS_PER_BLOCK (1)
198+
/* Smallest flash programmable unit in bytes */
199+
#define TFM_HAL_PS_PROGRAM_UNIT (0x4)
200+
201+
/* Internal Trusted Storage (ITS) Service definitions
202+
* Note: Further documentation of these definitions can be found in the
203+
* TF-M ITS Integration Guide. The ITS should be in the internal flash, but is
204+
* allocated in the external flash just for development platforms that don't
205+
* have internal flash available.
206+
*/
207+
#define TFM_HAL_ITS_FLASH_DRIVER Driver_FLASH0
208+
209+
/* In this target the CMSIS driver requires only the offset from the base
210+
* address instead of the full memory address.
211+
*/
212+
/* Base address of dedicated flash area for ITS */
213+
#define TFM_HAL_ITS_FLASH_AREA_ADDR FLASH_ITS_AREA_OFFSET
214+
/* Size of dedicated flash area for ITS */
215+
#define TFM_HAL_ITS_FLASH_AREA_SIZE FLASH_ITS_AREA_SIZE
216+
#define ITS_RAM_FS_SIZE TFM_HAL_ITS_FLASH_AREA_SIZE
217+
/* Number of physical erase sectors per logical FS block */
218+
#define TFM_HAL_ITS_SECTORS_PER_BLOCK (1)
219+
/* Smallest flash programmable unit in bytes */
220+
#define TFM_HAL_ITS_PROGRAM_UNIT (0x4)
221+
222+
/* OTP / NV counter definitions */
223+
#define TFM_OTP_NV_COUNTERS_AREA_SIZE (FLASH_OTP_NV_COUNTERS_AREA_SIZE / 2)
224+
#define TFM_OTP_NV_COUNTERS_AREA_ADDR FLASH_OTP_NV_COUNTERS_AREA_OFFSET
225+
#define TFM_OTP_NV_COUNTERS_SECTOR_SIZE FLASH_OTP_NV_COUNTERS_SECTOR_SIZE
226+
#define TFM_OTP_NV_COUNTERS_BACKUP_AREA_ADDR (TFM_OTP_NV_COUNTERS_AREA_ADDR + \
227+
TFM_OTP_NV_COUNTERS_AREA_SIZE)
228+
229+
/* Use Flash memory to store Code data */
230+
#define FLASH_BASE_ADDRESS (0x00000000)
231+
#define S_ROM_ALIAS_BASE FLASH_BASE_ADDRESS
232+
#define NS_ROM_ALIAS_BASE FLASH_BASE_ADDRESS
233+
234+
/* Use SRAM memory to store RW data */
235+
#define SRAM_BASE_ADDRESS (0x20000000)
236+
#define S_RAM_ALIAS_BASE SRAM_BASE_ADDRESS
237+
#define NS_RAM_ALIAS_BASE SRAM_BASE_ADDRESS
238+
239+
#define TOTAL_ROM_SIZE FLASH_TOTAL_SIZE
240+
#define TOTAL_RAM_SIZE (0x00040000) /* 256 kB */
241+
242+
#endif /* __FLASH_LAYOUT_H__ */

0 commit comments

Comments
 (0)