]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/main_s.c
First Official Release of ARMV8M Support. This release removes Pre-Release from all...
[freertos] / FreeRTOS / Demo / CORTEX_MPU_M33F_Simulator_Keil_GCC / Secure / main_s.c
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/main_s.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/main_s.c
new file mode 100644 (file)
index 0000000..0d7600a
--- /dev/null
@@ -0,0 +1,79 @@
+/*\r
+ * FreeRTOS Kernel V10.2.0\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\r
+ */\r
+\r
+/* Use CMSE intrinsics */\r
+#include <arm_cmse.h>\r
+#include "RTE_Components.h"\r
+#include CMSIS_device_header\r
+\r
+/* FreeRTOS includes. */\r
+#include "secure_port_macros.h"\r
+\r
+/* Start address of non-secure application. */\r
+#define mainNONSECURE_APP_START_ADDRESS     ( 0x200000U )\r
+\r
+/* typedef for non-secure Reset Handler. */\r
+typedef void ( *NonSecureResetHandler_t )   ( void ) __attribute__( ( cmse_nonsecure_call ) );\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Boot into the non-secure code. */\r
+void BootNonSecure( uint32_t ulNonSecureStartAddress );\r
+/*-----------------------------------------------------------*/\r
+\r
+void BootNonSecure( uint32_t ulNonSecureStartAddress )\r
+{\r
+    NonSecureResetHandler_t pxNonSecureResetHandler;\r
+\r
+    /* Main Stack Pointer value for the non-secure side is the first entry in\r
+     * the non-secure vector table. Read the first entry and assign the same to\r
+     * the non-secure main stack pointer(MSP_NS). */\r
+    secureportSET_MSP_NS( *( ( uint32_t * )( ulNonSecureStartAddress ) ) );\r
+\r
+    /* Non secure Reset Handler is the second entry in the non-secure vector\r
+     * table. Read the non-secure reset handler.\r
+     */\r
+    pxNonSecureResetHandler = ( NonSecureResetHandler_t )( * ( ( uint32_t * ) ( ( ulNonSecureStartAddress ) + 4U ) ) );\r
+\r
+    /* Start non-secure software application by jumping to the non-secure Reset\r
+     * Handler. */\r
+    pxNonSecureResetHandler();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Secure main() */\r
+int main( void )\r
+{\r
+    /* Boot the non-secure code. */\r
+    BootNonSecure( mainNONSECURE_APP_START_ADDRESS );\r
+\r
+    /* Non-secure software does not return, this code is not executed. */\r
+    for( ; ; )\r
+    {\r
+        /* Should not reach here. */\r
+    }\r
+}\r
+/*-----------------------------------------------------------*/\r