Skip to content

Commit 3acae6a

Browse files
committed
platform: nrf7120: Add support for nrf7120
Add initial tfm support for nrf7120 This is based on nrf54l series soc, should have similar settings Added startup_nrf71 and target_cfg_71 to support this Change-Id: I83d9b971c4e46fc300092fd0badd30e2023639cc Signed-off-by: Travis Lam <[email protected]> (cherry picked from commit ae97268b372236bb1dc035955b2dd61aa1b03626)
1 parent 3f45b4e commit 3acae6a

32 files changed

+2434
-5
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ if((NRF_SOC_VARIANT MATCHES "^nrf54l1[05]$") OR
3434
# variables keep changing so we check both to be future proof
3535
set(HAS_RRAMC 1)
3636
set(HAS_CRACEN 1)
37+
elseif((NRF_SOC_VARIANT MATCHES nrf7120) OR (TFM_PLATFORM MATCHES "nordic\_nrf\/nrf7120pdk\_nrf7120\_cpuapp") OR (PSA_API_TEST_TARGET MATCHES "nrf7120"))
38+
set(HAS_MRAMC 1)
39+
set(HAS_CRACEN 1)
3740
else()
3841
set(HAS_NVMC 1)
3942
set(HAS_CRACEN 0)
@@ -93,6 +96,10 @@ if(HAS_RRAMC)
9396
list(APPEND nvm_sources
9497
${HAL_NORDIC_PATH}/nrfx/drivers/src/nrfx_rramc.c
9598
)
99+
elseif(HAS_MRAMC)
100+
list(APPEND nvm_sources
101+
${HAL_NORDIC_PATH}/nrfx/drivers/src/nrfx_mramc.c
102+
)
96103
elseif(HAS_NVMC)
97104
list(APPEND nvm_sources
98105
${HAL_NORDIC_PATH}/nrfx/drivers/src/nrfx_nvmc.c
@@ -213,6 +220,7 @@ target_sources(tfm_spm
213220
target_cfg.c
214221
$<$<BOOL:${HAS_RRAMC}>:${CMAKE_CURRENT_SOURCE_DIR}/target_cfg_54l.c>
215222
$<$<BOOL:${HAS_NVMC}>:${CMAKE_CURRENT_SOURCE_DIR}/target_cfg_53_91.c>
223+
$<$<BOOL:${HAS_MRAMC}>:${CMAKE_CURRENT_SOURCE_DIR}/target_cfg_71.c>
216224
secure_peripherals_defs.c
217225
)
218226

platform/ext/target/nordic_nrf/common/core/cmsis_drivers/Driver_Flash.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
#define WRITE_BUFFER_SIZE 0
4040
#endif
4141

42+
#elif defined(NRF_MRAMC_S)
43+
#include <nrfx_mramc.h>
4244
#else
4345
#error "Unrecognized platform"
4446
#endif
@@ -123,7 +125,15 @@ static int32_t ARM_Flash_Initialize(ARM_Flash_SignalEvent_t cb_event)
123125
if(err != NRFX_SUCCESS && err != NRFX_ERROR_ALREADY) {
124126
return err;
125127
}
126-
#endif /* RRAMC_PRESENT */
128+
#elif defined(MRAMC_PRESENT)
129+
nrfx_mramc_config_t config = NRFX_MRAMC_DEFAULT_CONFIG();
130+
131+
nrfx_err_t err = nrfx_mramc_init(&config, NULL);
132+
133+
if(err != NRFX_SUCCESS && err != NRFX_ERROR_ALREADY) {
134+
return err;
135+
}
136+
#endif /* RRAMC_PRESENT or MRAMC_PRESENT*/
127137
return ARM_DRIVER_OK;
128138
}
129139

@@ -166,7 +176,7 @@ static int32_t ARM_Flash_ProgramData(uint32_t addr, const void *data,
166176

167177
#ifdef NRF_NVMC_S
168178
nrfx_nvmc_words_write(addr, data, cnt);
169-
#else
179+
#elif defined(NRF_RRAMC_S)
170180
nrf_rramc_config_t rramc_config;
171181
nrf_rramc_config_get(NRF_RRAMC, &rramc_config);
172182
const nrf_rramc_config_t orig_rramc_config = rramc_config;
@@ -176,6 +186,18 @@ static int32_t ARM_Flash_ProgramData(uint32_t addr, const void *data,
176186
nrfx_rramc_words_write(addr, data, cnt);
177187

178188
nrf_rramc_config_set(NRF_RRAMC, &orig_rramc_config);
189+
#elif defined(NRF_MRAMC_S)
190+
nrf_mramc_readynext_timeout_t orig_readynext_timeout;
191+
nrf_mramc_readynext_timeout_get(NRF_MRAMC, &orig_readynext_timeout);
192+
nrf_mramc_readynext_timeout_t readynext_timeout = {
193+
.value = NRF_MRAMC_READYNEXTTIMEOUT_DEFAULT,
194+
.direct_write = true,
195+
};
196+
nrf_mramc_readynext_timeout_set(NRF_MRAMC, &readynext_timeout);
197+
198+
nrfx_mramc_words_write(addr, data, cnt);
199+
200+
nrf_mramc_readynext_timeout_set(NRF_MRAMC, &orig_readynext_timeout);
179201
#endif
180202

181203
return cnt;

platform/ext/target/nordic_nrf/common/core/nrfx_config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#define NRFX_NVMC_ENABLED 1
4343
#elif defined(NRF_RRAMC_S)
4444
#define NRFX_RRAMC_ENABLED 1
45+
#elif defined(NRF_MRAMC_S)
46+
#define NRFX_MRAMC_ENABLED 1
4547
#else
4648
#error "Unrecognized platform"
4749
#endif
@@ -102,6 +104,8 @@
102104
#include <nrfx_config_nrf91.h>
103105
#elif defined(NRF54L_SERIES)
104106
#include <nrfx_config_nrf54l.h>
107+
#elif defined(NRF71_SERIES)
108+
#include <nrfx_config_nrf71.h>
105109
#else
106110
#error "Unknown device."
107111
#endif

platform/ext/target/nordic_nrf/common/core/services/src/tfm_platform_hal_ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ tfm_platform_hal_read_service(const psa_invec *in_vec,
103103
static bool valid_mcu_select(uint32_t mcu)
104104
{
105105
switch (mcu) {
106-
#if defined(NRF54L_SERIES)
106+
#if defined(NRF54L_SERIES) || defined(NRF71_SERIES)
107107
case NRF_GPIO_PIN_SEL_GPIO:
108108
case NRF_GPIO_PIN_SEL_VPR:
109109
case NRF_GPIO_PIN_SEL_GRTC:

0 commit comments

Comments
 (0)