]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/IAR/NonSecure/main_ns.c
Delete the Release configuration from the NXP project.
[freertos] / FreeRTOS / Demo / CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC / Projects / IAR / NonSecure / main_ns.c
1 /*\r
2  * FreeRTOS Kernel V10.2.0\r
3  * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software.\r
14  *\r
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21  *\r
22  * http://www.FreeRTOS.org\r
23  * http://aws.amazon.com/freertos\r
24  *\r
25  * 1 tab == 4 spaces!\r
26  */\r
27 \r
28 /* Device includes. */\r
29 #include <arm_cmse.h>\r
30 #include "NuMicro.h"\r
31 \r
32 /* FreeRTOS includes. */\r
33 #include "FreeRTOS.h"\r
34 #include "task.h"\r
35 \r
36 /* Demo includes. */\r
37 #include "tz_demo.h"\r
38 #include "mpu_demo.h"\r
39 \r
40 /**\r
41  * @brief Create all demo tasks.\r
42  */\r
43 static void prvCreateTasks( void );\r
44 /*-----------------------------------------------------------*/\r
45 \r
46 /* For instructions on how to build and run this demo, visit the following link:\r
47  * https://www.freertos.org/RTOS-Cortex-M23-NuMaker-PFM-M2351-Keil.html\r
48  */\r
49 \r
50 /* Non-Secure main. */\r
51 int main( void )\r
52 {\r
53         /* Initialize debug port. */\r
54         DEBUG_PORT->BAUD = UART_BAUD_MODE2 | UART_BAUD_MODE2_DIVIDER( __HIRC, 115200 );\r
55         DEBUG_PORT->LINE = UART_WORD_LEN_8 | UART_PARITY_NONE | UART_STOP_BIT_1;\r
56 \r
57         /* Print banner. */\r
58         printf( "\n" );\r
59         printf( "+---------------------------------------------+\n" );\r
60         printf( "|           Nonsecure is running ...          |\n" );\r
61         printf( "+---------------------------------------------+\n" );\r
62 \r
63         /* Create tasks. */\r
64         prvCreateTasks();\r
65 \r
66         /* Start scheduler. */\r
67         vTaskStartScheduler();\r
68 \r
69         /* Should not reach here as the schedular is already started. */\r
70         for( ; ; )\r
71         {\r
72         }\r
73 }\r
74 /*-----------------------------------------------------------*/\r
75 \r
76 static void prvCreateTasks( void )\r
77 {\r
78         /* Create tasks for the MPU Demo. */\r
79         vStartMPUDemo();\r
80 \r
81         /* Create tasks for the TZ Demo. */\r
82         vStartTZDemo();\r
83 \r
84 }\r
85 /*-----------------------------------------------------------*/\r
86 \r
87 /* Stack overflow hook. */\r
88 void vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName )\r
89 {\r
90         /* Force an assert. */\r
91         configASSERT( pcTaskName == 0 );\r
92 }\r
93 /*-----------------------------------------------------------*/\r
94 \r
95 /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
96  * implementation of vApplicationGetIdleTaskMemory() to provide the memory that\r
97  * is used by the Idle task. */\r
98 void vApplicationGetIdleTaskMemory(     StaticTask_t ** ppxIdleTaskTCBBuffer,\r
99                                                                         StackType_t ** ppxIdleTaskStackBuffer,\r
100                                                                         uint32_t * pulIdleTaskStackSize )\r
101 {\r
102         /* If the buffers to be provided to the Idle task are declared inside this\r
103          * function then they must be declared static - otherwise they will be\r
104          * allocated on the stack and so not exists after this function exits. */\r
105         static StaticTask_t xIdleTaskTCB;\r
106         static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ] __attribute__( ( aligned( 32 ) ) );\r
107 \r
108         /* Pass out a pointer to the StaticTask_t structure in which the Idle\r
109          * task's state will be stored. */\r
110         *ppxIdleTaskTCBBuffer = &xIdleTaskTCB;\r
111 \r
112         /* Pass out the array that will be used as the Idle task's stack. */\r
113         *ppxIdleTaskStackBuffer = uxIdleTaskStack;\r
114 \r
115         /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.\r
116          * Note that, as the array is necessarily of type StackType_t,\r
117          * configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
118         *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
119 }\r
120 /*-----------------------------------------------------------*/\r
121 \r
122 /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the\r
123  * application must provide an implementation of vApplicationGetTimerTaskMemory()\r
124  * to provide the memory that is used by the Timer service task. */\r
125 void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,\r
126                                                                          StackType_t ** ppxTimerTaskStackBuffer,\r
127                                                                          uint32_t * pulTimerTaskStackSize )\r
128 {\r
129         /* If the buffers to be provided to the Timer task are declared inside this\r
130          * function then they must be declared static - otherwise they will be\r
131          * allocated on the stack and so not exists after this function exits. */\r
132         static StaticTask_t xTimerTaskTCB;\r
133         static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ] __attribute__( ( aligned( 32 ) ) );\r
134 \r
135         /* Pass out a pointer to the StaticTask_t structure in which the Timer\r
136          * task's state will be stored. */\r
137         *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;\r
138 \r
139         /* Pass out the array that will be used as the Timer task's stack. */\r
140         *ppxTimerTaskStackBuffer = uxTimerTaskStack;\r
141 \r
142         /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.\r
143          * Note that, as the array is necessarily of type StackType_t,\r
144          * configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. */\r
145         *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
146 }\r
147 /*-----------------------------------------------------------*/\r