]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/system/CCS/msp432_startup_ccs.c
Final V8.2.1 release ready for tagging:
[freertos] / FreeRTOS / Demo / CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil / system / CCS / msp432_startup_ccs.c
1 //*****************************************************************************\r
2 //\r
3 // Copyright (C) 2012 - 2014 Texas Instruments Incorporated - http://www.ti.com/ \r
4 //\r
5 // Redistribution and use in source and binary forms, with or without \r
6 // modification, are permitted provided that the following conditions \r
7 // are met:\r
8 //\r
9 //  Redistributions of source code must retain the above copyright \r
10 //  notice, this list of conditions and the following disclaimer.\r
11 //\r
12 //  Redistributions in binary form must reproduce the above copyright\r
13 //  notice, this list of conditions and the following disclaimer in the \r
14 //  documentation and/or other materials provided with the   \r
15 //  distribution.\r
16 //\r
17 //  Neither the name of Texas Instruments Incorporated nor the names of\r
18 //  its contributors may be used to endorse or promote products derived\r
19 //  from this software without specific prior written permission.\r
20 //\r
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \r
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT \r
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT \r
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \r
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \r
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \r
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  \r
32 //\r
33 // MSP432 Family Interrupt Vector Table for CGT\r
34 //\r
35 //****************************************************************************\r
36 \r
37 #include <stdint.h>\r
38 #include <driverlib.h>\r
39 \r
40 /* Forward declaration of the default fault handlers. */\r
41 static void resetISR(void);\r
42 static void nmiISR(void);\r
43 static void faultISR(void);\r
44 static void defaultISR(void);\r
45 \r
46 \r
47 /* External declaration for the reset handler that is to be called when the */\r
48 /* processor is started                                                     */\r
49 extern void _c_int00(void);\r
50 \r
51 \r
52 /* Linker variable that marks the top of the stack. */\r
53 extern unsigned long __STACK_END;\r
54 \r
55 \r
56 /* External declarations for the FreeRTOS interrupt handlers. */\r
57 extern void xPortSysTickHandler( void );\r
58 extern void vPortSVCHandler( void );\r
59 extern void xPortPendSVHandler( void );\r
60 \r
61 /* External declarations for the peripheral interrupts handlers used by the\r
62 demo application. */\r
63 extern void vUART_Handler( void );\r
64 extern void vT32_0_Handler( void );\r
65 extern void vT32_1_Handler( void );\r
66 \r
67 /* Intrrupt vector table.  Note that the proper constructs must be placed on this to  */\r
68 /* ensure that it ends up at physical address 0x0000.0000 or at the start of          */\r
69 /* the program if located at a start address other than 0.                            */\r
70 #pragma DATA_SECTION(interruptVectors, ".intvecs")\r
71 void (* const interruptVectors[])(void) =\r
72 {\r
73     (void (*)(void))((uint32_t)&__STACK_END),\r
74                                             /* The initial stack pointer */\r
75     resetISR,                               /* The reset handler         */\r
76     nmiISR,                                 /* The NMI handler           */\r
77     faultISR,                               /* The hard fault handler    */\r
78     defaultISR,                             /* The MPU fault handler     */\r
79     defaultISR,                             /* The bus fault handler     */\r
80     defaultISR,                             /* The usage fault handler   */\r
81     0,                                      /* Reserved                  */\r
82     0,                                      /* Reserved                  */\r
83     0,                                      /* Reserved                  */\r
84     0,                                      /* Reserved                  */\r
85         vPortSVCHandler,                        /* SVCall handler            */\r
86     defaultISR,                             /* Debug monitor handler     */\r
87     0,                                      /* Reserved                  */\r
88         xPortPendSVHandler,                     /* The PendSV handler        */\r
89         xPortSysTickHandler,                    /* The SysTick handler       */\r
90     defaultISR,                             /* PSS ISR                   */\r
91     defaultISR,                             /* CS ISR                    */\r
92     defaultISR,                             /* PCM ISR                   */\r
93     defaultISR,                             /* WDT ISR                   */\r
94     defaultISR,                             /* FPU ISR                   */\r
95     defaultISR,                             /* FLCTL ISR                 */\r
96     defaultISR,                             /* COMP0 ISR                 */\r
97     defaultISR,                             /* COMP1 ISR                 */\r
98     defaultISR,                             /* TA0_0 ISR                 */\r
99     defaultISR,                             /* TA0_N ISR                 */\r
100         defaultISR,                             /* TA1_0 ISR                 */\r
101     defaultISR,                             /* TA1_N ISR                 */\r
102         defaultISR,                             /* TA2_0 ISR                 */\r
103     defaultISR,                             /* TA2_N ISR                 */\r
104     defaultISR,                             /* TA3_0 ISR                 */\r
105     defaultISR,                             /* TA3_N ISR                 */\r
106         vUART_Handler,                        /* EUSCIA0 ISR               */\r
107     defaultISR,                             /* EUSCIA1 ISR               */\r
108     defaultISR,                             /* EUSCIA2 ISR               */\r
109     defaultISR,                             /* EUSCIA3 ISR               */\r
110     defaultISR,                             /* EUSCIB0 ISR               */\r
111     defaultISR,                             /* EUSCIB1 ISR               */\r
112     defaultISR,                             /* EUSCIB2 ISR               */\r
113     defaultISR,                             /* EUSCIB3 ISR               */\r
114     defaultISR,                             /* ADC14 ISR                 */\r
115         vT32_0_Handler,                         /* T32_INT1 ISR              */\r
116         vT32_1_Handler,                         /* T32_INT2 ISR              */\r
117     defaultISR,                             /* T32_INTC ISR              */\r
118     defaultISR,                             /* AES ISR                   */\r
119     defaultISR,                             /* RTC ISR                   */\r
120     defaultISR,                             /* DMA_ERR ISR               */\r
121     defaultISR,                             /* DMA_INT3 ISR              */\r
122     defaultISR,                             /* DMA_INT2 ISR              */\r
123     defaultISR,                             /* DMA_INT1 ISR              */\r
124     defaultISR,                             /* DMA_INT0 ISR              */\r
125         defaultISR,                             /* PORT1 ISR                 */\r
126     defaultISR,                             /* PORT2 ISR                 */\r
127     defaultISR,                             /* PORT3 ISR                 */\r
128     defaultISR,                             /* PORT4 ISR                 */\r
129     defaultISR,                             /* PORT5 ISR                 */\r
130     defaultISR,                             /* PORT6 ISR                 */\r
131     defaultISR,                             /* Reserved 41               */\r
132     defaultISR,                             /* Reserved 42               */\r
133     defaultISR,                             /* Reserved 43               */\r
134     defaultISR,                             /* Reserved 44               */\r
135     defaultISR,                             /* Reserved 45               */\r
136     defaultISR,                             /* Reserved 46               */\r
137     defaultISR,                             /* Reserved 47               */\r
138     defaultISR,                             /* Reserved 48               */\r
139     defaultISR,                             /* Reserved 49               */\r
140     defaultISR,                             /* Reserved 50               */\r
141     defaultISR,                             /* Reserved 51               */\r
142     defaultISR,                             /* Reserved 52               */\r
143     defaultISR,                             /* Reserved 53               */\r
144     defaultISR,                             /* Reserved 54               */\r
145     defaultISR,                             /* Reserved 55               */\r
146     defaultISR,                             /* Reserved 56               */\r
147     defaultISR,                             /* Reserved 57               */\r
148     defaultISR,                             /* Reserved 58               */\r
149     defaultISR,                             /* Reserved 59               */\r
150     defaultISR,                             /* Reserved 60               */\r
151     defaultISR,                             /* Reserved 61               */\r
152     defaultISR,                             /* Reserved 62               */\r
153     defaultISR,                             /* Reserved 63               */\r
154     defaultISR                              /* Reserved 64               */\r
155 };\r
156 \r
157 \r
158 /* This is the code that gets called when the processor first starts execution */\r
159 /* following a reset event.  Only the absolutely necessary set is performed,   */\r
160 /* after which the application supplied entry() routine is called.  Any fancy  */\r
161 /* actions (such as making decisions based on the reset cause register, and    */\r
162 /* resetting the bits in that register) are left solely in the hands of the    */\r
163 /* application.                                                                */\r
164 void resetISR(void)\r
165 {\r
166     /* Jump to the CCS C Initialization Routine. */\r
167         MAP_WDT_A_holdTimer();\r
168     __asm("    .global _c_int00\n"\r
169           "    b.w     _c_int00");\r
170 }\r
171 \r
172 \r
173 /* This is the code that gets called when the processor receives a NMI.  This  */\r
174 /* simply enters an infinite loop, preserving the system state for examination */\r
175 /* by a debugger.                                                              */\r
176 static void nmiISR(void)\r
177 {\r
178     /* Enter an infinite loop. */\r
179     while(1)\r
180     {\r
181     }\r
182 }\r
183 \r
184 \r
185 /* This is the code that gets called when the processor receives a fault        */\r
186 /* interrupt.  This simply enters an infinite loop, preserving the system state */\r
187 /* for examination by a debugger.                                               */\r
188 static void faultISR(void)\r
189 {\r
190     /* Enter an infinite loop. */\r
191     while(1)\r
192     {\r
193     }\r
194 }\r
195 \r
196 \r
197 /* This is the code that gets called when the processor receives an unexpected  */\r
198 /* interrupt.  This simply enters an infinite loop, preserving the system state */\r
199 /* for examination by a debugger.                                               */\r
200 static void defaultISR(void)\r
201 {\r
202     /* Enter an infinite loop. */\r
203     while(1)\r
204     {\r
205     }\r
206 }\r