summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso
diff options
context:
space:
mode:
Diffstat (limited to 'FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso')
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Config/FreeRTOSConfig.h128
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.cproject2
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.project33
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/fault_handler.c (renamed from FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/nsc_printf.h)27
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/main_ns.c198
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/reg_tests.c446
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/reg_tests.h35
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.cproject11
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.project25
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/main_s.c131
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/nsc_printf.c78
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/tzm_config.c272
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/tzm_config.h18
15 files changed, 131 insertions, 1277 deletions
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Config/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Config/FreeRTOSConfig.h
index a1348de26..7d56eee98 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Config/FreeRTOSConfig.h
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Config/FreeRTOSConfig.h
@@ -25,8 +25,8 @@
*/
/******************************************************************************
- See http://www.freertos.org/a00110.html for an explanation of the
- definitions contained in this file.
+ See http://www.freertos.org/a00110.html for an explanation of the
+ definitions contained in this file.
******************************************************************************/
#ifndef FREERTOS_CONFIG_H
@@ -46,122 +46,122 @@
#include "clock_config.h"
/* Cortex M33 port configuration. */
-#define configENABLE_MPU 1
-#define configENABLE_FPU 1
-#define configENABLE_TRUSTZONE 1
+#define configENABLE_MPU 1
+#define configENABLE_FPU 1
+#define configENABLE_TRUSTZONE 1
/* Constants related to the behaviour or the scheduler. */
-#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
-#define configUSE_PREEMPTION 1
-#define configUSE_TIME_SLICING 1
-#define configMAX_PRIORITIES ( 5 )
-#define configIDLE_SHOULD_YIELD 1
-#define configUSE_16_BIT_TICKS 0 /* Only for 8 and 16-bit hardware. */
+#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
+#define configUSE_PREEMPTION 1
+#define configUSE_TIME_SLICING 1
+#define configMAX_PRIORITIES ( 5 )
+#define configIDLE_SHOULD_YIELD 1
+#define configUSE_16_BIT_TICKS 0 /* Only for 8 and 16-bit hardware. */
/* Constants that describe the hardware and memory usage. */
-#define configCPU_CLOCK_HZ BOARD_BOOTCLOCKFROHF96M_CORE_CLOCK
-#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 128 )
-#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
-#define configMAX_TASK_NAME_LEN ( 12 )
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 50 * 1024 ) )
+#define configCPU_CLOCK_HZ BOARD_BOOTCLOCKFROHF96M_CORE_CLOCK
+#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 128 )
+#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
+#define configMAX_TASK_NAME_LEN ( 12 )
+#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 50 * 1024 ) )
/* Constants that build features in or out. */
-#define configUSE_MUTEXES 1
-#define configUSE_TICKLESS_IDLE 1
-#define configUSE_APPLICATION_TASK_TAG 0
-#define configUSE_NEWLIB_REENTRANT 0
-#define configUSE_COUNTING_SEMAPHORES 1
-#define configUSE_RECURSIVE_MUTEXES 1
-#define configUSE_QUEUE_SETS 0
-#define configUSE_TASK_NOTIFICATIONS 1
-#define configUSE_TRACE_FACILITY 1
+#define configUSE_MUTEXES 1
+#define configUSE_TICKLESS_IDLE 1
+#define configUSE_APPLICATION_TASK_TAG 0
+#define configUSE_NEWLIB_REENTRANT 0
+#define configUSE_COUNTING_SEMAPHORES 1
+#define configUSE_RECURSIVE_MUTEXES 1
+#define configUSE_QUEUE_SETS 0
+#define configUSE_TASK_NOTIFICATIONS 1
+#define configUSE_TRACE_FACILITY 1
/* Constants that define which hook (callback) functions should be used. */
-#define configUSE_IDLE_HOOK 0
-#define configUSE_TICK_HOOK 0
-#define configUSE_MALLOC_FAILED_HOOK 0
+#define configUSE_IDLE_HOOK 0
+#define configUSE_TICK_HOOK 0
+#define configUSE_MALLOC_FAILED_HOOK 0
/* Constants provided for debugging and optimisation assistance. */
-#define configCHECK_FOR_STACK_OVERFLOW 2
-#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
-#define configQUEUE_REGISTRY_SIZE 0
+#define configCHECK_FOR_STACK_OVERFLOW 2
+#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
+#define configQUEUE_REGISTRY_SIZE 0
/* Software timer definitions. */
-#define configUSE_TIMERS 1
-#define configTIMER_TASK_PRIORITY ( 3 )
-#define configTIMER_QUEUE_LENGTH 5
-#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
+#define configUSE_TIMERS 1
+#define configTIMER_TASK_PRIORITY ( 3 )
+#define configTIMER_QUEUE_LENGTH 5
+#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
/* Set the following definitions to 1 to include the API function, or zero
* to exclude the API function. NOTE: Setting an INCLUDE_ parameter to 0 is
* only necessary if the linker does not automatically remove functions that are
* not referenced anyway. */
-#define INCLUDE_vTaskPrioritySet 1
-#define INCLUDE_uxTaskPriorityGet 1
-#define INCLUDE_vTaskDelete 1
-#define INCLUDE_vTaskCleanUpResources 0
-#define INCLUDE_vTaskSuspend 1
-#define INCLUDE_vTaskDelayUntil 1
-#define INCLUDE_vTaskDelay 1
-#define INCLUDE_uxTaskGetStackHighWaterMark 0
-#define INCLUDE_xTaskGetIdleTaskHandle 0
-#define INCLUDE_eTaskGetState 1
-#define INCLUDE_xTaskResumeFromISR 0
-#define INCLUDE_xTaskGetCurrentTaskHandle 1
-#define INCLUDE_xTaskGetSchedulerState 0
-#define INCLUDE_xSemaphoreGetMutexHolder 0
-#define INCLUDE_xTimerPendFunctionCall 1
+#define INCLUDE_vTaskPrioritySet 1
+#define INCLUDE_uxTaskPriorityGet 1
+#define INCLUDE_vTaskDelete 1
+#define INCLUDE_vTaskCleanUpResources 0
+#define INCLUDE_vTaskSuspend 1
+#define INCLUDE_vTaskDelayUntil 1
+#define INCLUDE_vTaskDelay 1
+#define INCLUDE_uxTaskGetStackHighWaterMark 0
+#define INCLUDE_xTaskGetIdleTaskHandle 0
+#define INCLUDE_eTaskGetState 1
+#define INCLUDE_xTaskResumeFromISR 0
+#define INCLUDE_xTaskGetCurrentTaskHandle 1
+#define INCLUDE_xTaskGetSchedulerState 0
+#define INCLUDE_xSemaphoreGetMutexHolder 0
+#define INCLUDE_xTimerPendFunctionCall 1
/* This demo makes use of one or more example stats formatting functions. These
* format the raw data provided by the uxTaskGetSystemState() function in to
* human readable ASCII form. See the notes in the implementation of vTaskList()
* within FreeRTOS/Source/tasks.c for limitations. */
-#define configUSE_STATS_FORMATTING_FUNCTIONS 1
+#define configUSE_STATS_FORMATTING_FUNCTIONS 1
/* Dimensions a buffer that can be used by the FreeRTOS+CLI command interpreter.
* See the FreeRTOS+CLI documentation for more information:
* https://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_CLI/ */
-#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048
+#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048
/* Interrupt priority configuration follows...................... */
/* Use the system definition, if there is one. */
#ifdef __NVIC_PRIO_BITS
- #define configPRIO_BITS __NVIC_PRIO_BITS
+ #define configPRIO_BITS __NVIC_PRIO_BITS
#else
- #define configPRIO_BITS 3 /* 8 priority levels. */
+ #define configPRIO_BITS 3 /* 8 priority levels. */
#endif
/* The lowest interrupt priority that can be used in a call to a "set priority"
* function. */
-#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x07
+#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x07
/* The highest interrupt priority that can be used by any interrupt service
* routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT
* CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A
* HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values). */
-#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
+#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
/* Interrupt priorities used by the kernel port layer itself. These are generic
* to all Cortex-M ports, and do not rely on any particular library functions. */
-#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
+#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
* See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
-#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
+#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
/* The #ifdef guards against the file being included from IAR assembly files. */
#ifndef __IASMARM__
- /* Constants related to the generation of run time stats. */
- #define configGENERATE_RUN_TIME_STATS 0
- #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
- #define portGET_RUN_TIME_COUNTER_VALUE() 0
- #define configTICK_RATE_HZ ( ( TickType_t ) 100 )
+ /* Constants related to the generation of run time stats. */
+ #define configGENERATE_RUN_TIME_STATS 0
+ #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
+ #define portGET_RUN_TIME_COUNTER_VALUE() 0
+ #define configTICK_RATE_HZ ( ( TickType_t ) 100 )
#endif /* __IASMARM__ */
/* Enable static allocation. */
-#define configSUPPORT_STATIC_ALLOCATION 1
+#define configSUPPORT_STATIC_ALLOCATION 1
#endif /* FREERTOS_CONFIG_H */
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.cproject b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.cproject
index e5ea92f11..9d63c2c65 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.cproject
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.cproject
@@ -115,6 +115,8 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.88237135" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="../../Config"/>
<listOptionValue builtIn="false" value="../../Secure"/>
+ <listOptionValue builtIn="false" value="../../../../NSC_Functions"/>
+ <listOptionValue builtIn="false" value="../../../../RegTests"/>
<listOptionValue builtIn="false" value="../../../../NXP_Code"/>
<listOptionValue builtIn="false" value="../../../../NXP_Code/board"/>
<listOptionValue builtIn="false" value="../../../../NXP_Code/source"/>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.project b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.project
index 4afbd6e4e..8588fa7ec 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.project
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.project
@@ -83,19 +83,24 @@
<locationURI>PARENT-4-PROJECT_LOC/Common/ARMv8M/tz_demo/tz_demo.h</locationURI>
</link>
<link>
+ <name>User/fault_handler.c</name>
+ <type>1</type>
+ <locationURI>PROJECT_LOC/fault_handler.c</locationURI>
+ </link>
+ <link>
<name>User/main_ns.c</name>
<type>1</type>
- <locationURI>PROJECT_LOC/main_ns.c</locationURI>
+ <locationURI>DEMO_ROOT/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/NonSecure/main_ns.c</locationURI>
</link>
<link>
- <name>User/res_tests.c</name>
+ <name>User/reg_tests.c</name>
<type>1</type>
- <locationURI>PROJECT_LOC/reg_tests.c</locationURI>
+ <locationURI>DEMO_ROOT/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/RegTests/reg_tests.c</locationURI>
</link>
</linkedResources>
<filteredResources>
<filter>
- <id>1681724631111</id>
+ <id>1682451970778</id>
<name></name>
<type>6</type>
<matcher>
@@ -104,7 +109,7 @@
</matcher>
</filter>
<filter>
- <id>1681724631147</id>
+ <id>1682451970814</id>
<name></name>
<type>6</type>
<matcher>
@@ -113,6 +118,15 @@
</matcher>
</filter>
<filter>
+ <id>1682451751797</id>
+ <name>NXP_Code</name>
+ <type>10</type>
+ <matcher>
+ <id>org.eclipse.ui.ide.multiFilter</id>
+ <arguments>1.0-name-matches-false-false-trustzone</arguments>
+ </matcher>
+ </filter>
+ <filter>
<id>1681721788469</id>
<name>reg_tests</name>
<type>9</type>
@@ -158,6 +172,15 @@
</matcher>
</filter>
<filter>
+ <id>1682451733052</id>
+ <name>NXP_Code/startup</name>
+ <type>6</type>
+ <matcher>
+ <id>org.eclipse.ui.ide.multiFilter</id>
+ <arguments>1.0-name-matches-false-false-startup_LPC55S69_cm33_core0.s</arguments>
+ </matcher>
+ </filter>
+ <filter>
<id>1681721804811</id>
<name>reg_tests/GCC</name>
<type>9</type>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.settings/org.eclipse.core.resources.prefs b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..99f26c020
--- /dev/null
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/nsc_printf.h b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/fault_handler.c
index 1362b4556..0a6d1b9ab 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/nsc_printf.h
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/fault_handler.c
@@ -24,14 +24,27 @@
*
*/
-#ifndef NSC_PRINTF_H
-#define NSC_PRINTF_H
-
/**
- * @brief Non-Secure callable printf function.
+ * @brief The mem fault handler.
*
- * @param str The string to print.
+ * It calls a function called vHandleMemoryFault.
*/
-void NSC_Printf( char const *str );
+void MemManage_Handler( void ) __attribute__ ( ( naked ) );
+/*-----------------------------------------------------------*/
-#endif /* NSC_PRINTF_H */
+void MemManage_Handler( void ) /* __attribute__ ( ( naked ) ) */
+{
+ __asm volatile
+ (
+ " tst lr, #4 \n"
+ " ite eq \n"
+ " mrseq r0, msp \n"
+ " mrsne r0, psp \n"
+ " ldr r1, handler_address_const \n"
+ " bx r1 \n"
+ " \n"
+ " .align 4 \n"
+ " handler_address_const: .word vHandleMemoryFault \n"
+ );
+}
+/*-----------------------------------------------------------*/
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/main_ns.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/main_ns.c
deleted file mode 100644
index 7967a3c68..000000000
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/main_ns.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * FreeRTOS V202212.00
- * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * https://www.FreeRTOS.org
- * https://github.com/FreeRTOS
- *
- */
-
-/* FreeRTOS include. */
-#include "FreeRTOS.h"
-#include "task.h"
-
-/* Device includes. */
-#include "fsl_device_registers.h"
-#include "fsl_debug_console.h"
-#include "pin_mux.h"
-#include "board.h"
-#include "clock_config.h"
-#include "fsl_power.h"
-
-/* Demo includes. */
-#include "tz_demo.h"
-#include "mpu_demo.h"
-#include "reg_tests.h"
-/*-----------------------------------------------------------*/
-
-/**
- * @brief Create all demo tasks.
- */
-static void prvCreateTasks( void );
-
-/**
- * @brief Setup hardware.
- */
-static void prvSetupHardware( void );
-
-/**
- * @brief Application-specific implementation of the SystemInit() weak
- * function.
- */
-void SystemInit( void );
-
-/**
- * @brief The mem fault handler.
- *
- * It calls a function called vHandleMemoryFault.
- */
-void MemManage_Handler( void ) __attribute__ ( ( naked ) );
-/*-----------------------------------------------------------*/
-
-/* For instructions on how to build and run this demo, visit the following link:
- * https://www.freertos.org/RTOS-Cortex-M33-LPC55S69-MCUXpresso-GCC.html
- */
-
-/* Non-Secure main. */
-int main( void )
-{
- /* Setup hardware. */
- prvSetupHardware();
-
- /* Create tasks. */
- prvCreateTasks();
-
- /* Start scheduler. */
- vTaskStartScheduler();
-
- /* Will not get here if the scheduler starts successfully. If you do end up
- here then there wasn't enough heap memory available to start either the idle
- task or the timer/daemon task. https://www.freertos.org/a00111.html */
-
- for( ; ; )
- {
- }
-}
-/*-----------------------------------------------------------*/
-
-static void prvCreateTasks( void )
-{
- /* Create tasks for the MPU Demo. */
- vStartMPUDemo();
-
- /* Create tasks for the TZ Demo. */
- vStartTZDemo();
-
- /* Create tasks for reg tests. */
- vStartRegTests();
-}
-/*-----------------------------------------------------------*/
-
-static void prvSetupHardware( void )
-{
- /* Set BOD VBAT level to 1.65V. */
- POWER_SetBodVbatLevel( kPOWER_BodVbatLevel1650mv, kPOWER_BodHystLevel50mv, false );
-}
-/*-----------------------------------------------------------*/
-
-void SystemInit( void )
-{
- /* Nothing needs to be initialized for Non-Secure project. */
-}
-/*-----------------------------------------------------------*/
-
-/* Stack overflow hook. */
-void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName )
-{
- /* Force an assert. */
- configASSERT( pcTaskName == 0 );
-}
-/*-----------------------------------------------------------*/
-
-/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
- * implementation of vApplicationGetIdleTaskMemory() to provide the memory that
- * is used by the Idle task. */
-void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
- StackType_t ** ppxIdleTaskStackBuffer,
- uint32_t * pulIdleTaskStackSize )
-{
- /* If the buffers to be provided to the Idle task are declared inside this
- * function then they must be declared static - otherwise they will be
- * allocated on the stack and so not exists after this function exits. */
- static StaticTask_t xIdleTaskTCB;
- static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
-
- /* Pass out a pointer to the StaticTask_t structure in which the Idle
- * task's state will be stored. */
- *ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
-
- /* Pass out the array that will be used as the Idle task's stack. */
- *ppxIdleTaskStackBuffer = uxIdleTaskStack;
-
- /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
- * Note that, as the array is necessarily of type StackType_t,
- * configMINIMAL_STACK_SIZE is specified in words, not bytes. */
- *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
-}
-/*-----------------------------------------------------------*/
-
-/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
- * application must provide an implementation of vApplicationGetTimerTaskMemory()
- * to provide the memory that is used by the Timer service task. */
-void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
- StackType_t ** ppxTimerTaskStackBuffer,
- uint32_t * pulTimerTaskStackSize )
-{
- /* If the buffers to be provided to the Timer task are declared inside this
- * function then they must be declared static - otherwise they will be
- * allocated on the stack and so not exists after this function exits. */
- static StaticTask_t xTimerTaskTCB;
- static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ] __attribute__( ( aligned( 32 ) ) );
-
- /* Pass out a pointer to the StaticTask_t structure in which the Timer
- * task's state will be stored. */
- *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
-
- /* Pass out the array that will be used as the Timer task's stack. */
- *ppxTimerTaskStackBuffer = uxTimerTaskStack;
-
- /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
- * Note that, as the array is necessarily of type StackType_t,
- * configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. */
- *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
-}
-/*-----------------------------------------------------------*/
-
-void MemManage_Handler( void )
-{
- __asm volatile
- (
- " tst lr, #4 \n"
- " ite eq \n"
- " mrseq r0, msp \n"
- " mrsne r0, psp \n"
- " ldr r1, handler_address_const \n"
- " bx r1 \n"
- " \n"
- " .align 4 \n"
- " handler_address_const: .word vHandleMemoryFault \n"
- );
-}
-/*-----------------------------------------------------------*/
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/reg_tests.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/reg_tests.c
deleted file mode 100644
index 831ec6479..000000000
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/reg_tests.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * FreeRTOS V202212.00
- * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * https://www.FreeRTOS.org
- * https://github.com/FreeRTOS
- *
- */
-
-/* Scheduler includes. */
-#include "FreeRTOS.h"
-#include "task.h"
-
-/* Reg test includes. */
-#include "reg_tests.h"
-#include "reg_test_asm.h"
-#include "secure_reg_test_asm.h"
-
-/* Printf includes. */
-#include "nsc_printf.h"
-
-/*
- * Functions that implement reg test tasks.
- */
-static void prvRegTest1_Task( void * pvParameters );
-static void prvRegTest2_Task( void * pvParameters );
-static void prvRegTest3_Task( void * pvParameters );
-static void prvRegTest4_Task( void * pvParameters );
-static void prvRegTest_Secure_Task( void * pvParameters );
-static void prvRegTest_NonSecureCallback_Task( void * pvParameters );
-/*
- * Check task periodically checks that reg tests tasks
- * are running fine.
- */
-static void prvCheckTask( void * pvParameters );
-/*-----------------------------------------------------------*/
-
-/*
- * Priority of the check task.
- */
-#define CHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
-
-/*
- * Frequency of check task.
- */
-#define NO_ERROR_CHECK_TASK_PERIOD ( pdMS_TO_TICKS( 5000UL ) )
-#define ERROR_CHECK_TASK_PERIOD ( pdMS_TO_TICKS( 200UL ) )
-
-/*
- * Parameters passed to reg test tasks.
- */
-#define REG_TEST_1_TASK_PARAMETER ( ( void * ) 0x12345678 )
-#define REG_TEST_2_TASK_PARAMETER ( ( void * ) 0x87654321 )
-#define REG_TEST_3_TASK_PARAMETER ( ( void * ) 0x12348765 )
-#define REG_TEST_4_TASK_PARAMETER ( ( void * ) 0x43215678 )
-#define REG_TEST_SECURE_TASK_PARAMETER ( ( void * ) 0x1234ABCD )
-#define REG_TEST_NON_SECURE_CALLBACK_TASK_PARAMETER ( ( void * ) 0xABCD1234 )
-/*-----------------------------------------------------------*/
-
-/*
- * The following variables are used to communicate the status of the register
- * test tasks to the check task. If the variables keep incrementing, then the
- * register test tasks have not discovered any errors. If a variable stops
- * incrementing, then an error has been found.
- */
-volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;
-volatile unsigned long ulRegTest3LoopCounter = 0UL, ulRegTest4LoopCounter = 0UL;
-volatile unsigned long ulRegTestSecureLoopCounter = 0UL;
-volatile unsigned long ulRegTestNonSecureCallbackLoopCounter = 0UL;
-
-/**
- * Counter to keep a count of how may times the check task loop has detected
- * error.
- */
-volatile unsigned long ulCheckTaskLoops = 0UL;
-/*-----------------------------------------------------------*/
-
-void vStartRegTests( void )
-{
-static StackType_t xRegTest1TaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
-static StackType_t xRegTest2TaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
-static StackType_t xRegTest3TaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
-static StackType_t xRegTest4TaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
-static StackType_t xRegTestSecureTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
-static StackType_t xRegTestNonSecureCallbackTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
-static StackType_t xCheckTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );
-
-TaskParameters_t xRegTest1TaskParameters =
-{
- .pvTaskCode = prvRegTest1_Task,
- .pcName = "RegTest1",
- .usStackDepth = configMINIMAL_STACK_SIZE,
- .pvParameters = REG_TEST_1_TASK_PARAMETER,
- .uxPriority = tskIDLE_PRIORITY | portPRIVILEGE_BIT,
- .puxStackBuffer = xRegTest1TaskStack,
- .xRegions = {
- { 0, 0, 0 },
- { 0, 0, 0 },
- { 0, 0, 0 }
- }
-};
-TaskParameters_t xRegTest2TaskParameters =
-{
- .pvTaskCode = prvRegTest2_Task,
- .pcName = "RegTest2",
- .usStackDepth = configMINIMAL_STACK_SIZE,
- .pvParameters = REG_TEST_2_TASK_PARAMETER,
- .uxPriority = tskIDLE_PRIORITY | portPRIVILEGE_BIT,
- .puxStackBuffer = xRegTest2TaskStack,
- .xRegions = {
- { 0, 0, 0 },
- { 0, 0, 0 },
- { 0, 0, 0 }
- }
-};
-TaskParameters_t xRegTest3TaskParameters =
-{
- .pvTaskCode = prvRegTest3_Task,
- .pcName = "RegTest3",
- .usStackDepth = configMINIMAL_STACK_SIZE,
- .pvParameters = REG_TEST_3_TASK_PARAMETER,
- .uxPriority = tskIDLE_PRIORITY | portPRIVILEGE_BIT,
- .puxStackBuffer = xRegTest3TaskStack,
- .xRegions = {
- { 0, 0, 0 },
- { 0, 0, 0 },
- { 0, 0, 0 }
- }
-};
-TaskParameters_t xRegTest4TaskParameters =
-{
- .pvTaskCode = prvRegTest4_Task,
- .pcName = "RegTest4",
- .usStackDepth = configMINIMAL_STACK_SIZE,
- .pvParameters = REG_TEST_4_TASK_PARAMETER,
- .uxPriority = tskIDLE_PRIORITY | portPRIVILEGE_BIT,
- .puxStackBuffer = xRegTest4TaskStack,
- .xRegions = {
- { 0, 0, 0 },
- { 0, 0, 0 },
- { 0, 0, 0 }
- }
-};
-TaskParameters_t xRegTestSecureTaskParameters =
-{
- .pvTaskCode = prvRegTest_Secure_Task,
- .pcName = "RegTestSecure",
- .usStackDepth = configMINIMAL_STACK_SIZE,
- .pvParameters = REG_TEST_SECURE_TASK_PARAMETER,
- .uxPriority = tskIDLE_PRIORITY | portPRIVILEGE_BIT,
- .puxStackBuffer = xRegTestSecureTaskStack,
- .xRegions = {
- { 0, 0, 0 },
- { 0, 0, 0 },
- { 0, 0, 0 }
- }
-};
-TaskParameters_t xRegTestNonSecureCallbackTaskParameters =
-{
- .pvTaskCode = prvRegTest_NonSecureCallback_Task,
- .pcName = "RegTestNonSecureCallback",
- .usStackDepth = configMINIMAL_STACK_SIZE,
- .pvParameters = REG_TEST_NON_SECURE_CALLBACK_TASK_PARAMETER,
- .uxPriority = tskIDLE_PRIORITY | portPRIVILEGE_BIT,
- .puxStackBuffer = xRegTestNonSecureCallbackTaskStack,
- .xRegions = {
- { 0, 0, 0 },
- { 0, 0, 0 },
- { 0, 0, 0 }
- }
-};
-
-TaskParameters_t xCheckTaskParameters =
-{
- .pvTaskCode = prvCheckTask,
- .pcName = "Check",
- .usStackDepth = configMINIMAL_STACK_SIZE,
- .pvParameters = NULL,
- .uxPriority = ( CHECK_TASK_PRIORITY | portPRIVILEGE_BIT ),
- .puxStackBuffer = xCheckTaskStack,
- .xRegions = {
- { 0, 0, 0 },
- { 0, 0, 0 },
- { 0, 0, 0 }
- }
-};
-
- xTaskCreateRestricted( &( xRegTest1TaskParameters ), NULL );
- xTaskCreateRestricted( &( xRegTest2TaskParameters ), NULL );
- xTaskCreateRestricted( &( xRegTest3TaskParameters ), NULL );
- xTaskCreateRestricted( &( xRegTest4TaskParameters ), NULL );
- xTaskCreateRestricted( &( xRegTestSecureTaskParameters ), NULL );
- xTaskCreateRestricted( &( xRegTestNonSecureCallbackTaskParameters ), NULL );
- xTaskCreateRestricted( &( xCheckTaskParameters ), NULL );
-}
-/*-----------------------------------------------------------*/
-
-static void prvRegTest1_Task( void * pvParameters )
-{
- /* Although the reg tests are written in assembly, its entry
- * point is written in C for convenience of checking that the
- * task parameter is being passed in correctly. */
- if( pvParameters == REG_TEST_1_TASK_PARAMETER )
- {
- /* Start the part of the test that is written in assembler. */
- vRegTest1Asm_NonSecure();
- }
-
- /* The following line will only execute if the task parameter
- * is found to be incorrect. The check task will detect that
- * the reg test loop counter is not being incremented and flag
- * an error. */
- vTaskDelete( NULL );
-}
-/*-----------------------------------------------------------*/
-
-static void prvRegTest2_Task( void * pvParameters )
-{
- /* Although the reg tests are written in assembly, its entry
- * point is written in C for convenience of checking that the
- * task parameter is being passed in correctly. */
- if( pvParameters == REG_TEST_2_TASK_PARAMETER )
- {
- /* Start the part of the test that is written in assembler. */
- vRegTest2Asm_NonSecure();
- }
-
- /* The following line will only execute if the task parameter
- * is found to be incorrect. The check task will detect that
- * the reg test loop counter is not being incremented and flag
- * an error. */
- vTaskDelete( NULL );
-}
-/*-----------------------------------------------------------*/
-
-static void prvRegTest3_Task( void * pvParameters )
-{
- /* Although the reg tests are written in assembly, its entry
- * point is written in C for convenience of checking that the
- * task parameter is being passed in correctly. */
- if( pvParameters == REG_TEST_3_TASK_PARAMETER )
- {
- /* Start the part of the test that is written in assembler. */
- vRegTest3Asm_NonSecure();
- }
-
- /* The following line will only execute if the task parameter
- * is found to be incorrect. The check task will detect that
- * the reg test loop counter is not being incremented and flag
- * an error. */
- vTaskDelete( NULL );
-}
-/*-----------------------------------------------------------*/
-
-static void prvRegTest4_Task( void * pvParameters )
-{
- /* Although the reg tests are written in assembly, its entry
- * point is written in C for convenience of checking that the
- * task parameter is being passed in correctly. */
- if( pvParameters == REG_TEST_4_TASK_PARAMETER )
- {
- /* Start the part of the test that is written in assembler. */
- vRegTest4Asm_NonSecure();
- }
-
- /* The following line will only execute if the task parameter
- * is found to be incorrect. The check task will detect that
- * the reg test loop counter is not being incremented and flag
- * an error. */
- vTaskDelete( NULL );
-}
-/*-----------------------------------------------------------*/
-
-static void prvRegTest_Secure_Task( void * pvParameters )
-{
- /* This task is going to call secure side functions. */
- portALLOCATE_SECURE_CONTEXT( configMINIMAL_SECURE_STACK_SIZE );
-
- /* Although the reg tests are written in assembly, its entry
- * point is written in C for convenience of checking that the
- * task parameter is being passed in correctly. */
- if( pvParameters == REG_TEST_SECURE_TASK_PARAMETER )
- {
- for( ;; )
- {
- /* Call the secure side function. This function populates registers
- * with known values, then forces a context switch while on the
- * secure side and then verifies that the contents of the registers
- * are intact. This ensure that the context restoring mechanism
- * works properly when the interrupted task was in the middle of a
- * call to a secure side function. */
- vRegTestAsm_Secure();
-
- ulRegTestSecureLoopCounter += 1;
- }
- }
-
- /* The following line will only execute if the task parameter
- * is found to be incorrect. The check task will detect that
- * the reg test loop counter is not being incremented and flag
- * an error. */
- vTaskDelete( NULL );
-}
-/*-----------------------------------------------------------*/
-
-static void prvRegTest_NonSecureCallback_Task( void * pvParameters )
-{
- /* This task is going to call secure side functions. */
- portALLOCATE_SECURE_CONTEXT( configMINIMAL_SECURE_STACK_SIZE );
-
- /* Although the reg tests are written in assembly, its entry
- * point is written in C for convenience of checking that the
- * task parameter is being passed in correctly. */
- if( pvParameters == REG_TEST_NON_SECURE_CALLBACK_TASK_PARAMETER )
- {
- for( ;; )
- {
- /* Call the secure side function. This function calls the provided
- * non-secure callback which in-turn populates registers with
- * known values, then forces a context switch while on the
- * non-secure side and then verifies that the contents of the
- * registers are intact. This ensure that the context restoring
- * mechanism works properly when the interrupted task was in the
- * middle of a non-secure callback from the secure side. */
- vRegTest_NonSecureCallback( vRegTestAsm_NonSecureCallback );
-
- ulRegTestNonSecureCallbackLoopCounter += 1;
- }
- }
-
- /* The following line will only execute if the task parameter
- * is found to be incorrect. The check task will detect that
- * the reg test loop counter is not being incremented and flag
- * an error. */
- vTaskDelete( NULL );
-}
-/*-----------------------------------------------------------*/
-
-static void prvCheckTask( void * pvParameters )
-{
-TickType_t xDelayPeriod = NO_ERROR_CHECK_TASK_PERIOD;
-TickType_t xLastExecutionTime;
-unsigned long ulErrorFound = pdFALSE;
-static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;
-static unsigned long ulLastRegTest3Value = 0, ulLastRegTest4Value = 0;
-static unsigned long ulLastRegTestSecureValue = 0, ulLastRegTestNonSecureCallbackValue = 0;
-
- /* This task is going to call secure side functions for
- * printing messages. */
- portALLOCATE_SECURE_CONTEXT( configMINIMAL_SECURE_STACK_SIZE );
-
- /* Just to stop compiler warnings. */
- ( void ) pvParameters;
-
- /* Initialize xLastExecutionTime so the first call to vTaskDelayUntil()
- * works correctly. */
- xLastExecutionTime = xTaskGetTickCount();
-
- /* Cycle for ever, delaying then checking all the other tasks are still
- * operating without error. The onboard LED is toggled on each iteration.
- * If an error is detected then the delay period is decreased from
- * mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD. This has
- * the effect of increasing the rate at which the onboard LED toggles, and
- * in so doing gives visual feedback of the system status. */
- for( ;; )
- {
- /* Delay until it is time to execute again. */
- vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
-
- /* Check that the register test 1 task is still running. */
- if( ulLastRegTest1Value == ulRegTest1LoopCounter )
- {
- ulErrorFound |= 1UL << 0UL;
- }
- ulLastRegTest1Value = ulRegTest1LoopCounter;
-
- /* Check that the register test 2 task is still running. */
- if( ulLastRegTest2Value == ulRegTest2LoopCounter )
- {
- ulErrorFound |= 1UL << 1UL;
- }
- ulLastRegTest2Value = ulRegTest2LoopCounter;
-
- /* Check that the register test 3 task is still running. */
- if( ulLastRegTest3Value == ulRegTest3LoopCounter )
- {
- ulErrorFound |= 1UL << 2UL;
- }
- ulLastRegTest3Value = ulRegTest3LoopCounter;
-
- /* Check that the register test 4 task is still running. */
- if( ulLastRegTest4Value == ulRegTest4LoopCounter )
- {
- ulErrorFound |= 1UL << 3UL;
- }
- ulLastRegTest4Value = ulRegTest4LoopCounter;
-
- /* Check that the register test secure task is still running. */
- if( ulLastRegTestSecureValue == ulRegTestSecureLoopCounter )
- {
- ulErrorFound |= 1UL << 4UL;
- }
- ulLastRegTestSecureValue = ulRegTestSecureLoopCounter;
-
- /* Check that the register test non-secure callback task is
- * still running. */
- if( ulLastRegTestNonSecureCallbackValue == ulRegTestNonSecureCallbackLoopCounter )
- {
- ulErrorFound |= 1UL << 5UL;
- }
- ulLastRegTestNonSecureCallbackValue = ulRegTestNonSecureCallbackLoopCounter;
-
- if( ulErrorFound != pdFALSE )
- {
- /* An error has been detected in one of the tasks. */
- xDelayPeriod = ERROR_CHECK_TASK_PERIOD;
-
- NSC_Printf( "ERROR detected!\r\n" );
-
- /* Increment error detection count. */
- ulCheckTaskLoops++;
- }
- else
- {
- NSC_Printf( "No errors.\r\n" );
- }
- }
-}
-/*-----------------------------------------------------------*/
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/reg_tests.h b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/reg_tests.h
deleted file mode 100644
index 0837aad72..000000000
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/reg_tests.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * FreeRTOS V202212.00
- * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * https://www.FreeRTOS.org
- * https://github.com/FreeRTOS
- *
- */
-
-#ifndef REG_TESTS_H
-#define REG_TESTS_H
-
-/**
- * @brief Creates all the tasks for reg tests.
- */
-void vStartRegTests( void );
-
-#endif /* REG_TESTS_H */
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.cproject b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.cproject
index 349cc5d2a..bbf6bfa1b 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.cproject
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.cproject
@@ -119,6 +119,7 @@
<listOptionValue builtIn="false" value="../../../../NXP_Code/CMSIS"/>
<listOptionValue builtIn="false" value="../../../../NXP_Code/device"/>
<listOptionValue builtIn="false" value="../../../../NXP_Code/startup"/>
+ <listOptionValue builtIn="false" value="../../../../NXP_Code/trustzone"/>
<listOptionValue builtIn="false" value="../../../../NXP_Code/utilities"/>
<listOptionValue builtIn="false" value="../../../../NXP_Code/component/uart"/>
<listOptionValue builtIn="false" value="../../../../NXP_Code/component/lists"/>
@@ -333,16 +334,6 @@
</tool>
</toolChain>
</folderInfo>
- <folderInfo id="com.crt.advproject.config.exe.debug.650465968.1580633237" name="/" resourcePath="reg_tests">
- <toolChain id="com.crt.advproject.toolchain.exe.debug.1643158192" name="NXP MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug" unusedChildren="">
- <tool id="com.crt.advproject.cpp.exe.debug.1303225074" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug.248036726"/>
- <tool id="com.crt.advproject.gcc.exe.debug.806639634" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug.1827685058"/>
- <tool id="com.crt.advproject.gas.exe.debug.2004350830" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug.355931849"/>
- <tool id="com.crt.advproject.link.cpp.exe.debug.141362876" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug.767850316"/>
- <tool id="com.crt.advproject.link.exe.debug.558086384" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug.1425769789"/>
- <tool id="com.crt.advproject.tool.debug.debug.404468304" name="MCU Debugger" superClass="com.crt.advproject.tool.debug.debug.1632770985"/>
- </toolChain>
- </folderInfo>
<sourceEntries>
<entry flags="LOCAL|VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Config"/>
<entry flags="LOCAL|VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="NSCFunctions"/>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.project b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.project
index b4c624902..4c798137b 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.project
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.project
@@ -124,27 +124,17 @@
<link>
<name>User/main_s.c</name>
<type>1</type>
- <locationURI>PROJECT_LOC/main_s.c</locationURI>
+ <locationURI>DEMO_ROOT/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/Secure/main_s.c</locationURI>
</link>
<link>
<name>User/nsc_printf.c</name>
<type>1</type>
- <locationURI>PROJECT_LOC/nsc_printf.c</locationURI>
+ <locationURI>DEMO_ROOT/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NSC_Functions/nsc_printf.c</locationURI>
</link>
<link>
<name>User/nsc_printf.h</name>
<type>1</type>
- <locationURI>PROJECT_LOC/nsc_printf.h</locationURI>
- </link>
- <link>
- <name>User/tzm_config.c</name>
- <type>1</type>
- <locationURI>PROJECT_LOC/tzm_config.c</locationURI>
- </link>
- <link>
- <name>User/tzm_config.h</name>
- <type>1</type>
- <locationURI>PROJECT_LOC/tzm_config.h</locationURI>
+ <locationURI>DEMO_ROOT/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NSC_Functions/nsc_printf.h</locationURI>
</link>
</linkedResources>
<filteredResources>
@@ -176,6 +166,15 @@
</matcher>
</filter>
<filter>
+ <id>1682451336783</id>
+ <name>NXP_Code/startup</name>
+ <type>6</type>
+ <matcher>
+ <id>org.eclipse.ui.ide.multiFilter</id>
+ <arguments>1.0-name-matches-false-false-startup_LPC55S69_cm33_core0.s</arguments>
+ </matcher>
+ </filter>
+ <filter>
<id>1681721650651</id>
<name>reg_tests/GCC</name>
<type>9</type>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.settings/org.eclipse.core.resources.prefs b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..99f26c020
--- /dev/null
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/main_s.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/main_s.c
deleted file mode 100644
index abe5b7d85..000000000
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/main_s.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * FreeRTOS V202212.00
- * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * https://www.FreeRTOS.org
- * https://github.com/FreeRTOS
- *
- */
-
-/* FreeRTOS includes. */
-#include "secure_port_macros.h"
-
-/* Device includes. */
-#include "fsl_device_registers.h"
-#include "fsl_debug_console.h"
-#include "arm_cmse.h"
-#include "board.h"
-#include "tzm_config.h"
-#include "pin_mux.h"
-#include "clock_config.h"
-#include "fsl_power.h"
-
-#if ( __ARM_FEATURE_CMSE & 1 ) == 0
- #error "Need ARMv8-M security extensions"
-#elif ( __ARM_FEATURE_CMSE & 2 ) == 0
- #error "Compile with --cmse"
-#endif
-
-/* Start address of non-secure application. */
-#define mainNONSECURE_APP_START_ADDRESS ( 0x00010000UL )
-
-/* typedef for non-secure Reset Handler. */
-typedef void ( *NonSecureResetHandler_t ) ( void ) __attribute__( ( cmse_nonsecure_call ) );
-/*-----------------------------------------------------------*/
-
-/**
- * @brief Boots into the non-secure code.
- *
- * @param[in] ulNonSecureStartAddress Start address of the non-secure application.
- */
-static void prvBootNonSecure( uint32_t ulNonSecureStartAddress );
-
-/**
- * @brief Application-specific implementation of the SystemInitHook() weak
- * function.
- */
-void SystemInitHook( void );
-/*-----------------------------------------------------------*/
-
-/* For instructions on how to build and run this demo, visit the following link:
- * https://www.freertos.org/RTOS-Cortex-M33-LPC55S69-MCUXpresso-GCC.html
- */
-
-/* Secure main(). */
-int main(void)
-{
- /* Set BOD VBAT level to 1.65V. */
- POWER_SetBodVbatLevel( kPOWER_BodVbatLevel1650mv, kPOWER_BodHystLevel50mv, false );
-
- /* Attach main clock divide to FLEXCOMM0 (debug console). */
- CLOCK_AttachClk( BOARD_DEBUG_UART_CLK_ATTACH );
-
- /* Init board hardware. */
- BOARD_InitPins();
- BOARD_BootClockFROHF96M();
- BOARD_InitDebugConsole();
-
- /* Boot the non-secure code. */
- PRINTF( "Booting Non-Secure World.\r\n" );
- prvBootNonSecure( mainNONSECURE_APP_START_ADDRESS );
-
- /* Non-secure software does not return, this code is not executed. */
- for( ; ; )
- {
- /* Should not reach here. */
- }
-}
-/*-----------------------------------------------------------*/
-
-static void prvBootNonSecure( uint32_t ulNonSecureStartAddress )
-{
- NonSecureResetHandler_t pxNonSecureResetHandler;
-
- /* Setup the non-secure vector table. */
- SCB_NS->VTOR = ulNonSecureStartAddress;
-
- /* Main Stack Pointer value for the non-secure side is the first entry in
- * the non-secure vector table. Read the first entry and assign the same to
- * the non-secure main stack pointer(MSP_NS). */
- secureportSET_MSP_NS( *( ( uint32_t * )( ulNonSecureStartAddress ) ) );
-
- /* Reset Handler for the non-secure side is the second entry in the
- * non-secure vector table. Read the second entry to get the non-secure
- * Reset Handler. */
- pxNonSecureResetHandler = ( NonSecureResetHandler_t )( * ( ( uint32_t * ) ( ( ulNonSecureStartAddress ) + 4U ) ) );
-
- /* Start non-secure state software application by jumping to the non-secure
- * Reset Handler. */
- pxNonSecureResetHandler();
-}
-/*-----------------------------------------------------------*/
-
-void SystemInitHook( void )
-{
- /* Set CP10 and CP11 full access from Non-Secure code. */
- SCB_NS->CPACR |= ( ( 3UL << 10 * 2 ) | ( 3UL << 11 * 2 ) );
-
- /* The TrustZone should be configured as early as possible after RESET.
- * Therefore it is called from SystemInit() during startup. The
- * SystemInitHook() weak function overloading is used for this purpose.
- */
- BOARD_InitTrustZone();
-}
-/*-----------------------------------------------------------*/
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/nsc_printf.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/nsc_printf.c
deleted file mode 100644
index d3d04719f..000000000
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/nsc_printf.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * FreeRTOS V202212.00
- * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * https://www.FreeRTOS.org
- * https://github.com/FreeRTOS
- *
- */
-
-/* ARM includes. */
-#include <arm_cmse.h>
-
-/* Interface includes. */
-#include "nsc_printf.h"
-
-/* FreeRTOS includes. */
-#include "secure_port_macros.h"
-
-/* Device includes. */
-#include "fsl_debug_console.h"
-/*-----------------------------------------------------------*/
-
-/* Maximum length of the string that the non-secure code
- * can print. */
-#define MAX_ALLOWED_STRING_LENGTH 0x400
-/*-----------------------------------------------------------*/
-
-secureportNON_SECURE_CALLABLE void NSC_Printf( char const *str )
-{
- uint32_t isInvalidSting = 0;
- size_t stringLength;
-
- /* Check whether the string is null terminated. */
- stringLength = strnlen( str, MAX_ALLOWED_STRING_LENGTH );
-
- if( ( stringLength == MAX_ALLOWED_STRING_LENGTH ) &&
- ( str[ stringLength ] != '\0') )
- {
- PRINTF( "[ERROR] [NSC_Printf] String too long or not null terminated!\r\n" );
- isInvalidSting = 1;
- }
-
- if( isInvalidSting == 0 )
- {
- /* Check whether the string is located in non-secure memory. */
- if( cmse_check_address_range( ( void * ) str,
- stringLength,
- ( CMSE_NONSECURE | CMSE_MPU_READ ) ) == NULL )
- {
- PRINTF( "[ERROR] [NSC_Printf] String is not located in non-secure memory!\r\n" );
- isInvalidSting = 1;
- }
- }
-
- /* Print the string if it is a valid string. */
- if( isInvalidSting == 0 )
- {
- PRINTF( str );
- }
-}
-/*-----------------------------------------------------------*/
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/tzm_config.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/tzm_config.c
deleted file mode 100644
index d3a18c74d..000000000
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/tzm_config.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/***********************************************************************************************************************
- * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
- * will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
- **********************************************************************************************************************/
-
-/* clang-format off */
-/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
-!!GlobalInfo
-product: TEE v3.0
-processor: LPC55S69
-package_id: LPC55S69JBD100
-mcu_data: ksdk2_0
-processor_version: 0.10.1
- * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
-/* clang-format on */
-
-/***********************************************************************************************************************
- * Included files
- **********************************************************************************************************************/
-#include "fsl_common.h"
-#include "tzm_config.h"
-
-/***********************************************************************************************************************
- * Definitions
- **********************************************************************************************************************/
-/* SAU region boundaries */
-#define SAU_REGION_0_BASE 0
-#define SAU_REGION_0_END 0x0FFFFFFFU
-#define SAU_REGION_1_BASE 0x20000000U
-#define SAU_REGION_1_END 0xDFFFFFFFU
-#define SAU_REGION_2_BASE 0x1000FE00U
-#define SAU_REGION_2_END 0x1000FFFFU
-
-
-
-/* clang-format off */
-/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
-functional_group:
-- called_from_default_init: 'true'
-- id_prefix: ''
-- prefix_user_defined: 'true'
-- name: 'BOARD_InitTEE'
-- description: ''
-- ahb:
- - regions: [{memory: PROGRAM_FLASH, security: s_priv, start: '0x00000000', size: '0x00010000'}, {memory: PROGRAM_FLASH, security: ns_user, start: '0x00010000',
- size: '0x00090000'}, {memory: BootROM, security: ns_user, start: '0x00000000', size: '0x00020000'}, {memory: SRAMX, security: ns_user, start: '0x00000000',
- size: '0x00008000'}, {memory: SRAM0, security: s_priv, start: '0x00000000', size: '0x00008000'}, {memory: SRAM0, security: ns_user, start: '0x00008000', size: '0x00008000'},
- {memory: SRAM1, security: ns_user, start: '0x00000000', size: '0x00010000'}, {memory: SRAM2, security: ns_user, start: '0x00000000', size: '0x00010000'}, {memory: SRAM3,
- security: ns_user, start: '0x00000000', size: '0x00010000'}, {memory: SRAM4, security: ns_user, start: '0x00000000', size: '0x00004000'}, {memory: USB_RAM,
- security: ns_user, start: '0x00000000', size: '0x00004000'}]
- - masters: {ns_user: {id: [HASH, MCM33C, MCM33S, PQ, SDIO, SDMA0, SDMA1, USBFSD, USBFSH]}}
- - peripherals: {ns_user: {id: [ADC0, AHB_SECURE_CTRL, ANACTRL, CASPER, CRC_ENGINE, CTIMER0, CTIMER1, CTIMER2, CTIMER3, CTIMER4, DBGMAILBOX, DMA0, DMA1, FLASH,
- FLEXCOMM1, FLEXCOMM2, FLEXCOMM3, FLEXCOMM4, FLEXCOMM5, FLEXCOMM6, FLEXCOMM7, GINT0, GINT1, GPIO, HASHCRYPT, INPUTMUX, MAILBOX, MRT0, OSTIMER, PINT, PLU, PMC,
- POWERQUAD, PRINCE, PUF, RNG, RTC, SCT0, SDIF, SECGPIO, SECPINT, SPI8, SYSCTL, USB0, USBFSH, USBHSD, USBHSH, USBPHY, UTICK0, WWDT]}, s_priv: {id: [FLEXCOMM0,
- IOCON, SYSCON]}}
- - interrupts:
- - masking: {Non-masked: {id: [acmp_capt_irq, adc_irq, casper_irq, ctimer0_irq, ctimer1_irq, ctimer2_irq, ctimer3_irq, ctimer4_irq, flexcomm0_irq, flexcomm1_irq,
- flexcomm2_irq, flexcomm3_irq, flexcomm4_irq, flexcomm5_irq, flexcomm6_irq, flexcomm7_irq, global_irq0, global_irq1, lspi_hs_irq, mailbox_irq, mrt_irq, os_event_irq,
- pin_int4, pin_int5, pin_int6, pin_int7, pin_irq0, pin_irq1, pin_irq2, pin_irq3, plu_irq, pq_irq, qddkey_irq, rtc_irq, sct_irq, sdio_irq, sdma0_irq, sdma1_irq,
- sec_hypervisor_call_irq, sec_int0, sec_int1, sec_vio_irq, sha_irq, sys_irq, usb0_irq, usb0_needclk_irq, usb1_irq, usb1_needclk_irq, usb1_utmi_irq, utick_irq]}}
- - security: {Secure: {id: [acmp_capt_irq, adc_irq, casper_irq, ctimer0_irq, ctimer1_irq, ctimer2_irq, ctimer3_irq, ctimer4_irq, flexcomm0_irq, flexcomm1_irq,
- flexcomm2_irq, flexcomm3_irq, flexcomm4_irq, flexcomm5_irq, flexcomm6_irq, flexcomm7_irq, global_irq0, global_irq1, lspi_hs_irq, mailbox_irq, mrt_irq, os_event_irq,
- pin_int4, pin_int5, pin_int6, pin_int7, pin_irq0, pin_irq1, pin_irq2, pin_irq3, plu_irq, pq_irq, qddkey_irq, rtc_irq, sct_irq, sdio_irq, sdma0_irq, sdma1_irq,
- sec_hypervisor_call_irq, sec_int0, sec_int1, sec_vio_irq, sha_irq, sys_irq, usb0_irq, usb0_needclk_irq, usb1_irq, usb1_needclk_irq, usb1_utmi_irq, utick_irq]}}
- - pins_masks:
- - pio0: {Non-masked: {id: ['0', '1', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '2', '20', '21', '22', '23', '24', '25', '26', '27', '28',
- '3', '31', '4', '5', '6', '7', '8', '9']}, Masked: {id: ['29', '30']}}
- - pio1: {Non-masked: {id: ['0', '1', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '2', '20', '21', '22', '23', '24', '25', '26', '27', '28',
- '29', '3', '30', '31', '4', '5', '6', '7', '8', '9']}}
-- sau:
- - enabled: 'true'
- - all_non_secure: 'false'
- - generate_code_for_disabled_regions: 'false'
- - regions: [{index: '0', enabled: 'true', security: ns, start: '0x00000000', size: '0x10000000'}, {index: '1', enabled: 'true', security: ns, start: '0x20000000',
- size: '0xC0000000'}, {index: '2', enabled: 'true', security: nsc, start: '0x1000FE00', size: '0x00000200'}, {index: '3', enabled: 'false', security: ns, start: '0x00000000',
- size: '0x00000020'}, {index: '4', enabled: 'false', security: ns, start: '0x00000000', size: '0x00000020'}, {index: '5', enabled: 'false', security: ns, start: '0x00000000',
- size: '0x00000020'}, {index: '6', enabled: 'false', security: ns, start: '0x00000000', size: '0x00000020'}, {index: '7', enabled: 'false', security: ns, start: '0x00000000',
- size: '0x00000020'}]
-- global_options:
- - no:
- - id: [AIRCR_PRIS, AIRCR_BFHFNMINS, AIRCR_SYSRESETREQS, SCR_SLEEPDEEPS, SHCSR_SECUREFAULTENA, NSACR_CP2, NSACR_CP3, NSACR_CP4, NSACR_CP5, NSACR_CP6, NSACR_CP7,
- CPPWR_SU0, CPPWR_SUS0, CPPWR_SU1, CPPWR_SUS1, CPPWR_SU2, CPPWR_SUS2, CPPWR_SU3, CPPWR_SUS3, CPPWR_SU4, CPPWR_SUS4, CPPWR_SU5, CPPWR_SUS5, CPPWR_SU6, CPPWR_SUS6,
- CPPWR_SU7, CPPWR_SUS7, CPPWR_SU10, CPPWR_SUS10, CPPWR_SU11, CPPWR_SUS11, SEC_GPIO_MASK0_LOCK, SEC_GPIO_MASK1_LOCK, SEC_CPU1_INT_MASK0_LOCK, SEC_CPU1_INT_MASK1_LOCK,
- MASTER_SEC_LEVEL_LOCK, CPU0_LOCK_NS_VTOR, CPU0_LOCK_NS_MPU, CPU0_LOCK_S_VTAIRCR, CPU0_LOCK_S_MPU, CPU0_LOCK_SAU, CPU0_LOCK_REG_LOCK, CPU1_LOCK_NS_VTOR, CPU1_LOCK_NS_MPU,
- CPU1_LOCK_REG_LOCK, AHB_MISC_CTRL_REG_ENABLE_S_PRIV_CHECK, AHB_MISC_CTRL_REG_ENABLE_NS_PRIV_CHECK, AHB_MISC_CTRL_REG_DISABLE_VIOLATION_ABORT, AHB_MISC_CTRL_REG_DISABLE_SIMPLE_MASTER_STRICT_MODE,
- AHB_MISC_CTRL_REG_DISABLE_SMART_MASTER_STRICT_MODE, AHB_MISC_CTRL_REG_IDAU_ALL_NS]
- - yes:
- - id: [NSACR_CP0, NSACR_CP1, NSACR_CP10, NSACR_CP11, AHB_MISC_CTRL_REG_ENABLE_SECURE_CHECKING, AHB_MISC_CTRL_REG_WRITE_LOCK, _legacy_source_names_]
- - c_code:
- - id: [_output_type_]
-- user_memory_regions: [{id: Region_1, security: s_priv, name: Secure Code, start: '0x10000000', size: '0x0000FE00'}, {id: Region_2, security: nsc_priv, name: Veneer
- Table, start: '0x1000FE00', size: '0x00000200'}, {id: Region_3, security: s_priv, name: Secure Stack and Data, start: '0x30000000', size: '0x00008000'}, {id: Region_4,
- security: ns_user, name: Non-secure Code, description: Privilege check is disabled so reset value (NS-User) can be used, start: '0x00010000', size: '0x00068000'},
- {id: Region_5, security: ns_user, name: Non-secure Stack and Data, description: 'Privilege check is disabled so reset value (NS-User) can be used. ', start: '0x20008000',
- size: '0x0002B000'}]
-- mpus:
- - mpu:
- - enabled: 'false'
- - id: 's'
- - priv_default_map: 'false'
- - handler_enabled: 'false'
- - generate_code_for_disabled_regions: 'false'
- - attributes: [{index: '0', id: '0', memory_type: device, device: nGnRE}, {index: '1', id: '1', memory_type: device, device: nGnRE}, {index: '2', id: '2', memory_type: device,
- device: nGnRE}, {index: '3', id: '3', memory_type: device, device: nGnRE}, {index: '4', id: '4', memory_type: device, device: nGnRE}, {index: '5', id: '5',
- memory_type: device, device: nGnRE}, {index: '6', id: '6', memory_type: device, device: nGnRE}, {index: '7', id: '7', memory_type: device, device: nGnRE}]
- - regions: [{executable: 'false', read_only: 'false', attributes_index: '0', index: '0', enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'},
- {executable: 'false', read_only: 'false', attributes_index: '0', index: '1', enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false',
- read_only: 'false', attributes_index: '0', index: '2', enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false', read_only: 'false',
- attributes_index: '0', index: '3', enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false', read_only: 'false', attributes_index: '0',
- index: '4', enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false', read_only: 'false', attributes_index: '0', index: '5',
- enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false', read_only: 'false', attributes_index: '0', index: '6', enabled: 'false',
- security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false', read_only: 'false', attributes_index: '0', index: '7', enabled: 'false', security: priv,
- start: '0x00000000', size: '0x00000020'}]
- - mpu:
- - enabled: 'false'
- - id: 'ns'
- - priv_default_map: 'false'
- - handler_enabled: 'false'
- - generate_code_for_disabled_regions: 'false'
- - attributes: [{index: '0', id: '0', memory_type: device, device: nGnRE}, {index: '1', id: '1', memory_type: device, device: nGnRE}, {index: '2', id: '2', memory_type: device,
- device: nGnRE}, {index: '3', id: '3', memory_type: device, device: nGnRE}, {index: '4', id: '4', memory_type: device, device: nGnRE}, {index: '5', id: '5',
- memory_type: device, device: nGnRE}, {index: '6', id: '6', memory_type: device, device: nGnRE}, {index: '7', id: '7', memory_type: device, device: nGnRE}]
- - regions: [{executable: 'false', read_only: 'false', attributes_index: '0', index: '0', enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'},
- {executable: 'false', read_only: 'false', attributes_index: '0', index: '1', enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false',
- read_only: 'false', attributes_index: '0', index: '2', enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false', read_only: 'false',
- attributes_index: '0', index: '3', enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false', read_only: 'false', attributes_index: '0',
- index: '4', enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false', read_only: 'false', attributes_index: '0', index: '5',
- enabled: 'false', security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false', read_only: 'false', attributes_index: '0', index: '6', enabled: 'false',
- security: priv, start: '0x00000000', size: '0x00000020'}, {executable: 'false', read_only: 'false', attributes_index: '0', index: '7', enabled: 'false', security: priv,
- start: '0x00000000', size: '0x00000020'}]
- * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
-/* clang-format on */
-
-/***********************************************************************************************************************
- * BOARD_InitTrustZone function
- **********************************************************************************************************************/
-void BOARD_InitTrustZone()
-{
- /* SAU configuration */
-
- /* Set SAU Control register: Disable SAU and All Secure */
- SAU->CTRL = 0;
-
- /* Set SAU region number */
- SAU->RNR = 0;
- /* Region base address */
- SAU->RBAR = SAU_REGION_0_BASE & SAU_RBAR_BADDR_Msk;
- /* Region end address */
- SAU->RLAR = (SAU_REGION_0_END & SAU_RLAR_LADDR_Msk)
- | ((0U << SAU_RLAR_NSC_Pos) & SAU_RLAR_NSC_Msk)
- | ((1U << SAU_RLAR_ENABLE_Pos) & SAU_RLAR_ENABLE_Msk);
-
- /* Set SAU region number */
- SAU->RNR = 1;
- /* Region base address */
- SAU->RBAR = SAU_REGION_1_BASE & SAU_RBAR_BADDR_Msk;
- /* Region end address */
- SAU->RLAR = (SAU_REGION_1_END & SAU_RLAR_LADDR_Msk)
- | ((0U << SAU_RLAR_NSC_Pos) & SAU_RLAR_NSC_Msk)
- | ((1U << SAU_RLAR_ENABLE_Pos) & SAU_RLAR_ENABLE_Msk);
-
- /* Set SAU region number */
- SAU->RNR = 2;
- /* Region base address */
- SAU->RBAR = SAU_REGION_2_BASE & SAU_RBAR_BADDR_Msk;
- /* Region end address */
- SAU->RLAR = (SAU_REGION_2_END & SAU_RLAR_LADDR_Msk)
- | ((1U << SAU_RLAR_NSC_Pos) & SAU_RLAR_NSC_Msk)
- | ((1U << SAU_RLAR_ENABLE_Pos) & SAU_RLAR_ENABLE_Msk);
-
- /* Force memory writes before continuing */
- __DSB();
- /* Flush and refill pipeline with updated permissions */
- __ISB();
-
- /* Set SAU Control register: Enable SAU and All Secure (applied only if disabled) */
- SAU->CTRL = ((0U << SAU_CTRL_ALLNS_Pos) & SAU_CTRL_ALLNS_Msk)
- | ((1U << SAU_CTRL_ENABLE_Pos) & SAU_CTRL_ENABLE_Msk);
-
- /* AHB configuration */
-
- /*--------------------------------------------------------------------
- - AHB Security Level Configurations
- -------------------------------------------------------------------*/
- /* Configuration of AHB Secure Controller
- Possible values for every memory sector or peripheral rule:
- 0 Non-secure, User access allowed.
- 1 Non-secure, Privileged access allowed.
- 2 Secure, User access allowed.
- 3 Secure, Privileged access allowed.
- */
-
- /* Security level configuration of MPC checker */
- AHB_SECURE_CTRL->SEC_CTRL_FLASH_ROM[0].SEC_CTRL_FLASH_MEM_RULE[0] = 0x00000033U;
- AHB_SECURE_CTRL->SEC_CTRL_FLASH_ROM[0].SEC_CTRL_FLASH_MEM_RULE[1] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_FLASH_ROM[0].SEC_CTRL_FLASH_MEM_RULE[2] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_FLASH_ROM[0].SEC_CTRL_ROM_MEM_RULE[0] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_FLASH_ROM[0].SEC_CTRL_ROM_MEM_RULE[1] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_FLASH_ROM[0].SEC_CTRL_ROM_MEM_RULE[2] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_FLASH_ROM[0].SEC_CTRL_ROM_MEM_RULE[3] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_RAMX[0].MEM_RULE[0] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_RAM0[0].MEM_RULE[0] = 0x33333333U;
- AHB_SECURE_CTRL->SEC_CTRL_RAM0[0].MEM_RULE[1] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_RAM1[0].MEM_RULE[0] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_RAM1[0].MEM_RULE[1] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_RAM2[0].MEM_RULE[0] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_RAM2[0].MEM_RULE[1] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_RAM3[0].MEM_RULE[0] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_RAM3[0].MEM_RULE[1] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_RAM4[0].MEM_RULE[0] = 0;
- AHB_SECURE_CTRL->SEC_CTRL_USB_HS[0].MEM_RULE[0] = 0;
-
- /* Security level configuration of PPC checker */
- AHB_SECURE_CTRL->SEC_CTRL_APB_BRIDGE[0].SEC_CTRL_APB_BRIDGE0_MEM_CTRL0 = 0xFCCCCCFFU;
- AHB_SECURE_CTRL->SEC_CTRL_APB_BRIDGE[0].SEC_CTRL_APB_BRIDGE0_MEM_CTRL1 = 0xFCCCFFCCU;
- AHB_SECURE_CTRL->SEC_CTRL_APB_BRIDGE[0].SEC_CTRL_APB_BRIDGE0_MEM_CTRL2 = 0xFFFFCFFFU;
- AHB_SECURE_CTRL->SEC_CTRL_APB_BRIDGE[0].SEC_CTRL_APB_BRIDGE1_MEM_CTRL0 = 0xFFFFCFFCU;
- AHB_SECURE_CTRL->SEC_CTRL_APB_BRIDGE[0].SEC_CTRL_APB_BRIDGE1_MEM_CTRL1 = 0xFFCCFCCCU;
- AHB_SECURE_CTRL->SEC_CTRL_APB_BRIDGE[0].SEC_CTRL_APB_BRIDGE1_MEM_CTRL2 = 0xFFCCFFFFU;
- AHB_SECURE_CTRL->SEC_CTRL_APB_BRIDGE[0].SEC_CTRL_APB_BRIDGE1_MEM_CTRL3 = 0xFFCFCCFCU;
- AHB_SECURE_CTRL->SEC_CTRL_AHB_PORT8_SLAVE0_RULE = 0xCFCCFCFFU;
- AHB_SECURE_CTRL->SEC_CTRL_AHB_PORT8_SLAVE1_RULE = 0xFFFCCCCCU;
- AHB_SECURE_CTRL->SEC_CTRL_AHB_PORT9_SLAVE0_RULE = 0xCCCCFFFFU;
- AHB_SECURE_CTRL->SEC_CTRL_AHB_PORT9_SLAVE1_RULE = 0xCFFCCFFCU;
- AHB_SECURE_CTRL->SEC_CTRL_AHB_PORT10[0].SLAVE0_RULE = 0xCCCCCCFCU;
- AHB_SECURE_CTRL->SEC_CTRL_AHB_PORT10[0].SLAVE1_RULE = 0xFFFFFFCCU;
-
- /* Security level configuration of masters */
- AHB_SECURE_CTRL->MASTER_SEC_LEVEL = 0x80000000U;
- AHB_SECURE_CTRL->MASTER_SEC_ANTI_POL_REG = 0xBFFFFFFFU;
-
- /*--------------------------------------------------------------------
- - Pins: Reading GPIO state
- -------------------------------------------------------------------*/
- /* Possible values for every pin:
- * 0b0 Deny
- * 0b1 Allow */
- AHB_SECURE_CTRL->SEC_GPIO_MASK0 = 0x9FFFFFFFU;
- AHB_SECURE_CTRL->SEC_GPIO_MASK1 = 0xFFFFFFFFU;
-
- /*--------------------------------------------------------------------
- - Interrupts: Interrupt handling by Core1
- -------------------------------------------------------------------*/
- /* Possible values for every interrupt:
- * 0b0 Deny
- * 0b1 Allow */
- AHB_SECURE_CTRL->SEC_CPU_INT_MASK0 = 0xFFFFFFFFU;
- AHB_SECURE_CTRL->SEC_CPU_INT_MASK1 = 0xFFFFFFFFU;
-
- /*--------------------------------------------------------------------
- - Interrupts: Interrupt security configuration
- -------------------------------------------------------------------*/
- /* Possible values for every interrupt:
- * 0b0 Secure
- * 0b1 Non-secure */
- NVIC->ITNS[0] = 0;
- NVIC->ITNS[1] = 0;
-
- /* Global Options */
- SCB->AIRCR = (SCB->AIRCR & 0x000009FF7U) | 0x005FA0000U;
- SCB->SCR &= 0x0FFFFFFF7U;
- SCB->SHCSR &= 0x0FFF7FFFFU;
- SCB->NSACR = 0x00000C03U;
- SCnSCB->CPPWR = 0;
- AHB_SECURE_CTRL->SEC_MASK_LOCK = 0x00000AAAU;
- AHB_SECURE_CTRL->MASTER_SEC_LEVEL = (AHB_SECURE_CTRL->MASTER_SEC_LEVEL & 0x03FFFFFFFU) | 0x080000000U;
- AHB_SECURE_CTRL->MASTER_SEC_ANTI_POL_REG = (AHB_SECURE_CTRL->MASTER_SEC_ANTI_POL_REG & 0x03FFFFFFFU) | 0x080000000U;
- AHB_SECURE_CTRL->CPU0_LOCK_REG = 0x800002AAU;
- AHB_SECURE_CTRL->CPU1_LOCK_REG = 0x8000000AU;
- AHB_SECURE_CTRL->MISC_CTRL_REG = (AHB_SECURE_CTRL->MISC_CTRL_REG & 0x0FFFF0003U) | 0x00000AAA4U;
- AHB_SECURE_CTRL->MISC_CTRL_DP_REG = 0x0000AAA5U;
-}
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/tzm_config.h b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/tzm_config.h
deleted file mode 100644
index 8b48f7799..000000000
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/Secure/tzm_config.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _TZM_CONFIG_H_
-#define _TZM_CONFIG_H_
-
-#if defined(__cplusplus)
-extern "C" {
-#endif /* __cplusplus */
-
-
-/***********************************************************************************************************************
- * Initialize TrustZone
- **********************************************************************************************************************/
-void BOARD_InitTrustZone(void);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* _TZM_CONFIG_H_ */