1 /******************************************************************************
3 * @brief Code template for secure main function
5 * @date 10. January 2018
6 ******************************************************************************/
8 * Copyright (c) 2013-2018 Arm Limited. All rights reserved.
10 * SPDX-License-Identifier: Apache-2.0
12 * Licensed under the Apache License, Version 2.0 (the License); you may
13 * not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
16 * www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
25 /* Use CMSE intrinsics */
28 #include "RTE_Components.h"
29 #include CMSIS_device_header
31 /* TZ_START_NS: Start address of non-secure application */
33 #define TZ_START_NS (0x200000U)
36 /* typedef for non-secure callback functions */
37 typedef void (*funcptr_void) (void) __attribute__((cmse_nonsecure_call));
41 funcptr_void NonSecure_ResetHandler;
43 /* Add user setup code for secure part here*/
45 /* Set non-secure main stack (MSP_NS) */
46 __TZ_set_MSP_NS(*((uint32_t *)(TZ_START_NS)));
48 /* Get non-secure reset handler */
49 NonSecure_ResetHandler = (funcptr_void)(*((uint32_t *)((TZ_START_NS) + 4U)));
51 /* Start non-secure state software application */
52 NonSecure_ResetHandler();
54 /* Non-secure software does not return, this code is not executed */