summaryrefslogtreecommitdiff
path: root/Core/Template/ARMv8-M/main_s.c
diff options
context:
space:
mode:
authorAli Labbene <ali.labbene@st.com>2019-12-11 08:59:21 +0100
committerAli Labbene <ali.labbene@st.com>2019-12-16 16:35:24 +0100
commit9f95ff5b6ba01db09552b84a0ab79607060a2666 (patch)
tree8a6e0dda832555c692307869aed49d07ee7facfe /Core/Template/ARMv8-M/main_s.c
parent76177aa280494bb36d7a0bcbda1078d4db717020 (diff)
downloadst-cmsis-core-lowfat-9f95ff5b6ba01db09552b84a0ab79607060a2666.tar.gz
st-cmsis-core-lowfat-9f95ff5b6ba01db09552b84a0ab79607060a2666.tar.bz2
st-cmsis-core-lowfat-9f95ff5b6ba01db09552b84a0ab79607060a2666.zip
Official ARM version: v5.4.0
Add CMSIS V5.4.0, please refer to index.html available under \docs folder. Note: content of \CMSIS\Core\Include has been copied under \Include to keep the same structure used in existing projects, and thus avoid projects mass update Note: the following components have been removed from ARM original delivery (as not used in ST packages) - CMSIS_EW2018.pdf - .gitattributes - .gitignore - \Device - \CMSIS - \CoreValidation - \DAP - \Documentation - \DoxyGen - \Driver - \Pack - \RTOS\CMSIS_RTOS_Tutorial.pdf - \RTOS\RTX - \RTOS\Template - \RTOS2\RTX - \Utilities - All ARM/GCC projects files are deleted from \DSP, \RTOS and \RTOS2 Change-Id: Ia026c3f0f0d016627a4fb5a9032852c33d24b4d3
Diffstat (limited to 'Core/Template/ARMv8-M/main_s.c')
-rw-r--r--Core/Template/ARMv8-M/main_s.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/Core/Template/ARMv8-M/main_s.c b/Core/Template/ARMv8-M/main_s.c
new file mode 100644
index 0000000..273607b
--- /dev/null
+++ b/Core/Template/ARMv8-M/main_s.c
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * @file main_s.c
+ * @brief Code template for secure main function
+ * @version V1.1.1
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2013-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* Use CMSE intrinsics */
+#include <arm_cmse.h>
+
+#include "RTE_Components.h"
+#include CMSIS_device_header
+
+/* TZ_START_NS: Start address of non-secure application */
+#ifndef TZ_START_NS
+#define TZ_START_NS (0x200000U)
+#endif
+
+/* typedef for non-secure callback functions */
+typedef void (*funcptr_void) (void) __attribute__((cmse_nonsecure_call));
+
+/* Secure main() */
+int main(void) {
+ funcptr_void NonSecure_ResetHandler;
+
+ /* Add user setup code for secure part here*/
+
+ /* Set non-secure main stack (MSP_NS) */
+ __TZ_set_MSP_NS(*((uint32_t *)(TZ_START_NS)));
+
+ /* Get non-secure reset handler */
+ NonSecure_ResetHandler = (funcptr_void)(*((uint32_t *)((TZ_START_NS) + 4U)));
+
+ /* Start non-secure state software application */
+ NonSecure_ResetHandler();
+
+ /* Non-secure software does not return, this code is not executed */
+ while (1) {
+ __NOP();
+ }
+}