SAM3S8/SD8 Software Package: libraries/libboard_sam3s-ek2/source/board_cstartup_keil.c Source File

SAM3S8/SD8 Software Package 1.2

# board_cstartup_keil.c

    00001 /* ----------------------------------------------------------------------------
    00002  *         ATMEL Microcontroller Software Support
    00003  * ----------------------------------------------------------------------------
    00004  * Copyright (c) 2011, Atmel Corporation
    00005  *
    00006  * All rights reserved.
    00007  *
    00008  * Redistribution and use in source and binary forms, with or without
    00009  * modification, are permitted provided that the following conditions are met:
    00010  *
    00011  * - Redistributions of source code must retain the above copyright notice,
    00012  * this list of conditions and the disclaimer below.
    00013  *
    00014  * Atmel's name may not be used to endorse or promote products derived from
    00015  * this software without specific prior written permission.
    00016  *
    00017  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
    00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00019  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
    00020  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
    00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    00022  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
    00023  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    00024  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    00025  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    00026  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00027  * ----------------------------------------------------------------------------
    00028  */
    00029
    00030 /*------------------------------------------------------------------------------
    00031  *         Headers
    00032  *------------------------------------------------------------------------------*/
    00033
    00034 #include "board.h"
    00035
    00036 /*------------------------------------------------------------------------------
    00037  *         Types
    00038  *------------------------------------------------------------------------------*/
    00039 typedef union { IntFunc __fun; void * __ptr; } IntVector;
    00040
    00041 /*------------------------------------------------------------------------------
    00042  *         ProtoTypes
    00043  *------------------------------------------------------------------------------*/
    00044 extern int Image$$ARM_LIB_STACK$$ZI$$Limit ;
    00045 extern int Image$$Vector_region$$Base ;
    00046 extern int Image$$Vector_region$$Limit ;
    00047
    00048 extern void __main( void ) ;
    00049 static void _Reset_Handler( void ) ;
    00050
    00051 /*------------------------------------------------------------------------------
    00052  *         Exception Table
    00053  *------------------------------------------------------------------------------*/
    00054
    00055 #pragma arm section rodata="vectors"
    00056 const IntVector __vector_table[] =
    00057 {
    00058     (IntFunc)&Image$$ARM_LIB_STACK$$ZI$$Limit,
    00059     _Reset_Handler,
    00060
    00061     NMI_Handler,
    00062     HardFault_Handler,
    00063     MemManage_Handler,
    00064     BusFault_Handler,
    00065     UsageFault_Handler,
    00066     0, 0, 0, 0,         /* Reserved */
    00067     SVC_Handler,
    00068     DebugMon_Handler,
    00069     0,                  /* Reserved  */
    00070     PendSV_Handler,
    00071     SysTick_Handler,
    00072
    00073     /* Configurable interrupts  */
    00074     SUPC_IrqHandler,    /* 0  Supply Controller */
    00075     RSTC_IrqHandler,    /* 1  Reset Controller */
    00076     RTC_IrqHandler,     /* 2  Real Time Clock */
    00077     RTT_IrqHandler,     /* 3  Real Time Timer */
    00078     WDT_IrqHandler,     /* 4  Watchdog Timer */
    00079     PMC_IrqHandler,     /* 5  PMC */
    00080     EEFC_IrqHandler,    /* 6  EEFC */
    00081     IrqHandlerNotUsed,  /* 7  Reserved */
    00082     UART0_IrqHandler,   /* 8  UART0 */
    00083     UART1_IrqHandler,   /* 9  UART1 */
    00084     SMC_IrqHandler,     /* 10 SMC */
    00085     PIOA_IrqHandler,    /* 11 Parallel IO Controller A */
    00086     PIOB_IrqHandler,    /* 12 Parallel IO Controller B */
    00087     PIOC_IrqHandler,    /* 13 Parallel IO Controller C */
    00088     USART0_IrqHandler,  /* 14 USART 0 */
    00089     USART1_IrqHandler,  /* 15 USART 1 */
    00090     USART2_IrqHandler,  /* 16 USART 2 */
    00091     IrqHandlerNotUsed,  /* 17 Reserved */
    00092     MCI_IrqHandler,     /* 18 MCI */
    00093     TWI0_IrqHandler,    /* 19 TWI 0 */
    00094     TWI1_IrqHandler,    /* 20 TWI 1 */
    00095     SPI_IrqHandler,     /* 21 SPI */
    00096     SSC_IrqHandler,     /* 22 SSC */
    00097     TC0_IrqHandler,     /* 23 Timer Counter 0 */
    00098     TC1_IrqHandler,     /* 24 Timer Counter 1 */
    00099     TC2_IrqHandler,     /* 25 Timer Counter 2 */
    00100     TC3_IrqHandler,     /* 26 Timer Counter 3 */
    00101     TC4_IrqHandler,     /* 27 Timer Counter 4 */
    00102     TC5_IrqHandler,     /* 28 Timer Counter 5 */
    00103     ADC_IrqHandler,     /* 29 ADC controller */
    00104     DAC_IrqHandler,     /* 30 DAC controller */
    00105     PWM_IrqHandler,     /* 31 PWM */
    00106     CRCCU_IrqHandler,   /* 32 CRC Calculation Unit */
    00107     ACC_IrqHandler,     /* 33 Analog Comparator */
    00108     USBD_IrqHandler,    /* 34 USB Device Port */
    00109     IrqHandlerNotUsed   /* 35 not used */
    00110 };
    00111 #pragma arm section
    00112
    00113 /**
    00114  * \brief This is the code that gets called on processor reset. To initialize the
    00115  * device.
    00116  */
    00117 static void _Reset_Handler( void )
    00118 {
    00119     uint32_t *pSrc = (uint32_t*)&Image$$Vector_region$$Base ;
    00120
    00121     /* Low level Initialize */
    00122     LowLevelInit() ;
    00123
    00124     SCB->VTOR = ( (uint32_t)pSrc & SCB_VTOR_TBLOFF_Msk ) ;
    00125
    00126     if ( ((uint32_t)pSrc >= IRAM_ADDR) && ((uint32_t)pSrc < IRAM_ADDR+IRAM_SIZE) )
    00127     {
    00128         SCB->VTOR |= 1 << SCB_VTOR_TBLBASE_Pos ;
    00129     }
    00130
    00131     /* Branch to main function */
    00132     __main() ;
    00133
    00134     /* Infinite loop */
    00135     while ( 1 ) ;
    00136 }

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines