Test: Enable FP usage in NSPE
1. Enable FP usage in NSPE by adding FP compile option for NS test
framework and NS library.
2. Add FP test cases in NSPE.
Signed-off-by: Feder Liang <Feder.Liang@arm.com>
Change-Id: I95d97fbfb06e40ef3d4caa5b8f85a52a29c37a46
diff --git a/app/main_ns.c b/app/main_ns.c
index 6b73898..e9ab48d 100644
--- a/app/main_ns.c
+++ b/app/main_ns.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -25,6 +25,9 @@
#endif
#include "tfm_log.h"
#include "uart_stdout.h"
+#if (CONFIG_TFM_FP >= 1)
+#include "cmsis.h"
+#endif
/**
* \brief Modified table template for user defined SVC functions
@@ -131,6 +134,19 @@
return ARM_DRIVER_OK;
}
+
+__WEAK int32_t tfm_ns_cp_init(void)
+{
+#if (CONFIG_TFM_FP >= 1)
+#ifdef __GNUC__
+ /* Enable NSPE privileged and unprivilged access to the FP Extension */
+ SCB->CPACR |= (3U << 10U*2U) /* enable CP10 full access */
+ | (3U << 11U*2U); /* enable CP11 full access */
+#endif
+#endif
+ return ARM_DRIVER_OK;
+}
+
/**
* \brief main() function
*/
@@ -144,6 +160,11 @@
while(1);
}
+ if (tfm_ns_cp_init() != ARM_DRIVER_OK) {
+ /* Avoid undefined behavior if co-porcessor init failed */
+ while(1);
+ }
+
(void) osKernelInitialize();
#ifdef TFM_MULTI_CORE_TOPOLOGY