text: /**************************************************************************//**
   * @file     startup_ARMv8MML_sct.c
   * @brief    CMSIS Core Device Startup File for
   *           ARMv8MML Device
   * @version  V5.3.1
   * @date     09. July 2018
   ******************************************************************************/
  /*
   * Copyright (c) 2009-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.
   */
  
  #if defined (ARMv8MML)
    #include "ARMv8MML.h"
  #elif defined (ARMv8MML_DSP)
    #include "ARMv8MML_DSP.h"
  #elif defined (ARMv8MML_SP)
    #include "ARMv8MML_SP.h"
  #elif defined (ARMv8MML_DSP_SP)
    #include "ARMv8MML_DSP_SP.h"
  #elif defined (ARMv8MML_DP)
    #include "ARMv8MML_DP.h"
  #elif defined (ARMv8MML_DSP_DP)
    #include "ARMv8MML_DSP_DP.h"
  #else
    #error device not specified!
  #endif
  
  
  /*----------------------------------------------------------------------------
    Linker generated Symbols
   *----------------------------------------------------------------------------*/
  extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Limit;
  extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base;
  
  /*----------------------------------------------------------------------------
    Exception / Interrupt Handler Function Prototype
   *----------------------------------------------------------------------------*/
  typedef void( *pFunc )( void );
  
  
  /*----------------------------------------------------------------------------
    External References
   *----------------------------------------------------------------------------*/
  extern void __main     (void) __attribute__((noreturn)); /* PreeMain (C library entry point) */
  
  
  /*----------------------------------------------------------------------------
    Internal References
   *----------------------------------------------------------------------------*/
  void Default_Handler(void) __attribute__ ((noreturn));
  void Reset_Handler  (void) __attribute__ ((noreturn));
  
  
  /*----------------------------------------------------------------------------
    User Initial Stack & Heap
   *----------------------------------------------------------------------------*/
  #define __initial_sp    Image$$ARM_LIB_STACK$$ZI$$Limit
  #define __stack_limit   Image$$ARM_LIB_STACK$$ZI$$Base
  
  /*----------------------------------------------------------------------------
    Exception / Interrupt Handler
   *----------------------------------------------------------------------------*/
  /* Exceptions */
  void NMI_Handler            (void) __attribute__ ((weak, alias("Default_Handler")));
  void HardFault_Handler      (void) __attribute__ ((weak, alias("Default_Handler")));
  void MemManage_Handler      (void) __attribute__ ((weak, alias("Default_Handler")));
  void BusFault_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
  void UsageFault_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
  void SecureFault_Handler    (void) __attribute__ ((weak, alias("Default_Handler")));
  void SVC_Handler            (void) __attribute__ ((weak, alias("Default_Handler")));
  void DebugMon_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
  void PendSV_Handler         (void) __attribute__ ((weak, alias("Default_Handler")));
  void SysTick_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
  
  void Interrupt0_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
  void Interrupt1_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
  void Interrupt2_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
  void Interrupt3_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
  void Interrupt4_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
  void Interrupt5_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
  void Interrupt6_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
  void Interrupt7_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
  void Interrupt8_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
  void Interrupt9_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
  
  
  /*----------------------------------------------------------------------------
    Exception / Interrupt Vector table
   *----------------------------------------------------------------------------*/
  extern const pFunc __Vectors[496];
         const pFunc __Vectors[496] __attribute__((used, section("RESET"))) = {
    (pFunc)(&__initial_sp),                   /*     Initial Stack Pointer */
    Reset_Handler,                            /*     Reset Handler */
    NMI_Handler,                              /* -14 NMI Handler */
    HardFault_Handler,                        /* -13 Hard Fault Handler */
    MemManage_Handler,                        /* -12 MPU Fault Handler */
    BusFault_Handler,                         /* -11 Bus Fault Handler */
    UsageFault_Handler,                       /* -10 Usage Fault Handler */
    SecureFault_Handler,                      /*  -9 Secure Fault Handler */
    0,                                        /*     Reserved */
    0,                                        /*     Reserved */
    0,                                        /*     Reserved */
    SVC_Handler,                              /*  -5 SVCall Handler */
    DebugMon_Handler,                         /*  -4 Debug Monitor Handler */
    0,                                        /*     Reserved */
    PendSV_Handler,                           /*  -2 PendSV Handler */
    SysTick_Handler,                          /*  -1 SysTick Handler */
  
    /* Interrupts */
    Interrupt0_Handler,                       /*   0 Interrupt 0 */
    Interrupt1_Handler,                       /*   1 Interrupt 1 */
    Interrupt2_Handler,                       /*   2 Interrupt 2 */
    Interrupt3_Handler,                       /*   3 Interrupt 3 */
    Interrupt4_Handler,                       /*   4 Interrupt 4 */
    Interrupt5_Handler,                       /*   5 Interrupt 5 */
    Interrupt6_Handler,                       /*   6 Interrupt 6 */
    Interrupt7_Handler,                       /*   7 Interrupt 7 */
    Interrupt8_Handler,                       /*   8 Interrupt 8 */
    Interrupt9_Handler                        /*   9 Interrupt 9 */
                                              /* Interrupts 10 .. 480 are left out */
  };
  
  
  /*----------------------------------------------------------------------------
    Reset Handler called on controller reset
   *----------------------------------------------------------------------------*/
  void Reset_Handler(void) {
  
    __set_MSPLIM((uint32_t)&__stack_limit);
  
    SystemInit();                             /* CMSIS System Initialization */
    __main();                                 /* Enter PreeMain (C library entry point) */
  }
  
  
  /*----------------------------------------------------------------------------
    Default Handler for Exceptions / Interrupts
   *----------------------------------------------------------------------------*/
  void Default_Handler(void) {
  
    while(1);
  }
  