blob: 48aa069438bf153adc5e487c92e8943bcc14e9c4 [file] [log] [blame]
Gabor Abonyi0a32b4e2024-10-25 09:34:08 +02001From c847b6f8e482b7785a243bd2560405266201197a Mon Sep 17 00:00:00 2001
2From: Gabor Abonyi <gabor.abonyi@arm.com>
3Date: Thu, 8 Aug 2024 15:44:55 +0200
4Subject: [PATCH] Add rp2350 platform
5
6Change-Id: I50777e655dfecdac7e4cacecbff8459efa4d7a77
7Signed-off-by: Gabor Abonyi <gabor.abonyi@arm.com>
8---
9 .../drivers/watchdog/rpi/pal_wd_rpi.c | 104 +++++
10 .../drivers/watchdog/rpi/pal_wd_rpi.h | 35 ++
11 .../nspe/pal_attestation_config.h | 108 +++++
12 .../tgt_dev_apis_tfm_rp2350/nspe/pal_config.h | 97 +++++
13 .../nspe/pal_crypto_config.h | 404 ++++++++++++++++++
14 .../nspe/pal_driver_intf.c | 143 +++++++
15 .../nspe/pal_storage_config.h | 24 ++
16 .../tgt_dev_apis_tfm_rp2350/target.cfg | 41 ++
17 .../tgt_dev_apis_tfm_rp2350/target.cmake | 97 +++++
18 .../tgt_ff_tfm_rp2350/nspe/pal_config.h | 71 +++
19 .../nspe/pal_driver_ipc_intf.c | 338 +++++++++++++++
20 .../tgt_ff_tfm_rp2350/spe/pal_driver_intf.c | 132 ++++++
21 .../tgt_ff_tfm_rp2350/spe/pal_driver_intf.h | 35 ++
22 .../targets/tgt_ff_tfm_rp2350/target.cfg | 64 +++
23 .../targets/tgt_ff_tfm_rp2350/target.cmake | 74 ++++
24 15 files changed, 1767 insertions(+)
25 create mode 100644 api-tests/platform/drivers/watchdog/rpi/pal_wd_rpi.c
26 create mode 100644 api-tests/platform/drivers/watchdog/rpi/pal_wd_rpi.h
27 create mode 100644 api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_attestation_config.h
28 create mode 100644 api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_config.h
29 create mode 100644 api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_crypto_config.h
30 create mode 100644 api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_driver_intf.c
31 create mode 100644 api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_storage_config.h
32 create mode 100644 api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/target.cfg
33 create mode 100644 api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/target.cmake
34 create mode 100644 api-tests/platform/targets/tgt_ff_tfm_rp2350/nspe/pal_config.h
35 create mode 100644 api-tests/platform/targets/tgt_ff_tfm_rp2350/nspe/pal_driver_ipc_intf.c
36 create mode 100644 api-tests/platform/targets/tgt_ff_tfm_rp2350/spe/pal_driver_intf.c
37 create mode 100644 api-tests/platform/targets/tgt_ff_tfm_rp2350/spe/pal_driver_intf.h
38 create mode 100644 api-tests/platform/targets/tgt_ff_tfm_rp2350/target.cfg
39 create mode 100644 api-tests/platform/targets/tgt_ff_tfm_rp2350/target.cmake
40
41diff --git a/api-tests/platform/drivers/watchdog/rpi/pal_wd_rpi.c b/api-tests/platform/drivers/watchdog/rpi/pal_wd_rpi.c
42new file mode 100644
43index 0000000..a6bea07
44--- /dev/null
45+++ b/api-tests/platform/drivers/watchdog/rpi/pal_wd_rpi.c
46@@ -0,0 +1,104 @@
47+/** @file
48+ * Copyright (c) 2024, Arm Limited or its affiliates. All rights reserved.
49+ * SPDX-License-Identifier : Apache-2.0
50+ *
51+ * Licensed under the Apache License, Version 2.0 (the "License");
52+ * you may not use this file except in compliance with the License.
53+ * You may obtain a copy of the License at
54+ *
55+ * http://www.apache.org/licenses/LICENSE-2.0
56+ *
57+ * Unless required by applicable law or agreed to in writing, software
58+ * distributed under the License is distributed on an "AS IS" BASIS,
59+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
60+ * See the License for the specific language governing permissions and
61+ * limitations under the License.
62+**/
63+
64+#include "pal_wd_rpi.h"
65+
66+
67+#define REG_ALIAS_SET_BITS ((0x2u) << (12u))
68+#define REG_ALIAS_CLR_BITS ((0x3u) << (12u))
69+
70+#define SET_ADDR_ALIAS(addr) ((void *)(REG_ALIAS_SET_BITS + (addr)))
71+#define CLR_ADDR_ALIAS(addr) ((void *)(REG_ALIAS_CLR_BITS + (addr)))
72+
73+#define HW_SET_BITS(addr, mask) \
74+ do{*(uint32_t *) SET_ADDR_ALIAS((volatile void *) addr) = mask;}while(0)
75+
76+#define HW_CLEAR_BITS(addr, mask) \
77+ do{*(uint32_t *) CLR_ADDR_ALIAS((volatile void *) addr) = mask;}while(0)
78+
79+/**
80+ @brief - Initializes an hardware watchdog timer
81+ @param - base_addr : Base address of the watchdog module
82+ - time_us : Time in micro seconds
83+ - timer_tick_us : Number of ticks per micro second
84+ @return - SUCCESS/FAILURE
85+**/
86+int pal_wd_rpi_init(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
87+{
88+ /* Disable Timer */
89+ HW_CLEAR_BITS(&((wd_timer_t *)base_addr)->CTRL, WATCHDOG_CTRL_ENABLE_BITS);
90+
91+ uint32_t dbg_bits = WATCHDOG_CTRL_PAUSE_DBG0_BITS |
92+ WATCHDOG_CTRL_PAUSE_DBG1_BITS |
93+ WATCHDOG_CTRL_PAUSE_JTAG_BITS;
94+ /* Pause on debug */
95+ HW_SET_BITS(&((wd_timer_t *)base_addr)->CTRL, dbg_bits);
96+
97+ if (time_us == 0)
98+ {
99+ HW_SET_BITS(&((wd_timer_t *)base_addr)->CTRL, WATCHDOG_CTRL_TRIGGER_BITS);
100+ }
101+ else
102+ {
103+ uint32_t load_value = time_us * timer_tick_us;
104+ if (load_value > WATCHDOG_LOAD_BITS)
105+ {
106+ load_value = WATCHDOG_LOAD_BITS;
107+ }
108+ /* Set Load value */
109+ ((wd_timer_t *)base_addr)->LOAD = load_value;
110+ }
111+
112+ return 0;
113+}
114+
115+/**
116+ @brief - Enables a hardware watchdog timer
117+ @param - base_addr : Base address of the watchdog module
118+ @return - SUCCESS/FAILURE
119+**/
120+int pal_wd_rpi_enable(addr_t base_addr)
121+{
122+ /* Enable counter */
123+ HW_SET_BITS(&((wd_timer_t *)base_addr)->CTRL, WATCHDOG_CTRL_ENABLE_BITS);
124+
125+ return 0;
126+}
127+
128+/**
129+ @brief - Disables a hardware watchdog timer
130+ @param - base_addr : Base address of the watchdog module
131+ @return - SUCCESS/FAILURE
132+**/
133+int pal_wd_rpi_disable(addr_t base_addr)
134+{
135+ /* Disable Timer */
136+ HW_CLEAR_BITS(&((wd_timer_t *)base_addr)->CTRL, WATCHDOG_CTRL_ENABLE_BITS);
137+
138+ return 0;
139+}
140+
141+/**
142+ @brief - Checks whether hardware watchdog timer is enabled
143+ @param - base_addr : Base address of the watchdog module
144+ @return - Enabled : 1, Disabled : 0
145+**/
146+int pal_wd_rpi_is_enabled(addr_t base_addr)
147+{
148+ return (((wd_timer_t *)base_addr)->CTRL & WATCHDOG_CTRL_ENABLE_BITS ? 1 : 0);
149+}
150+
151diff --git a/api-tests/platform/drivers/watchdog/rpi/pal_wd_rpi.h b/api-tests/platform/drivers/watchdog/rpi/pal_wd_rpi.h
152new file mode 100644
153index 0000000..da2f0b8
154--- /dev/null
155+++ b/api-tests/platform/drivers/watchdog/rpi/pal_wd_rpi.h
156@@ -0,0 +1,35 @@
157+/** @file
158+ * Copyright (c) 2024, Arm Limited. All rights reserved.
159+ *
160+ * SPDX-License-Identifier: BSD-3-Clause
161+ *
162+**/
163+
164+#ifndef _PAL_WD_RPI_H_
165+#define _PAL_WD_RPI_H_
166+
167+#include "pal_common.h"
168+
169+#define WDOG_TIMER_MAX_VALUE 0xFFFFFFFF
170+
171+typedef struct {
172+ uint32_t CTRL; /* Offset: 0x000 (R/W) Watchdog Control Register */
173+ uint32_t LOAD; /* Offset: 0x004 (R/W) Watchdog Load Register */
174+ uint32_t REASON; /* Offset: 0x008 (R/ ) Watchdog Reason Register */
175+ uint32_t SCRATCH[8]; /* Offset: 0x00C (R/ ) Watchdog Reason Register */
176+} wd_timer_t;
177+
178+#define WATCHDOG_CTRL_TRIGGER_BITS (0x80000000)
179+#define WATCHDOG_CTRL_ENABLE_BITS (0x40000000)
180+#define WATCHDOG_CTRL_PAUSE_DBG1_BITS (0x04000000)
181+#define WATCHDOG_CTRL_PAUSE_DBG0_BITS (0x02000000)
182+#define WATCHDOG_CTRL_PAUSE_JTAG_BITS (0x01000000)
183+
184+#define WATCHDOG_LOAD_BITS (0x00ffffff)
185+
186+int pal_wd_rpi_init(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us);
187+int pal_wd_rpi_enable(addr_t base_addr);
188+int pal_wd_rpi_disable(addr_t base_addr);
189+int pal_wd_rpi_is_enabled(addr_t base_addr);
190+
191+#endif /* _PAL_WD_RPI_H_ */
192diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_attestation_config.h b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_attestation_config.h
193new file mode 100644
194index 0000000..0cb190c
195--- /dev/null
196+++ b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_attestation_config.h
197@@ -0,0 +1,108 @@
198+/** @file
199+ * Copyright (c) 2020-2024, Arm Limited or its affiliates. All rights reserved.
200+ * SPDX-License-Identifier : Apache-2.0
201+ *
202+ * Licensed under the Apache License, Version 2.0 (the "License");
203+ * you may not use this file except in compliance with the License.
204+ * You may obtain a copy of the License at
205+ *
206+ * http://www.apache.org/licenses/LICENSE-2.0
207+ *
208+ * Unless required by applicable law or agreed to in writing, software
209+ * distributed under the License is distributed on an "AS IS" BASIS,
210+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
211+ * See the License for the specific language governing permissions and
212+ * limitations under the License.
213+**/
214+
215+#ifndef _PAL_ATTESTATION_CONFIG_H_
216+#define _PAL_ATTESTATION_CONFIG_H_
217+
218+#define COSE_ALGORITHM_ES256 -7
219+#define COSE_ALG_SHA256_PROPRIETARY -72000
220+
221+#define USEFUL_BUF_MAKE_STACK_UB UsefulBuf_MAKE_STACK_UB
222+
223+#define COSE_SIG_CONTEXT_STRING_SIGNATURE1 "Signature1"
224+
225+/* Private value. Intentionally not documented for Doxygen.
226+ * This is the size allocated for the encoded protected headers. It
227+ * needs to be big enough for make_protected_header() to succeed. It
228+ * currently sized for one header with an algorithm ID up to 32 bits
229+ * long -- one byte for the wrapping map, one byte for the label, 5
230+ * bytes for the ID. If this is made accidentially too small, QCBOR will
231+ * only return an error, and not overrun any buffers.
232+ *
233+ * 9 extra bytes are added, rounding it up to 16 total, in case some
234+ * other protected header is to be added.
235+ */
236+#define T_COSE_SIGN1_MAX_PROT_HEADER (1+1+5+9)
237+
238+/**
239+ * This is the size of the first part of the CBOR encoded TBS
240+ * bytes. It is around 20 bytes. See create_tbs_hash().
241+ */
242+#define T_COSE_SIZE_OF_TBS \
243+ 1 + /* For opening the array */ \
244+ sizeof(COSE_SIG_CONTEXT_STRING_SIGNATURE1) + /* "Signature1" */ \
245+ 2 + /* Overhead for encoding string */ \
246+ T_COSE_SIGN1_MAX_PROT_HEADER + /* entire protected headers */ \
247+ 3 * (/* 3 NULL bstrs for fields not used */ \
248+ 1 /* size of a NULL bstr */ \
249+ )
250+#define NULL_USEFUL_BUF_C NULLUsefulBufC
251+
252+#define ATTEST_PUBLIC_KEY_SLOT 4
253+#define ECC_CURVE_SECP256R1_PULBIC_KEY_LENGTH (1 + 2 * PSA_BITS_TO_BYTES(256))
254+
255+typedef struct {
256+ uint8_t *pubx_key;
257+ size_t pubx_key_size;
258+ uint8_t *puby_key;
259+ size_t puby_key_size;
260+} ecc_key_t;
261+
262+struct ecc_public_key_t {
263+ const uint8_t a;
264+ uint8_t public_key[]; /* X-coordinate || Y-coordinate */
265+};
266+
267+static const struct ecc_public_key_t attest_public_key = {
268+ /* Constant byte */
269+ .a = 0x04,
270+ /* X-coordinate */
271+ .public_key = {
272+ 0x79, 0xEB, 0xA9, 0x0E, 0x8B, 0xF4, 0x50, 0xA6,
273+ 0x75, 0x15, 0x76, 0xAD, 0x45, 0x99, 0xB0, 0x7A,
274+ 0xDF, 0x93, 0x8D, 0xA3, 0xBB, 0x0B, 0xD1, 0x7D,
275+ 0x00, 0x36, 0xED, 0x49, 0xA2, 0xD0, 0xFC, 0x3F,
276+ /* Y-coordinate */
277+ 0xBF, 0xCD, 0xFA, 0x89, 0x56, 0xB5, 0x68, 0xBF,
278+ 0xDB, 0x86, 0x73, 0xE6, 0x48, 0xD8, 0xB5, 0x8D,
279+ 0x92, 0x99, 0x55, 0xB1, 0x4A, 0x26, 0xC3, 0x08,
280+ 0x0F, 0x34, 0x11, 0x7D, 0x97, 0x1D, 0x68, 0x64},
281+};
282+
283+static const uint8_t initial_attestation_public_x_key[] = {
284+ 0x79, 0xEB, 0xA9, 0x0E, 0x8B, 0xF4, 0x50, 0xA6,
285+ 0x75, 0x15, 0x76, 0xAD, 0x45, 0x99, 0xB0, 0x7A,
286+ 0xDF, 0x93, 0x8D, 0xA3, 0xBB, 0x0B, 0xD1, 0x7D,
287+ 0x00, 0x36, 0xED, 0x49, 0xA2, 0xD0, 0xFC, 0x3F
288+};
289+
290+static const uint8_t initial_attestation_public_y_key[] = {
291+ 0xBF, 0xCD, 0xFA, 0x89, 0x56, 0xB5, 0x68, 0xBF,
292+ 0xDB, 0x86, 0x73, 0xE6, 0x48, 0xD8, 0xB5, 0x8D,
293+ 0x92, 0x99, 0x55, 0xB1, 0x4A, 0x26, 0xC3, 0x08,
294+ 0x0F, 0x34, 0x11, 0x7D, 0x97, 0x1D, 0x68, 0x64
295+};
296+
297+/* Initialize the structure with given public key */
298+static const ecc_key_t attest_key = {
299+ (uint8_t *)initial_attestation_public_x_key,
300+ sizeof(initial_attestation_public_x_key),
301+ (uint8_t *)initial_attestation_public_y_key,
302+ sizeof(initial_attestation_public_y_key)
303+};
304+
305+#endif /* _PAL_ATTESTATION_CONFIG_H_ */
306diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_config.h b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_config.h
307new file mode 100644
308index 0000000..f99acf0
309--- /dev/null
310+++ b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_config.h
311@@ -0,0 +1,97 @@
312+/** @file
313+ * Copyright (c) 2019-2023, Arm Limited or its affiliates. All rights reserved.
314+ * SPDX-License-Identifier : Apache-2.0
315+ *
316+ * Licensed under the Apache License, Version 2.0 (the "License");
317+ * you may not use this file except in compliance with the License.
318+ * You may obtain a copy of the License at
319+ *
320+ * http://www.apache.org/licenses/LICENSE-2.0
321+ *
322+ * Unless required by applicable law or agreed to in writing, software
323+ * distributed under the License is distributed on an "AS IS" BASIS,
324+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
325+ * See the License for the specific language governing permissions and
326+ * limitations under the License.
327+**/
328+
329+#ifndef _PAL_CONFIG_H_
330+#define _PAL_CONFIG_H_
331+
332+#include "pal_crypto_config.h"
333+#include "pal_attestation_config.h"
334+#include "pal_storage_config.h"
335+
336+/* Define PSA test suite dependent macros for non-cmake build */
337+#if !defined(PSA_CMAKE_BUILD)
338+
339+/* Print verbosity = TEST */
340+#define VERBOSE 3
341+
342+/* NSPE or SPE VAL build? */
343+#define VAL_NSPE_BUILD
344+
345+/* NSPE or SPE TEST build? */
346+#define NONSECURE_TEST_BUILD
347+
348+/* If not defined, skip watchdog programming */
349+#define WATCHDOG_AVAILABLE
350+
351+/* Are Dynamic memory APIs available to secure partition? */
352+#define SP_HEAP_MEM_SUPP
353+
354+/* PSA Isolation level supported by platform */
355+#define PLATFORM_PSA_ISOLATION_LEVEL 3
356+#endif /* PSA_CMAKE_BUILD */
357+
358+/* Version of crypto spec used in attestation */
359+#define CRYPTO_VERSION_BETA3
360+
361+#ifndef PLATFORM_HAS_ATTEST_PK
362+/* Use hardcoded public key */
363+#define PLATFORM_OVERRIDE_ATTEST_PK
364+#endif
365+
366+/*
367+ * Include of PSA defined Header files
368+ */
369+#ifdef IPC
370+/* psa/client.h: Contains the PSA Client API elements */
371+#include "psa/client.h"
372+
373+/*
374+ * psa_manifest/sid.h: Macro definitions derived from manifest files that map from RoT Service
375+ * names to Service IDs (SIDs). Partition manifest parse build tool must provide the implementation
376+ * of this file.
377+*/
378+#include "psa_manifest/sid.h"
379+
380+/*
381+ * psa_manifest/pid.h: Secure Partition IDs
382+ * Macro definitions that map from Secure Partition names to Secure Partition IDs.
383+ * Partition manifest parse build tool must provide the implementation of this file.
384+*/
385+#include "psa_manifest/pid.h"
386+#endif
387+
388+#ifdef CRYPTO
389+/* psa/crypto.h: Contains the PSA Crypto API elements */
390+#include "psa/crypto.h"
391+#endif
392+
393+#if defined(INTERNAL_TRUSTED_STORAGE) || defined(STORAGE)
394+/* psa/internal_trusted_storage.h: Contains the PSA ITS API elements */
395+#include "psa/internal_trusted_storage.h"
396+#endif
397+
398+#if defined(PROTECTED_STORAGE) || defined(STORAGE)
399+/* psa/protected_storage.h: Contains the PSA PS API elements */
400+#include "psa/protected_storage.h"
401+#endif
402+
403+#ifdef INITIAL_ATTESTATION
404+/* psa/initial_attestation.h: Contains the PSA Initial Attestation API elements */
405+#include "psa/initial_attestation.h"
406+#endif
407+
408+#endif /* _PAL_CONFIG_H_ */
409diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_crypto_config.h b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_crypto_config.h
410new file mode 100644
411index 0000000..c6da0d7
412--- /dev/null
413+++ b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_crypto_config.h
414@@ -0,0 +1,404 @@
415+/** @file
416+ * Copyright (c) 2019-2023, Arm Limited or its affiliates. All rights reserved.
417+ * SPDX-License-Identifier : Apache-2.0
418+ *
419+ * Licensed under the Apache License, Version 2.0 (the "License");
420+ * you may not use this file except in compliance with the License.
421+ * You may obtain a copy of the License at
422+ *
423+ * http://www.apache.org/licenses/LICENSE-2.0
424+ *
425+ * Unless required by applicable law or agreed to in writing, software
426+ * distributed under the License is distributed on an "AS IS" BASIS,
427+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
428+ * See the License for the specific language governing permissions and
429+ * limitations under the License.
430+**/
431+
432+/*
433+ * \file pal_crypto_config.h
434+ *
435+ * \brief Configuration options for crypto tests (set of defines)
436+ *
437+ * This set of compile-time options may be used to enable
438+ * or disable features selectively for crypto test suite
439+ */
440+
441+#ifndef _PAL_CRYPTO_CONFIG_H_
442+#define _PAL_CRYPTO_CONFIG_H_
443+/**
444+ * \def ARCH_TEST_RSA
445+ *
446+ * Enable the RSA public-key cryptosystem.
447+ * By default all supported keys are enabled.
448+ *
449+ * Comment macros to disable the types
450+ */
451+#ifndef TF_M_PROFILE_SMALL
452+#ifndef TF_M_PROFILE_MEDIUM
453+#define ARCH_TEST_RSA
454+#define ARCH_TEST_RSA_1024
455+#define ARCH_TEST_RSA_2048
456+#define ARCH_TEST_RSA_3072
457+#endif
458+#endif
459+
460+/**
461+ * \def ARCH_TEST_ECC
462+ * \def ARCH_TEST_ECC_CURVE_SECPXXXR1
463+ *
464+ * Enable the elliptic curve
465+ * Enable specific curves within the Elliptic Curve
466+ * module. By default all supported curves are enabled.
467+ *
468+ * Requires: ARCH_TEST_ECC
469+ * Comment macros to disable the curve
470+ */
471+#ifndef TF_M_PROFILE_SMALL
472+#define ARCH_TEST_ECC
473+#define ARCH_TEST_ECC_CURVE_SECP192R1
474+#ifndef TF_M_PROFILE_MEDIUM
475+#define ARCH_TEST_ECC_CURVE_SECP224R1
476+#endif
477+#define ARCH_TEST_ECC_CURVE_SECP256R1
478+#ifndef TF_M_PROFILE_MEDIUM
479+#define ARCH_TEST_ECC_CURVE_SECP384R1
480+#endif
481+#endif
482+/* curves of size <255 are obsolete algorithms, should be disabled. */
483+#undef ARCH_TEST_ECC_CURVE_SECP192R1
484+#undef ARCH_TEST_ECC_CURVE_SECP224R1
485+
486+/**
487+ * \def ARCH_TEST_AES
488+ *
489+ * Enable the AES block cipher.
490+ * By default all supported keys are enabled.
491+ *
492+ * Comment macros to disable the types
493+ */
494+#define ARCH_TEST_AES
495+#define ARCH_TEST_AES_128
496+#define ARCH_TEST_AES_192
497+#define ARCH_TEST_AES_256
498+#define ARCH_TEST_AES_512
499+
500+/**
501+ * \def ARCH_TEST_DES
502+ *
503+ * Enable the DES block cipher.
504+ * By default all supported keys are enabled.
505+ *
506+ * Comment macros to disable the types
507+ */
508+//#define ARCH_TEST_DES
509+//#define ARCH_TEST_DES_1KEY
510+//#define ARCH_TEST_DES_2KEY
511+//#define ARCH_TEST_DES_3KEY
512+
513+/**
514+ * \def ARCH_TEST_RAW
515+ *
516+ * A "key" of this type cannot be used for any cryptographic operation.
517+ * Applications may use this type to store arbitrary data in the keystore.
518+ */
519+#define ARCH_TEST_RAW
520+
521+/**
522+ * \def ARCH_TEST_CIPHER
523+ *
524+ * Enable the generic cipher layer.
525+ */
526+
527+#define ARCH_TEST_CIPHER
528+
529+/**
530+ * \def ARCH_TEST_ARC4
531+ *
532+ * Enable the ARC4 key type.
533+ */
534+//#define ARCH_TEST_ARC4
535+
536+/**
537+ * \def ARCH_TEST_CIPHER_MODE_CTR
538+ *
539+ * Enable Counter Block Cipher mode (CTR) for symmetric ciphers.
540+ *
541+ * Requires: ARCH_TEST_CIPHER
542+ */
543+#ifndef TF_M_PROFILE_SMALL
544+#ifndef TF_M_PROFILE_MEDIUM
545+#define ARCH_TEST_CIPHER_MODE_CTR
546+#endif
547+#endif
548+
549+/**
550+ * \def ARCH_TEST_CIPHER_MODE_CFB
551+ *
552+ * Enable Cipher Feedback mode (CFB) for symmetric ciphers.
553+ *
554+ * Requires: ARCH_TEST_CIPHER
555+ */
556+#define ARCH_TEST_CIPHER_MODE_CFB
557+
558+/**
559+ * \def ARCH_TEST_CIPHER_MODE_CBC
560+ *
561+ * Enable Cipher Block Chaining mode (CBC) for symmetric ciphers.
562+ *
563+ * Requires: ARCH_TEST_CIPHER
564+ */
565+#define ARCH_TEST_CIPHER_MODE_CBC
566+
567+/**
568+ * \def ARCH_TEST_CTR_AES
569+ *
570+ * Requires: ARCH_TEST_CIPHER, ARCH_TEST_AES, ARCH_TEST_CIPHER_MODE_CTR
571+ */
572+#ifndef TF_M_PROFILE_SMALL
573+#ifndef TF_M_PROFILE_MEDIUM
574+#define ARCH_TEST_CTR_AES
575+#endif
576+#endif
577+
578+/**
579+ * \def ARCH_TEST_CBC_AES
580+ *
581+ * Requires: ARCH_TEST_CIPHER, ARCH_TEST_AES, ARCH_TEST_CIPHER_MODE_CBC
582+ *
583+ * Comment macros to disable the types
584+ */
585+#define ARCH_TEST_CBC_AES
586+#define ARCH_TEST_CBC_AES_NO_PADDING
587+
588+/**
589+ * \def ARCH_TEST_CBC_NO_PADDING
590+ *
591+ * Requires: ARCH_TEST_CIPHER, ARCH_TEST_CIPHER_MODE_CBC
592+ *
593+ * Comment macros to disable the types
594+ */
595+#ifndef TF_M_PROFILE_SMALL
596+#ifndef TF_M_PROFILE_MEDIUM
597+#define ARCH_TEST_CBC_NO_PADDING
598+#endif
599+#endif
600+
601+/**
602+ * \def ARCH_TEST_CFB_AES
603+ *
604+ * Requires: ARCH_TEST_CIPHER, ARCH_TEST_AES, ARCH_TEST_CIPHER_MODE_CFB
605+ */
606+#define ARCH_TEST_CFB_AES
607+
608+/**
609+ * \def ARCH_TEST_PKCS1V15_*
610+ *
611+ * Enable support for PKCS#1 v1.5 encoding.
612+ * Enable support for PKCS#1 v1.5 operations.
613+ * Enable support for RSA-OAEP
614+ *
615+ * Requires: ARCH_TEST_RSA, ARCH_TEST_PKCS1V15
616+ *
617+ * Comment macros to disable the types
618+ */
619+#ifndef TF_M_PROFILE_SMALL
620+#ifndef TF_M_PROFILE_MEDIUM
621+#define ARCH_TEST_PKCS1V15
622+#define ARCH_TEST_RSA_PKCS1V15_SIGN
623+#define ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
624+#define ARCH_TEST_RSA_PKCS1V15_CRYPT
625+#define ARCH_TEST_RSA_OAEP
626+#endif
627+#endif
628+
629+/**
630+ * \def ARCH_TEST_CBC_PKCS7
631+ *
632+ * Requires: ARCH_TEST_CIPHER_MODE_CBC
633+ *
634+ * Comment macros to disable the types
635+ */
636+#ifndef TF_M_PROFILE_SMALL
637+#ifndef TF_M_PROFILE_MEDIUM
638+#define ARCH_TEST_CBC_PKCS7
639+#endif
640+#endif
641+
642+/**
643+ * \def ARCH_TEST_ASYMMETRIC_ENCRYPTION
644+ *
645+ * Enable support for Asymmetric encryption algorithms
646+ */
647+#define ARCH_TEST_ASYMMETRIC_ENCRYPTION
648+
649+/**
650+ * \def ARCH_TEST_HASH
651+ *
652+ * Enable the hash algorithm.
653+ */
654+#define ARCH_TEST_HASH
655+
656+/**
657+ * \def ARCH_TEST_HMAC
658+ *
659+ * The key policy determines which underlying hash algorithm the key can be
660+ * used for.
661+ *
662+ * Requires: ARCH_TEST_HASH
663+ */
664+#define ARCH_TEST_HMAC
665+
666+/**
667+ * \def ARCH_TEST_MDX
668+ * \def ARCH_TEST_SHAXXX
669+ *
670+ * Enable the MDX algorithm.
671+ * Enable the SHAXXX algorithm.
672+ *
673+ * Requires: ARCH_TEST_HASH
674+ *
675+ * Comment macros to disable the types
676+ */
677+//#define ARCH_TEST_MD2
678+//#define ARCH_TEST_MD4
679+//#define ARCH_TEST_MD5
680+//#define ARCH_TEST_RIPEMD160
681+//#define ARCH_TEST_SHA1
682+#ifndef TF_M_PROFILE_SMALL
683+#define ARCH_TEST_SHA224
684+#endif
685+#define ARCH_TEST_SHA256
686+#ifndef TF_M_PROFILE_SMALL
687+#ifndef TF_M_PROFILE_MEDIUM
688+#define ARCH_TEST_SHA384
689+#define ARCH_TEST_SHA512
690+#endif
691+#endif
692+//#define ARCH_TEST_SHA512_224
693+//#define ARCH_TEST_SHA512_256
694+//#define ARCH_TEST_SHA3_224
695+//#define ARCH_TEST_SHA3_256
696+//#define ARCH_TEST_SHA3_384
697+//#define ARCH_TEST_SHA3_512
698+
699+/**
700+ * \def ARCH_TEST_HKDF
701+ *
702+ * Enable the HKDF algorithm (RFC 5869).
703+ *
704+ * Requires: ARCH_TEST_HASH
705+*/
706+#define ARCH_TEST_HKDF
707+
708+/**
709+ * \def ARCH_TEST_TLS12_PRF
710+ *
711+ * Enable the TLS-1.2 PRF algorithm (RFC 5246).
712+ *
713+ * Requires: ARCH_TEST_HASH
714+*/
715+#define ARCH_TEST_TLS12_PRF
716+
717+/**
718+ * \def ARCH_TEST_xMAC
719+ *
720+ * Enable the xMAC (Cipher/Hash/G-based Message Authentication Code) mode for block
721+ * ciphers.
722+ * Requires: ARCH_TEST_AES or ARCH_TEST_DES
723+ *
724+ * Comment macros to disable the types
725+ */
726+#ifndef TF_M_PROFILE_SMALL
727+#ifndef TF_M_PROFILE_MEDIUM
728+#define ARCH_TEST_CMAC
729+#endif
730+#endif
731+//#define ARCH_TEST_GMAC
732+#define ARCH_TEST_HMAC
733+
734+/**
735+ * \def ARCH_TEST_CCM
736+ *
737+ * Enable the Counter with CBC-MAC (CCM) mode for 128-bit block cipher.
738+ *
739+ * Requires: ARCH_TEST_AES
740+ */
741+#define ARCH_TEST_CCM
742+
743+/**
744+ * \def ARCH_TEST_GCM
745+ *
746+ * Enable the Galois/Counter Mode (GCM) for AES.
747+ *
748+ * Requires: ARCH_TEST_AES
749+ *
750+ */
751+#ifndef TF_M_PROFILE_SMALL
752+#ifndef TF_M_PROFILE_MEDIUM
753+#define ARCH_TEST_GCM
754+#endif
755+#endif
756+
757+/**
758+ * \def ARCH_TEST_TRUNCATED_MAC
759+ *
760+ * Enable support for RFC 6066 truncated HMAC in SSL.
761+ *
762+ * Comment this macro to disable support for truncated HMAC in SSL
763+ */
764+#define ARCH_TEST_TRUNCATED_MAC
765+
766+
767+/**
768+ * \def ARCH_TEST_ECDH
769+ *
770+ * Enable the elliptic curve Diffie-Hellman library.
771+ *
772+ * Requires: ARCH_TEST_ECC
773+ */
774+#ifndef TF_M_PROFILE_SMALL
775+#define ARCH_TEST_ECDH
776+#endif
777+
778+/**
779+ * \def ARCH_TEST_ECDSA
780+ *
781+ * Enable the elliptic curve DSA library.
782+ * Requires: ARCH_TEST_ECC
783+ */
784+#ifndef TF_M_PROFILE_SMALL
785+#define ARCH_TEST_ECDSA
786+#endif
787+
788+/**
789+ * \def ARCH_TEST_DETERMINISTIC_ECDSA
790+ *
791+ * Enable deterministic ECDSA (RFC 6979).
792+*/
793+#define ARCH_TEST_DETERMINISTIC_ECDSA
794+
795+/**
796+ * \def ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
797+ *
798+ * Enable ECC support for asymmetric API.
799+*/
800+//#define ARCH_TEST_ECC_ASYMMETRIC_API_SUPPORT
801+
802+/**
803+ * \def ARCH_TEST_HASH_SUSPEND
804+ *
805+ * Enable has suspend.
806+*/
807+//#define ARCH_TEST_HASH_SUSPEND
808+
809+/**
810+ * \def ARCH_TEST_HASH_RESUME
811+ *
812+ * Enable has resume.
813+*/
814+//#define ARCH_TEST_HASH_RESUME
815+
816+#include "pal_crypto_config_check.h"
817+
818+#endif /* _PAL_CRYPTO_CONFIG_H_ */
819diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_driver_intf.c b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_driver_intf.c
820new file mode 100644
821index 0000000..217d7d7
822--- /dev/null
823+++ b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_driver_intf.c
824@@ -0,0 +1,143 @@
825+/** @file
826+ * Copyright (c) 2019-2024, Arm Limited or its affiliates. All rights reserved.
827+ * SPDX-License-Identifier : Apache-2.0
828+ *
829+ * Licensed under the Apache License, Version 2.0 (the "License");
830+ * you may not use this file except in compliance with the License.
831+ * You may obtain a copy of the License at
832+ *
833+ * http://www.apache.org/licenses/LICENSE-2.0
834+ *
835+ * Unless required by applicable law or agreed to in writing, software
836+ * distributed under the License is distributed on an "AS IS" BASIS,
837+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
838+ * See the License for the specific language governing permissions and
839+ * limitations under the License.
840+**/
841+
842+#include "pal_common.h"
843+#include "pal_uart.h"
844+#include "pal_nvmem.h"
845+#include "pal_wd_rpi.h"
846+
847+/**
848+ @brief - This function initializes the UART
849+ @param - uart base addr
850+ @return - SUCCESS/FAILURE
851+**/
852+int pal_uart_init_ns(uint32_t uart_base_addr)
853+{
854+ pal_uart_pl011_init(uart_base_addr);
855+ return PAL_STATUS_SUCCESS;
856+}
857+
858+/**
859+ @brief - This function parses the input string and writes bytes into UART TX FIFO
860+ @param - str : Input String
861+ - data : Value for format specifier
862+ @return - SUCCESS/FAILURE
863+**/
864+
865+int pal_print_ns(const char *str, int32_t data)
866+{
867+ pal_uart_pl011_print(str, data);
868+ return PAL_STATUS_SUCCESS;
869+}
870+
871+/**
872+ @brief - Initializes an hardware watchdog timer
873+ @param - base_addr : Base address of the watchdog module
874+ - time_us : Time in micro seconds
875+ - timer_tick_us : Number of ticks per micro second
876+ @return - SUCCESS/FAILURE
877+**/
878+int pal_wd_timer_init_ns(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
879+{
880+ return(pal_wd_rpi_init(base_addr,time_us, timer_tick_us));
881+}
882+
883+/**
884+ @brief - Enables a hardware watchdog timer
885+ @param - base_addr : Base address of the watchdog module
886+ @return - SUCCESS/FAILURE
887+**/
888+int pal_wd_timer_enable_ns(addr_t base_addr)
889+{
890+ return(pal_wd_rpi_enable(base_addr));
891+}
892+
893+/**
894+ @brief - Disables a hardware watchdog timer
895+ @param - base_addr : Base address of the watchdog module
896+ @return - SUCCESS/FAILURE
897+**/
898+int pal_wd_timer_disable_ns(addr_t base_addr)
899+{
900+ return (pal_wd_rpi_disable(base_addr));
901+}
902+
903+/**
904+ @brief - Reads from given non-volatile address.
905+ @param - base : Base address of nvmem
906+ offset : Offset
907+ buffer : Pointer to source address
908+ size : Number of bytes
909+ @return - SUCCESS/FAILURE
910+**/
911+int pal_nvmem_read_ns(addr_t base, uint32_t offset, void *buffer, int size)
912+{
913+ if (nvmem_read(base, offset, buffer, size))
914+ {
915+ return PAL_STATUS_SUCCESS;
916+ }
917+ else
918+ {
919+ return PAL_STATUS_ERROR;
920+ }
921+}
922+
923+/**
924+ @brief - Writes into given non-volatile address.
925+ @param - base : Base address of nvmem
926+ offset : Offset
927+ buffer : Pointer to source address
928+ size : Number of bytes
929+ @return - SUCCESS/FAILURE
930+**/
931+int pal_nvmem_write_ns(addr_t base, uint32_t offset, void *buffer, int size)
932+{
933+ if (nvmem_write(base, offset, buffer, size))
934+ {
935+ return PAL_STATUS_SUCCESS;
936+ }
937+ else
938+ {
939+ return PAL_STATUS_ERROR;
940+ }
941+}
942+
943+/**
944+ * @brief - Terminates the simulation at the end of all tests completion.
945+ * By default, it put cpus into power down mode.
946+ * @param - void
947+ * @return - void
948+**/
949+void pal_terminate_simulation(void)
950+{
951+ /* Add logic to terminate the simluation */
952+
953+ while(1)
954+ {
955+ __asm volatile("WFI");
956+ }
957+}
958+
959+/**
960+ * @brief - Resets the system.
961+ * @param - void
962+ * @return - SUCCESS/FAILURE
963+**/
964+int pal_system_reset(void)
965+{
966+ return PAL_STATUS_UNSUPPORTED_FUNC;
967+}
968diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_storage_config.h b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_storage_config.h
969new file mode 100644
970index 0000000..bbb3741
971--- /dev/null
972+++ b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/nspe/pal_storage_config.h
973@@ -0,0 +1,24 @@
974+/** @file
975+ * Copyright (c) 2020, Arm Limited or its affiliates. All rights reserved.
976+ * SPDX-License-Identifier : Apache-2.0
977+ *
978+ * Licensed under the Apache License, Version 2.0 (the "License");
979+ * you may not use this file except in compliance with the License.
980+ * You may obtain a copy of the License at
981+ *
982+ * http://www.apache.org/licenses/LICENSE-2.0
983+ *
984+ * Unless required by applicable law or agreed to in writing, software
985+ * distributed under the License is distributed on an "AS IS" BASIS,
986+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
987+ * See the License for the specific language governing permissions and
988+ * limitations under the License.
989+**/
990+
991+#ifndef _PAL_STORAGE_CONFIG_H_
992+#define _PAL_STORAGE_CONFIG_H_
993+
994+/* Platform specific max UID's size */
995+#define ARCH_TEST_STORAGE_UID_MAX_SIZE 512
996+
997+#endif /* _PAL_STORAGE_CONFIG_H_ */
998diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/target.cfg b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/target.cfg
999new file mode 100644
1000index 0000000..3cacc7c
1001--- /dev/null
1002+++ b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/target.cfg
1003@@ -0,0 +1,41 @@
1004+///** @file
1005+// * Copyright (c) 2019-2024, Arm Limited or its affiliates. All rights reserved.
1006+// * SPDX-License-Identifier : Apache-2.0
1007+// *
1008+// * Licensed under the Apache License, Version 2.0 (the "License");
1009+// * you may not use this file except in compliance with the License.
1010+// * You may obtain a copy of the License at
1011+// *
1012+// * http://www.apache.org/licenses/LICENSE-2.0
1013+// *
1014+// * Unless required by applicable law or agreed to in writing, software
1015+// * distributed under the License is distributed on an "AS IS" BASIS,
1016+// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1017+// * See the License for the specific language governing permissions and
1018+// * limitations under the License.
1019+//**/
1020+
1021+// UART device info
1022+uart.num=1;
1023+uart.0.base = 0x40070000; // UART0_NS
1024+uart.0.size = 0x3FFF;
1025+uart.0.intr_id = 0xFF;
1026+uart.0.permission = TYPE_READ_WRITE;
1027+
1028+// Watchdog device info
1029+watchdog.num = 1;
1030+watchdog.0.base = 0x400d8000;
1031+watchdog.0.size = 0x3FFF;
1032+watchdog.0.intr_id = 0xFF;
1033+watchdog.0.permission = TYPE_READ_WRITE;
1034+watchdog.0.num_of_tick_per_micro_sec = 0x1;
1035+watchdog.0.timeout_in_micro_sec_low = 0xF4240; //1.0 sec : 1 * 1000 * 1000
1036+watchdog.0.timeout_in_micro_sec_medium = 0x1E8480; //2.0 sec : 2 * 1000 * 1000
1037+watchdog.0.timeout_in_micro_sec_high = 0x895440; //9.0 sec : 9 * 1000 * 1000
1038+watchdog.0.timeout_in_micro_sec_crypto = 0xFFFFFF; //~16.7 sec : MAX supported
1039+
1040+// Range of 1KB Non-volatile memory to preserve data over reset. Ex, NVRAM and FLASH
1041+nvmem.num =1;
1042+nvmem.0.start = 0x2005EC00;
1043+nvmem.0.end = 0x2005EFFF;
1044+nvmem.0.permission = TYPE_READ_WRITE;
1045diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/target.cmake b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/target.cmake
1046new file mode 100644
1047index 0000000..0f591eb
1048--- /dev/null
1049+++ b/api-tests/platform/targets/tgt_dev_apis_tfm_rp2350/target.cmake
1050@@ -0,0 +1,97 @@
1051+#/** @file
1052+# * Copyright (c) 2019-2024, Arm Limited or its affiliates. All rights reserved.
1053+# * SPDX-License-Identifier : Apache-2.0
1054+# *
1055+# * Licensed under the Apache License, Version 2.0 (the "License");
1056+# * you may not use this file except in compliance with the License.
1057+# * You may obtain a copy of the License at
1058+# *
1059+# * http://www.apache.org/licenses/LICENSE-2.0
1060+# *
1061+# * Unless required by applicable law or agreed to in writing, software
1062+# * distributed under the License is distributed on an "AS IS" BASIS,
1063+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1064+# * See the License for the specific language governing permissions and
1065+# * limitations under the License.
1066+#**/
1067+
1068+# PAL C source files part of NSPE library
1069+list(APPEND PAL_SRC_C_NSPE )
1070+
1071+# PAL ASM source files part of NSPE library
1072+list(APPEND PAL_SRC_ASM_NSPE )
1073+
1074+# PAL C source files part of SPE library - driver partition
1075+list(APPEND PAL_SRC_C_DRIVER_SP )
1076+
1077+# PAL ASM source files part of SPE library - driver partition
1078+list(APPEND PAL_SRC_ASM_DRIVER_SP )
1079+
1080+# Listing all the sources required for given target
1081+if(${SUITE} STREQUAL "IPC")
1082+ message(FATAL_ERROR "IPC not supported")
1083+else()
1084+ list(APPEND PAL_SRC_C_NSPE
1085+ # driver files will be compiled as part of NSPE
1086+ ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/pal_driver_intf.c
1087+ ${PSA_ROOT_DIR}/platform/drivers/nvmem/pal_nvmem.c
1088+ ${PSA_ROOT_DIR}/platform/drivers/uart/pl011/pal_uart.c
1089+ ${PSA_ROOT_DIR}/platform/drivers/watchdog/rpi/pal_wd_rpi.c
1090+ )
1091+endif()
1092+
1093+if(${SUITE} STREQUAL "CRYPTO")
1094+ list(APPEND PAL_SRC_C_NSPE
1095+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/crypto/pal_crypto_intf.c
1096+ )
1097+endif()
1098+if((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
1099+ list(APPEND PAL_SRC_C_NSPE
1100+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/protected_storage/pal_protected_storage_intf.c
1101+ )
1102+endif()
1103+if((${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
1104+ list(APPEND PAL_SRC_C_NSPE
1105+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.c
1106+ )
1107+endif()
1108+if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
1109+ list(APPEND PAL_SRC_C_NSPE
1110+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/initial_attestation/pal_attestation_intf.c
1111+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/initial_attestation/pal_attestation_crypto.c
1112+ ${PSA_TARGET_QCBOR}/src/UsefulBuf.c
1113+ ${PSA_TARGET_QCBOR}/src/ieee754.c
1114+ ${PSA_TARGET_QCBOR}/src/qcbor_decode.c
1115+ ${PSA_TARGET_QCBOR}/src/qcbor_encode.c
1116+ )
1117+endif()
1118+
1119+# Create NSPE library
1120+add_library(${PSA_TARGET_PAL_NSPE_LIB} STATIC ${PAL_SRC_C_NSPE} ${PAL_SRC_ASM_NSPE})
1121+
1122+# PSA Include directories
1123+foreach(psa_inc_path ${PSA_INCLUDE_PATHS})
1124+ target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE ${psa_inc_path})
1125+endforeach()
1126+
1127+list(APPEND PAL_DRIVER_INCLUDE_PATHS
1128+ ${PSA_ROOT_DIR}/platform/drivers/nvmem
1129+ ${PSA_ROOT_DIR}/platform/drivers/uart/pl011
1130+ ${PSA_ROOT_DIR}/platform/drivers/watchdog/rpi
1131+)
1132+
1133+target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE
1134+ ${PAL_DRIVER_INCLUDE_PATHS}
1135+ ${PSA_ROOT_DIR}/platform/targets/common/nspe
1136+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/crypto
1137+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/protected_storage
1138+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/internal_trusted_storage
1139+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/initial_attestation
1140+ ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe
1141+)
1142+
1143+if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
1144+target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE
1145+ ${PSA_QCBOR_INCLUDE_PATH}
1146+)
1147+endif()
1148diff --git a/api-tests/platform/targets/tgt_ff_tfm_rp2350/nspe/pal_config.h b/api-tests/platform/targets/tgt_ff_tfm_rp2350/nspe/pal_config.h
1149new file mode 100644
1150index 0000000..e5578d9
1151--- /dev/null
1152+++ b/api-tests/platform/targets/tgt_ff_tfm_rp2350/nspe/pal_config.h
1153@@ -0,0 +1,71 @@
1154+/** @file
1155+ * Copyright (c) 2019-2021, Arm Limited or its affiliates. All rights reserved.
1156+ * SPDX-License-Identifier : Apache-2.0
1157+ *
1158+ * Licensed under the Apache License, Version 2.0 (the "License");
1159+ * you may not use this file except in compliance with the License.
1160+ * You may obtain a copy of the License at
1161+ *
1162+ * http://www.apache.org/licenses/LICENSE-2.0
1163+ *
1164+ * Unless required by applicable law or agreed to in writing, software
1165+ * distributed under the License is distributed on an "AS IS" BASIS,
1166+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1167+ * See the License for the specific language governing permissions and
1168+ * limitations under the License.
1169+**/
1170+
1171+#ifndef _PAL_CONFIG_H_
1172+#define _PAL_CONFIG_H_
1173+
1174+/* Define PSA test suite dependent macros for non-cmake build */
1175+#if !defined(PSA_CMAKE_BUILD)
1176+
1177+/* Print verbosity = TEST */
1178+#define VERBOSE 3
1179+
1180+/* NSPE or SPE VAL build? */
1181+#define VAL_NSPE_BUILD
1182+
1183+/* NSPE or SPE TEST build? */
1184+#define NONSECURE_TEST_BUILD
1185+
1186+/* If not defined, skip watchdog programming */
1187+#define WATCHDOG_AVAILABLE
1188+
1189+/* Are Dynamic memory APIs available to secure partition? */
1190+#define SP_HEAP_MEM_SUPP
1191+
1192+/* PSA Isolation level supported by platform */
1193+#define PLATFORM_PSA_ISOLATION_LEVEL 3
1194+#endif /* PSA_CMAKE_BUILD */
1195+
1196+/* Version of crypto spec used in attestation */
1197+#define CRYPTO_VERSION_BETA3
1198+
1199+/* Use hardcoded public key */
1200+#define PLATFORM_OVERRIDE_ATTEST_PK
1201+
1202+/*
1203+ * Include of PSA defined Header files
1204+ */
1205+#ifdef IPC
1206+/* psa/client.h: Contains the PSA Client API elements */
1207+#include "psa/client.h"
1208+
1209+/*
1210+ * psa_manifest/sid.h: Macro definitions derived from manifest files that map from RoT Service
1211+ * names to Service IDs (SIDs). Partition manifest parse build tool must provide the implementation
1212+ * of this file.
1213+*/
1214+#include "psa_manifest/sid.h"
1215+
1216+/*
1217+ * psa_manifest/pid.h: Secure Partition IDs
1218+ * Macro definitions that map from Secure Partition names to Secure Partition IDs.
1219+ * Partition manifest parse build tool must provide the implementation of this file.
1220+*/
1221+#include "psa_manifest/pid.h"
1222+#endif
1223+
1224+#endif /* _PAL_CONFIG_H_ */
1225diff --git a/api-tests/platform/targets/tgt_ff_tfm_rp2350/nspe/pal_driver_ipc_intf.c b/api-tests/platform/targets/tgt_ff_tfm_rp2350/nspe/pal_driver_ipc_intf.c
1226new file mode 100644
1227index 0000000..dbc87a9
1228--- /dev/null
1229+++ b/api-tests/platform/targets/tgt_ff_tfm_rp2350/nspe/pal_driver_ipc_intf.c
1230@@ -0,0 +1,338 @@
1231+/** @file
1232+ * Copyright (c) 2019-2021, Arm Limited or its affiliates. All rights reserved.
1233+ * SPDX-License-Identifier : Apache-2.0
1234+ *
1235+ * Licensed under the Apache License, Version 2.0 (the "License");
1236+ * you may not use this file except in compliance with the License.
1237+ * You may obtain a copy of the License at
1238+ *
1239+ * http://www.apache.org/licenses/LICENSE-2.0
1240+ *
1241+ * Unless required by applicable law or agreed to in writing, software
1242+ * distributed under the License is distributed on an "AS IS" BASIS,
1243+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1244+ * See the License for the specific language governing permissions and
1245+ * limitations under the License.
1246+**/
1247+
1248+#include "pal_common.h"
1249+
1250+/**
1251+ @brief - This function initializes the UART
1252+ @param - uart base addr
1253+ @return - SUCCESS/FAILURE
1254+**/
1255+int pal_uart_init_ns(uint32_t uart_base_addr)
1256+{
1257+ psa_status_t status_of_call = PSA_SUCCESS;
1258+ uart_fn_type_t uart_fn = UART_INIT;
1259+
1260+ psa_invec data[3] = {{&uart_fn, sizeof(uart_fn)},
1261+ {&uart_base_addr, sizeof(uart_base_addr)},
1262+ {NULL, 0}};
1263+
1264+#if STATELESS_ROT == 1
1265+ status_of_call = psa_call(DRIVER_UART_HANDLE, 0, data, 3, NULL, 0);
1266+ if (status_of_call != PSA_SUCCESS)
1267+ return PAL_STATUS_ERROR;
1268+
1269+ return PAL_STATUS_SUCCESS;
1270+#else
1271+ psa_handle_t print_handle = 0;
1272+ print_handle = psa_connect(DRIVER_UART_SID, DRIVER_UART_VERSION);
1273+ if (PSA_HANDLE_IS_VALID(print_handle))
1274+ {
1275+ status_of_call = psa_call(print_handle, 0, data, 3, NULL, 0);
1276+ psa_close(print_handle);
1277+ if (status_of_call != PSA_SUCCESS)
1278+ return PAL_STATUS_ERROR;
1279+
1280+ return PAL_STATUS_SUCCESS;
1281+ }
1282+ else
1283+ {
1284+ return PAL_STATUS_ERROR;
1285+ }
1286+#endif
1287+}
1288+
1289+/**
1290+ @brief - This function parses the input string and writes bytes into UART TX FIFO
1291+ @param - str : Input String
1292+ - data : Value for format specifier
1293+ @return - SUCCESS/FAILURE
1294+**/
1295+
1296+int pal_print_ns(const char *str, int32_t data)
1297+{
1298+ int string_len = 0;
1299+ const char *p = str;
1300+ psa_status_t status_of_call = PSA_SUCCESS;
1301+ uart_fn_type_t uart_fn = UART_PRINT;
1302+
1303+ while (*p != '\0')
1304+ {
1305+ string_len++;
1306+ p++;
1307+ }
1308+
1309+ psa_invec data1[3] = {{&uart_fn, sizeof(uart_fn)},
1310+ {str, string_len+1},
1311+ {&data, sizeof(data)}};
1312+#if STATELESS_ROT == 1
1313+ status_of_call = psa_call(DRIVER_UART_HANDLE, 0, data1, 3, NULL, 0);
1314+ if (status_of_call != PSA_SUCCESS)
1315+ return PAL_STATUS_ERROR;
1316+
1317+ return PAL_STATUS_SUCCESS;
1318+#else
1319+ psa_handle_t print_handle = 0;
1320+ print_handle = psa_connect(DRIVER_UART_SID, DRIVER_UART_VERSION);
1321+ if (PSA_HANDLE_IS_VALID(print_handle))
1322+ {
1323+ status_of_call = psa_call(print_handle, 0, data1, 3, NULL, 0);
1324+ psa_close(print_handle);
1325+ if (status_of_call != PSA_SUCCESS)
1326+ return PAL_STATUS_ERROR;
1327+
1328+ return PAL_STATUS_SUCCESS;
1329+ }
1330+ else
1331+ {
1332+ return PAL_STATUS_ERROR;
1333+ }
1334+#endif
1335+}
1336+
1337+/**
1338+ @brief - Initializes an hardware watchdog timer
1339+ @param - base_addr : Base address of the watchdog module
1340+ - time_us : Time in micro seconds
1341+ - timer_tick_us : Number of ticks per micro second
1342+ @return - SUCCESS/FAILURE
1343+**/
1344+int pal_wd_timer_init_ns(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
1345+{
1346+ wd_param_t wd_param;
1347+ psa_status_t status_of_call = PSA_SUCCESS;
1348+
1349+ wd_param.wd_fn_type = WD_INIT_SEQ;
1350+ wd_param.wd_base_addr = base_addr;
1351+ wd_param.wd_time_us = time_us;
1352+ wd_param.wd_timer_tick_us = timer_tick_us;
1353+ psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
1354+
1355+#if STATELESS_ROT == 1
1356+ status_of_call = psa_call(DRIVER_WATCHDOG_HANDLE, 0, invec, 1, NULL, 0);
1357+ if (status_of_call != PSA_SUCCESS)
1358+ return PAL_STATUS_ERROR;
1359+
1360+ return PAL_STATUS_SUCCESS;
1361+#else
1362+
1363+ psa_handle_t handle = 0;
1364+ handle = psa_connect(DRIVER_WATCHDOG_SID, DRIVER_WATCHDOG_VERSION);
1365+ if (PSA_HANDLE_IS_VALID(handle))
1366+ {
1367+ status_of_call = psa_call(handle, 0, invec, 1, NULL, 0);
1368+ psa_close(handle);
1369+ if (status_of_call != PSA_SUCCESS)
1370+ return PAL_STATUS_ERROR;
1371+
1372+ return PAL_STATUS_SUCCESS;
1373+ }
1374+ else
1375+ {
1376+ return PAL_STATUS_ERROR;
1377+ }
1378+#endif
1379+
1380+}
1381+
1382+/**
1383+ @brief - Enables a hardware watchdog timer
1384+ @param - base_addr : Base address of the watchdog module
1385+ @return - SUCCESS/FAILURE
1386+**/
1387+int pal_wd_timer_enable_ns(addr_t base_addr)
1388+{
1389+ wd_param_t wd_param;
1390+ psa_status_t status_of_call = PSA_SUCCESS;
1391+
1392+ wd_param.wd_fn_type = WD_ENABLE_SEQ;
1393+ wd_param.wd_base_addr = base_addr;
1394+ wd_param.wd_time_us = 0;
1395+ wd_param.wd_timer_tick_us = 0;
1396+ psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
1397+
1398+#if STATELESS_ROT == 1
1399+ status_of_call = psa_call(DRIVER_WATCHDOG_HANDLE, 0, invec, 1, NULL, 0);
1400+ if (status_of_call != PSA_SUCCESS)
1401+ return PAL_STATUS_ERROR;
1402+
1403+ return PAL_STATUS_SUCCESS;
1404+#else
1405+ psa_handle_t handle = 0;
1406+ handle = psa_connect(DRIVER_WATCHDOG_SID, DRIVER_WATCHDOG_VERSION);
1407+ if (PSA_HANDLE_IS_VALID(handle))
1408+ {
1409+ status_of_call = psa_call(handle, 0, invec, 1, NULL, 0);
1410+ psa_close(handle);
1411+ if (status_of_call != PSA_SUCCESS)
1412+ return PAL_STATUS_ERROR;
1413+
1414+ return PAL_STATUS_SUCCESS;
1415+ }
1416+ else
1417+ {
1418+ return PAL_STATUS_ERROR;
1419+ }
1420+#endif
1421+}
1422+
1423+/**
1424+ @brief - Disables a hardware watchdog timer
1425+ @param - base_addr : Base address of the watchdog module
1426+ @return - SUCCESS/FAILURE
1427+**/
1428+int pal_wd_timer_disable_ns(addr_t base_addr)
1429+{
1430+ wd_param_t wd_param;
1431+ psa_status_t status_of_call = PSA_SUCCESS;
1432+
1433+ wd_param.wd_fn_type = WD_DISABLE_SEQ;
1434+ wd_param.wd_base_addr = base_addr;
1435+ wd_param.wd_time_us = 0;
1436+ wd_param.wd_timer_tick_us = 0;
1437+ psa_invec invec[1] = {{&wd_param, sizeof(wd_param)}};
1438+#if STATELESS_ROT == 1
1439+ status_of_call = psa_call(DRIVER_WATCHDOG_HANDLE, 0, invec, 1, NULL, 0);
1440+ if (status_of_call != PSA_SUCCESS)
1441+ return PAL_STATUS_ERROR;
1442+
1443+ return PAL_STATUS_SUCCESS;
1444+#else
1445+ psa_handle_t handle = 0;
1446+
1447+ handle = psa_connect(DRIVER_WATCHDOG_SID, DRIVER_WATCHDOG_VERSION);
1448+ if (PSA_HANDLE_IS_VALID(handle))
1449+ {
1450+ status_of_call = psa_call(handle, 0, invec, 1, NULL, 0);
1451+ psa_close(handle);
1452+ if (status_of_call != PSA_SUCCESS)
1453+ return PAL_STATUS_ERROR;
1454+
1455+ return PAL_STATUS_SUCCESS;
1456+ }
1457+ else
1458+ {
1459+ return PAL_STATUS_ERROR;
1460+ }
1461+#endif
1462+
1463+}
1464+
1465+/**
1466+ @brief - Reads from given non-volatile address.
1467+ @param - base : Base address of nvmem
1468+ offset : Offset
1469+ buffer : Pointer to source address
1470+ size : Number of bytes
1471+ @return - SUCCESS/FAILURE
1472+**/
1473+int pal_nvmem_read_ns(addr_t base, uint32_t offset, void *buffer, int size)
1474+{
1475+ nvmem_param_t nvmem_param;
1476+ psa_status_t status_of_call = PSA_SUCCESS;
1477+
1478+ nvmem_param.nvmem_fn_type = NVMEM_READ;
1479+ nvmem_param.base = base;
1480+ nvmem_param.offset = offset;
1481+ nvmem_param.size = size;
1482+ psa_invec invec[1] = {{&nvmem_param, sizeof(nvmem_param)}};
1483+ psa_outvec outvec[1] = {{buffer, size}};
1484+#if STATELESS_ROT == 1
1485+ status_of_call = psa_call(DRIVER_NVMEM_HANDLE, 0, invec, 1, outvec, 1);
1486+ if (status_of_call != PSA_SUCCESS)
1487+ return PAL_STATUS_ERROR;
1488+
1489+ return PAL_STATUS_SUCCESS;
1490+#else
1491+ psa_handle_t handle = 0;
1492+ handle = psa_connect(DRIVER_NVMEM_SID, DRIVER_NVMEM_VERSION);
1493+ if (PSA_HANDLE_IS_VALID(handle))
1494+ {
1495+ status_of_call = psa_call(handle, 0, invec, 1, outvec, 1);
1496+ psa_close(handle);
1497+ if (status_of_call != PSA_SUCCESS)
1498+ return PAL_STATUS_ERROR;
1499+
1500+ return PAL_STATUS_SUCCESS;
1501+ }
1502+ else
1503+ {
1504+ return PAL_STATUS_ERROR;
1505+ }
1506+#endif
1507+
1508+}
1509+
1510+/**
1511+ @brief - Writes into given non-volatile address.
1512+ @param - base : Base address of nvmem
1513+ offset : Offset
1514+ buffer : Pointer to source address
1515+ size : Number of bytes
1516+ @return - SUCCESS/FAILURE
1517+**/
1518+int pal_nvmem_write_ns(addr_t base, uint32_t offset, void *buffer, int size)
1519+{
1520+ nvmem_param_t nvmem_param;
1521+
1522+ psa_status_t status_of_call = PSA_SUCCESS;
1523+
1524+ nvmem_param.nvmem_fn_type = NVMEM_WRITE;
1525+ nvmem_param.base = base;
1526+ nvmem_param.offset = offset;
1527+ nvmem_param.size = size;
1528+ psa_invec invec[2] = {{&nvmem_param, sizeof(nvmem_param)}, {buffer, size}};
1529+#if STATELESS_ROT == 1
1530+ status_of_call = psa_call(DRIVER_NVMEM_HANDLE, 0, invec, 2, NULL, 0);
1531+ if (status_of_call != PSA_SUCCESS)
1532+ return PAL_STATUS_ERROR;
1533+
1534+ return PAL_STATUS_SUCCESS;
1535+#else
1536+ psa_handle_t handle = 0;
1537+ handle = psa_connect(DRIVER_NVMEM_SID, DRIVER_NVMEM_VERSION);
1538+ if (PSA_HANDLE_IS_VALID(handle))
1539+ {
1540+ status_of_call = psa_call(handle, 0, invec, 2, NULL, 0);
1541+ psa_close(handle);
1542+ if (status_of_call != PSA_SUCCESS)
1543+ return PAL_STATUS_ERROR;
1544+
1545+ return PAL_STATUS_SUCCESS;
1546+ }
1547+ else
1548+ {
1549+ return PAL_STATUS_ERROR;
1550+ }
1551+#endif
1552+}
1553+
1554+/**
1555+ * @brief - Terminates the simulation at the end of all tests completion.
1556+ * By default, it put cpus into power down mode.
1557+ * @param - void
1558+ * @return - void
1559+**/
1560+void pal_terminate_simulation(void)
1561+{
1562+ /* Add logic to terminate the simluation */
1563+
1564+ while(1)
1565+ {
1566+ __asm volatile("WFI");
1567+ }
1568+}
1569diff --git a/api-tests/platform/targets/tgt_ff_tfm_rp2350/spe/pal_driver_intf.c b/api-tests/platform/targets/tgt_ff_tfm_rp2350/spe/pal_driver_intf.c
1570new file mode 100644
1571index 0000000..093b7d2
1572--- /dev/null
1573+++ b/api-tests/platform/targets/tgt_ff_tfm_rp2350/spe/pal_driver_intf.c
1574@@ -0,0 +1,132 @@
1575+ /** @file
1576+ * Copyright (c) 2019-2024, Arm Limited or its affiliates. All rights reserved.
1577+ * SPDX-License-Identifier : Apache-2.0
1578+ *
1579+ * Licensed under the Apache License, Version 2.0 (the "License");
1580+ * you may not use this file except in compliance with the License.
1581+ * You may obtain a copy of the License at
1582+ *
1583+ * http://www.apache.org/licenses/LICENSE-2.0
1584+ *
1585+ * Unless required by applicable law or agreed to in writing, software
1586+ * distributed under the License is distributed on an "AS IS" BASIS,
1587+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1588+ * See the License for the specific language governing permissions and
1589+ * limitations under the License.
1590+ **/
1591+
1592+#include "pal_driver_intf.h"
1593+
1594+/**
1595+ @brief - This function initializes the UART
1596+ @param - uart base addr
1597+ @return - void
1598+**/
1599+void pal_uart_init(uint32_t uart_base_addr)
1600+{
1601+ pal_uart_pl011_init(uart_base_addr);
1602+}
1603+
1604+/**
1605+ @brief - This function parses the input string and writes bytes into UART TX FIFO
1606+ @param - str : Input String
1607+ - data : Value for format specifier
1608+**/
1609+
1610+void pal_print(const char *str, int32_t data)
1611+{
1612+ pal_uart_pl011_print(str,data);
1613+
1614+}
1615+
1616+
1617+/**
1618+ @brief - Writes into given non-volatile address.
1619+ @param - base : Base address of nvmem
1620+ offset : Offset
1621+ buffer : Pointer to source address
1622+ size : Number of bytes
1623+ @return - 1/0
1624+**/
1625+int pal_nvmem_write(addr_t base, uint32_t offset, void *buffer, int size)
1626+{
1627+ return nvmem_write(base, offset, buffer, size);
1628+}
1629+
1630+/**
1631+ @brief - Reads from given non-volatile address.
1632+ @param - base : Base address of nvmem
1633+ offset : Offset
1634+ buffer : Pointer to source address
1635+ size : Number of bytes
1636+ @return - 1/0
1637+**/
1638+int pal_nvmem_read(addr_t base, uint32_t offset, void *buffer, int size)
1639+{
1640+ return nvmem_read(base, offset, buffer, size);
1641+}
1642+
1643+
1644+/**
1645+ @brief - Initializes an hardware watchdog timer
1646+ @param - base_addr : Base address of the watchdog module
1647+ - time_us : Time in micro seconds
1648+ - timer_tick_us : Number of ticks per micro second
1649+ @return - SUCCESS/FAILURE
1650+**/
1651+int pal_wd_timer_init(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
1652+{
1653+ return(pal_wd_rpi_init(base_addr,time_us, timer_tick_us));
1654+
1655+}
1656+
1657+/**
1658+ @brief - Enables a hardware watchdog timer
1659+ @param - base_addr : Base address of the watchdog module
1660+ @return - SUCCESS/FAILURE
1661+**/
1662+int pal_wd_timer_enable(addr_t base_addr)
1663+{
1664+ return(pal_wd_rpi_enable(base_addr));
1665+}
1666+
1667+/**
1668+ @brief - Disables a hardware watchdog timer
1669+ @param - base_addr : Base address of the watchdog module
1670+ @return - SUCCESS/FAILURE
1671+**/
1672+int pal_wd_timer_disable(addr_t base_addr)
1673+{
1674+ return (pal_wd_rpi_disable(base_addr));
1675+}
1676+
1677+/**
1678+ @brief - Checks whether hardware watchdog timer is enabled
1679+ @param - base_addr : Base address of the watchdog module
1680+ @return - Enabled : 1, Disabled : 0
1681+**/
1682+int pal_wd_timer_is_enabled(addr_t base_addr)
1683+{
1684+ return (pal_wd_rpi_is_enabled(base_addr));
1685+}
1686+
1687+/**
1688+ @brief - Trigger interrupt for irq signal assigned to driver partition
1689+ before return to caller.
1690+ @param - void
1691+ @return - void
1692+**/
1693+void pal_generate_interrupt(void)
1694+{
1695+ pal_uart_pl011_generate_irq();
1696+}
1697+
1698+/**
1699+ @brief - Disable interrupt that was generated using pal_generate_interrupt API.
1700+ @param - void
1701+ @return - void
1702+**/
1703+void pal_disable_interrupt(void)
1704+{
1705+ pal_uart_pl011_disable_irq();
1706+}
1707diff --git a/api-tests/platform/targets/tgt_ff_tfm_rp2350/spe/pal_driver_intf.h b/api-tests/platform/targets/tgt_ff_tfm_rp2350/spe/pal_driver_intf.h
1708new file mode 100644
1709index 0000000..adbdb4c
1710--- /dev/null
1711+++ b/api-tests/platform/targets/tgt_ff_tfm_rp2350/spe/pal_driver_intf.h
1712@@ -0,0 +1,35 @@
1713+ /** @file
1714+ * Copyright (c) 2019-2024, Arm Limited or its affiliates. All rights reserved.
1715+ * SPDX-License-Identifier : Apache-2.0
1716+ *
1717+ * Licensed under the Apache License, Version 2.0 (the "License");
1718+ * you may not use this file except in compliance with the License.
1719+ * You may obtain a copy of the License at
1720+ *
1721+ * http://www.apache.org/licenses/LICENSE-2.0
1722+ *
1723+ * Unless required by applicable law or agreed to in writing, software
1724+ * distributed under the License is distributed on an "AS IS" BASIS,
1725+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1726+ * See the License for the specific language governing permissions and
1727+ * limitations under the License.
1728+ **/
1729+
1730+#ifndef _PAL_DRIVER_INTF_H_
1731+#define _PAL_DRIVER_INTF_H_
1732+
1733+#include "pal_uart.h"
1734+#include "pal_nvmem.h"
1735+#include "pal_wd_rpi.h"
1736+
1737+void pal_uart_init(uint32_t uart_base_addr);
1738+void pal_print(const char *str, int32_t data);
1739+int pal_nvmem_write(addr_t base, uint32_t offset, void *buffer, int size);
1740+int pal_nvmem_read(addr_t base, uint32_t offset, void *buffer, int size);
1741+int pal_wd_timer_init(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us);
1742+int pal_wd_timer_enable(addr_t base_addr);
1743+int pal_wd_timer_disable(addr_t base_addr);
1744+int pal_wd_timer_is_enabled(addr_t base_addr);
1745+void pal_generate_interrupt(void);
1746+void pal_disable_interrupt(void);
1747+#endif /* _PAL_DRIVER_INTF_H_ */
1748diff --git a/api-tests/platform/targets/tgt_ff_tfm_rp2350/target.cfg b/api-tests/platform/targets/tgt_ff_tfm_rp2350/target.cfg
1749new file mode 100644
1750index 0000000..fa04f8a
1751--- /dev/null
1752+++ b/api-tests/platform/targets/tgt_ff_tfm_rp2350/target.cfg
1753@@ -0,0 +1,64 @@
1754+///** @file
1755+// * Copyright (c) 2019-2024, Arm Limited or its affiliates. All rights reserved.
1756+// * SPDX-License-Identifier : Apache-2.0
1757+// *
1758+// * Licensed under the Apache License, Version 2.0 (the "License");
1759+// * you may not use this file except in compliance with the License.
1760+// * You may obtain a copy of the License at
1761+// *
1762+// * http://www.apache.org/licenses/LICENSE-2.0
1763+// *
1764+// * Unless required by applicable law or agreed to in writing, software
1765+// * distributed under the License is distributed on an "AS IS" BASIS,
1766+// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1767+// * See the License for the specific language governing permissions and
1768+// * limitations under the License.
1769+//**/
1770+
1771+// UART device info
1772+uart.num=1;
1773+uart.0.base = 0x40070000; // UART0_NS
1774+uart.0.size = 0x3FFF;
1775+uart.0.intr_id = 0xFF;
1776+uart.0.permission = TYPE_READ_WRITE;
1777+
1778+// Watchdog device info
1779+watchdog.num = 1;
1780+watchdog.0.base = 0x400d8000;
1781+watchdog.0.size = 0x3FFF;
1782+watchdog.0.intr_id = 0xFF;
1783+watchdog.0.permission = TYPE_READ_WRITE;
1784+watchdog.0.num_of_tick_per_micro_sec = 0x1;
1785+watchdog.0.timeout_in_micro_sec_low = 0xF4240; //1.0 sec : 1 * 1000 * 1000
1786+watchdog.0.timeout_in_micro_sec_medium = 0x1E8480; //2.0 sec : 2 * 1000 * 1000
1787+watchdog.0.timeout_in_micro_sec_high = 0x895440; //9.0 sec : 9 * 1000 * 1000
1788+watchdog.0.timeout_in_micro_sec_crypto = 0xFFFFFF; //~16.7 sec : MAX supported
1789+
1790+// Range of 1KB Non-volatile memory to preserve data over reset. Ex, NVRAM and FLASH
1791+nvmem.num =1;
1792+nvmem.0.start = 0x2005EC00;
1793+nvmem.0.end = 0x2005EFFF;
1794+nvmem.0.permission = TYPE_READ_WRITE;
1795+
1796+// ###################################################################
1797+// Following Target configuration parameters are required for IPC tests
1798+// only. Avoid updating them if you are running dev_apis tests.
1799+// ###################################################################
1800+
1801+// Assign free memory range for isolation testing. Choose the addresses
1802+// for these memory regions such that it follows below condition:
1803+// nspe_mmio.0.start < server_partition_mmio.0.start < driver_partition_mmio.0.start.
1804+nspe_mmio.num=1;
1805+nspe_mmio.0.start = 0x2005E000;
1806+nspe_mmio.0.end = 0x2005E3FF;
1807+nspe_mmio.0.permission = TYPE_READ_WRITE;
1808+
1809+server_partition_mmio.num=1;
1810+server_partition_mmio.0.start = 0x2005E400;
1811+server_partition_mmio.0.end = 0x2005E4FF;
1812+server_partition_mmio.0.permission = TYPE_READ_WRITE;
1813+
1814+driver_partition_mmio.num=1;
1815+driver_partition_mmio.0.start = 0x2005E600;
1816+driver_partition_mmio.0.end = 0x2005E6FF;
1817+driver_partition_mmio.0.permission = TYPE_READ_WRITE;
1818diff --git a/api-tests/platform/targets/tgt_ff_tfm_rp2350/target.cmake b/api-tests/platform/targets/tgt_ff_tfm_rp2350/target.cmake
1819new file mode 100644
1820index 0000000..7f64359
1821--- /dev/null
1822+++ b/api-tests/platform/targets/tgt_ff_tfm_rp2350/target.cmake
1823@@ -0,0 +1,74 @@
1824+#/** @file
1825+# * Copyright (c) 2019-2024, Arm Limited or its affiliates. All rights reserved.
1826+# * SPDX-License-Identifier : Apache-2.0
1827+# *
1828+# * Licensed under the Apache License, Version 2.0 (the "License");
1829+# * you may not use this file except in compliance with the License.
1830+# * You may obtain a copy of the License at
1831+# *
1832+# * http://www.apache.org/licenses/LICENSE-2.0
1833+# *
1834+# * Unless required by applicable law or agreed to in writing, software
1835+# * distributed under the License is distributed on an "AS IS" BASIS,
1836+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1837+# * See the License for the specific language governing permissions and
1838+# * limitations under the License.
1839+#**/
1840+
1841+# PAL C source files part of NSPE library
1842+list(APPEND PAL_SRC_C_NSPE )
1843+
1844+# PAL ASM source files part of NSPE library
1845+list(APPEND PAL_SRC_ASM_NSPE )
1846+
1847+# PAL C source files part of SPE library - driver partition
1848+list(APPEND PAL_SRC_C_DRIVER_SP )
1849+
1850+# PAL ASM source files part of SPE library - driver partition
1851+list(APPEND PAL_SRC_ASM_DRIVER_SP )
1852+
1853+
1854+# Listing all the sources required for given target
1855+if(${SUITE} STREQUAL "IPC")
1856+ list(APPEND PAL_SRC_C_NSPE
1857+ # driver functionalities are implemented as RoT-services
1858+ # and secure and non-secure clients will call to these RoT-services to get appropriate driver services.
1859+ ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/pal_driver_ipc_intf.c
1860+ )
1861+ list(APPEND PAL_SRC_C_DRIVER_SP
1862+ # Driver files will be compiled as part of driver partition
1863+ ${PSA_ROOT_DIR}/platform/targets/${TARGET}/spe/pal_driver_intf.c
1864+ ${PSA_ROOT_DIR}/platform/drivers/nvmem/pal_nvmem.c
1865+ ${PSA_ROOT_DIR}/platform/drivers/uart/pl011/pal_uart.c
1866+ ${PSA_ROOT_DIR}/platform/drivers/watchdog/rpi/pal_wd_rpi.c
1867+ )
1868+endif()
1869+
1870+if((${SUITE} STREQUAL "CRYPTO") OR
1871+ (${SUITE} STREQUAL "STORAGE") OR
1872+ (${SUITE} STREQUAL "PROTECTED_STORAGE") OR
1873+ (${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE") OR
1874+ (${SUITE} STREQUAL "INITIAL_ATTESTATION"))
1875+ message(FATAL_ERROR "For PSA API - use -DTARGET=tgt_dev_apis_tfm_rp2350 instead")
1876+endif()
1877+
1878+# Create NSPE library
1879+add_library(${PSA_TARGET_PAL_NSPE_LIB} STATIC ${PAL_SRC_C_NSPE} ${PAL_SRC_ASM_NSPE})
1880+
1881+# PSA Include directories
1882+foreach(psa_inc_path ${PSA_INCLUDE_PATHS})
1883+ target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE ${psa_inc_path})
1884+endforeach()
1885+
1886+list(APPEND PAL_DRIVER_INCLUDE_PATHS
1887+ ${PSA_ROOT_DIR}/platform/drivers/nvmem
1888+ ${PSA_ROOT_DIR}/platform/drivers/uart/pl011
1889+ ${PSA_ROOT_DIR}/platform/drivers/watchdog/rpi
1890+)
1891+
1892+target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE
1893+ ${PAL_DRIVER_INCLUDE_PATHS}
1894+ ${PSA_ROOT_DIR}/platform/targets/common/nspe
1895+ ${PSA_ROOT_DIR}/platform/targets/common/nspe/crypto
1896+ ${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe
1897+)
1898--
18992.40.1
1900