Skip to content

Commit 9e37509

Browse files
committed
platform: nordic_nrf: Add memory service header in common folder
When TF-M is build with Zephyr it now requires to have the platform user memory ranges header. This copies the memory range header into the common folder because Zephyr builds from the common folder. This is a workaround since the file is copied which is not ideal. I wanted to have a minimal commit that can be applied cleanly to the TF-M 2.2 branch and to the main branch and my intention is to have this header file only in the common folder and remove the duplicate later. Change-Id: I0590eafb4212fbb4c1dabbb0c1b7594673e6b19b Signed-off-by: Georgios Vasilakis <[email protected]>
1 parent f009be3 commit 9e37509

File tree

6 files changed

+110
-0
lines changed

6 files changed

+110
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ target_include_directories(platform_s
1919
.
2020
)
2121

22+
if(NOT NRF_DIR)
23+
target_include_directories(platform_s
24+
PUBLIC
25+
memory_service_ranges
26+
)
27+
endif()
28+
2229
target_sources(platform_s
2330
PRIVATE
2431
${HAL_NORDIC_PATH}/nrfx/mdk/system_nrf5340_application.c
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
#ifndef TFM_PLATFORM_USER_MEMORY_RANGES_H__
8+
#define TFM_PLATFORM_USER_MEMORY_RANGES_H__
9+
10+
#include <tfm_ioctl_core_api.h>
11+
12+
#include "nrf.h"
13+
14+
#define FICR_BASE NRF_FICR_S_BASE
15+
16+
#define FICR_INFO_ADDR (FICR_BASE + offsetof(NRF_FICR_Type, INFO))
17+
#define FICR_INFO_SIZE (sizeof(FICR_INFO_Type))
18+
19+
#define FICR_NFC_ADDR (FICR_BASE + offsetof(NRF_FICR_Type, NFC))
20+
#define FICR_NFC_SIZE (sizeof(FICR_NFC_Type))
21+
22+
#define FICR_XOSC32MTRIM_ADDR (FICR_BASE + offsetof(NRF_FICR_Type, XOSC32MTRIM))
23+
#define FICR_XOSC32MTRIM_SIZE (sizeof(uint32_t))
24+
25+
/* Used by nrf_erratas.h */
26+
#define FICR_RESTRICTED_ADDR (FICR_BASE + 0x130)
27+
#define FICR_RESTRICTED_SIZE 0x8
28+
29+
static const struct tfm_read_service_range ranges[] = {
30+
{ .start = FICR_INFO_ADDR, .size = FICR_INFO_SIZE },
31+
{ .start = FICR_NFC_ADDR, .size = FICR_NFC_SIZE },
32+
{ .start = FICR_RESTRICTED_ADDR, .size = FICR_RESTRICTED_SIZE },
33+
{ .start = FICR_XOSC32MTRIM_ADDR, .size = FICR_XOSC32MTRIM_SIZE },
34+
};
35+
36+
static const struct tfm_write32_service_address tfm_write32_service_addresses[] = {
37+
/* This is a dummy value because this table cannot be empty */
38+
{.addr = 0xFFFFFFFF, .mask = 0x0, .allowed_values = NULL, .allowed_values_array_size = 0},
39+
};
40+
41+
#endif /* TFM_PLATFORM_USER_MEMORY_RANGES_H__ */

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ target_include_directories(platform_s
1818
.
1919
)
2020

21+
if(NOT NRF_DIR)
22+
target_include_directories(platform_s
23+
PUBLIC
24+
memory_service_ranges
25+
)
26+
endif()
27+
2128
target_sources(platform_s
2229
PRIVATE
2330
${HAL_NORDIC_PATH}/nrfx/mdk/system_nrf54l.c
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
#ifndef TFM_PLATFORM_USER_MEMORY_RANGES_H__
8+
#define TFM_PLATFORM_USER_MEMORY_RANGES_H__
9+
10+
#include <tfm_ioctl_core_api.h>
11+
12+
#include "nrf.h"
13+
14+
15+
static const struct tfm_read_service_range ranges[] = {
16+
{ .start = 0xFFFFFFFF, .size = 0x0},
17+
};
18+
19+
static const struct tfm_write32_service_address tfm_write32_service_addresses[] = {
20+
/* This is a dummy value because this table cannot be empty */
21+
{.addr = 0xFFFFFFFF, .mask = 0x0, .allowed_values = NULL, .allowed_values_array_size = 0},
22+
};
23+
24+
#endif /* TFM_PLATFORM_USER_MEMORY_RANGES_H__ */

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ target_include_directories(platform_s
1919
.
2020
)
2121

22+
if(NOT NRF_DIR)
23+
target_include_directories(platform_s
24+
PUBLIC
25+
memory_service_ranges
26+
)
27+
endif()
28+
2229
target_sources(platform_s
2330
PRIVATE
2431
${HAL_NORDIC_PATH}/nrfx/mdk/system_nrf91.c
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
#ifndef TFM_PLATFORM_USER_MEMORY_RANGES_H__
8+
#define TFM_PLATFORM_USER_MEMORY_RANGES_H__
9+
10+
#include <tfm_ioctl_core_api.h>
11+
12+
#include "nrf.h"
13+
14+
15+
static const struct tfm_read_service_range ranges[] = {
16+
{ .start = 0xFFFFFFFF, .size = 0x0},
17+
};
18+
19+
static const struct tfm_write32_service_address tfm_write32_service_addresses[] = {
20+
/* This is a dummy value because this table cannot be empty */
21+
{.addr = 0xFFFFFFFF, .mask = 0x0, .allowed_values = NULL, .allowed_values_array_size = 0},
22+
};
23+
24+
#endif /* TFM_PLATFORM_USER_MEMORY_RANGES_H__ */

0 commit comments

Comments
 (0)