Added main function template for ARMv8-M devices.
diff --git a/ARM.CMSIS.pdsc b/ARM.CMSIS.pdsc
index 239d07a..9515fdb 100644
--- a/ARM.CMSIS.pdsc
+++ b/ARM.CMSIS.pdsc
@@ -572,6 +572,12 @@
       <accept Dcore="ARMV8MML"/>
     </condition>
 
+    <condition id="ARMv8-M Device">
+      <description>ARMv8-M architecture based device: ARMv8MBL, ARMv8MML</description>
+      <accept Dcore="ARMV8MBL"/>
+      <accept Dcore="ARMV8MML"/>
+    </condition>
+
     <condition id="Cortex-M Device CMSIS Core">
       <description>ARM Cortex-M device that depends on CMSIS Core component</description>
       <require condition="Cortex-M Device"/>
@@ -1150,6 +1156,8 @@
         <!-- CPU independent -->
         <file category="doc"     name="CMSIS/Documentation/Core/html/index.html"/>
         <file category="include" name="CMSIS/Include/"/>
+        <!-- Code template -->
+        <file category="sourceC" attr="template" name="CMSIS/Core/Template/ARMv8-M/main_s.c" select="CMSIS-Core 'main' function for ARMv8-M" condition="ARMv8-M Device"/>
       </files>
     </component>
 
diff --git a/CMSIS/Core/Template/ARMv8-M/main_s.c b/CMSIS/Core/Template/ARMv8-M/main_s.c
new file mode 100644
index 0000000..9dbf694
--- /dev/null
+++ b/CMSIS/Core/Template/ARMv8-M/main_s.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2013-2016 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
+ *
+ * http://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.
+ *
+ * ----------------------------------------------------------------------
+ *
+ * main_s.c      Code template for secure main function 
+ *
+ * Version 1.0
+ *    Initial Release
+ *---------------------------------------------------------------------------*/
+
+/* Use CMSE intrinsics */
+#include <arm_cmse.h>
+
+/* TZ_START_NS: Start address of non-secure application */
+#if !(defined (TZ_START__NS))
+  #define TZ_START_NS  (0x200000U)
+#endif
+
+/* Generate BLXNS instruction */
+void NonSecure_Start (uint32_t addr);
+
+void NonSecure_Start (uint32_t addr) {
+  __ASM volatile ("MOV r0, %0\n\t"
+                  "BLXNS   r0\n\t" : : "r" (addr));
+}
+
+/* main function does not take arguments */
+#if !defined(__MICROLIB) && defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+__asm(" .global __ARM_use_no_argv\n");
+#endif
+
+/* Secure main() */
+int main(void) {
+  volatile uint32_t 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)));
+ 
+  /* Set non-secure main stack (MSP_NS) */
+  NonSecure_ResetHandler = cmse_nsfptr_create(*((uint32_t *)((TZ_START_NS) + 4u)));
+ 
+  /* Start non-secure state software application */
+  NonSecure_Start(NonSecure_ResetHandler);
+ 
+  /* Non-secure software does not return, this code is not executed */
+  while (1) {
+    __NOP( ) ;
+  }
+}
diff --git a/CMSIS/Utilities/gen_pack.bat b/CMSIS/Utilities/gen_pack.bat
index 38898a8..ce05416 100644
--- a/CMSIS/Utilities/gen_pack.bat
+++ b/CMSIS/Utilities/gen_pack.bat
@@ -48,6 +48,7 @@
 :: Copy CMSIS folder 
 :: -- Core files 
 XCOPY /Q /S /Y ..\..\CMSIS\Core\Include\*.* %RELEASE_PATH%\CMSIS\Include\*.*
+XCOPY /Q /S /Y ..\..\CMSIS\Core\Template\ARMv8-M\*.* %RELEASE_PATH%\CMSIS\Core\Template\ARMv8-M\*.*
 
 :: -- DAP files 
 XCOPY /Q /S /Y ..\..\CMSIS\DAP\*.* %RELEASE_PATH%\CMSIS\DAP\*.*