]> git.sur5r.net Git - freertos/blob - Demo/CORTEX_LM3Sxxxx_IAR_Keil/startup_ewarm.c
UpdUpdate IAR projects to use Embedded Workbench V5.11.
[freertos] / Demo / CORTEX_LM3Sxxxx_IAR_Keil / startup_ewarm.c
1 //*****************************************************************************\r
2 //\r
3 // startup_ewarm.c - Boot code for Stellaris.\r
4 //\r
5 // Copyright (c) 2006-2007 Luminary Micro, Inc.  All rights reserved.\r
6 //\r
7 // Software License Agreement\r
8 //\r
9 // Luminary Micro, Inc. (LMI) is supplying this software for use solely and\r
10 // exclusively on LMI's microcontroller products.\r
11 //\r
12 // The software is owned by LMI and/or its suppliers, and is protected under\r
13 // applicable copyright laws.  All rights are reserved.  Any use in violation\r
14 // of the foregoing restrictions may subject the user to criminal sanctions\r
15 // under applicable laws, as well as to civil liability for the breach of the\r
16 // terms and conditions of this license.\r
17 //\r
18 // THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED\r
19 // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF\r
20 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.\r
21 // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR\r
22 // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.\r
23 //\r
24 // This is part of revision 100 of the Stellaris Ethernet\r
25 // Applications Library.\r
26 //\r
27 //*****************************************************************************\r
28 \r
29 //*****************************************************************************\r
30 //\r
31 // Enable the IAR extensions for this source file.\r
32 //\r
33 //*****************************************************************************\r
34 #pragma language=extended\r
35 \r
36 //*****************************************************************************\r
37 //\r
38 // Forward declaration of the default fault handlers.\r
39 //\r
40 //*****************************************************************************\r
41 static void NmiSR(void);\r
42 static void FaultISR(void);\r
43 static void IntDefaultHandler(void);\r
44 \r
45 //*****************************************************************************\r
46 //\r
47 // External declaration for the interrupt handler used by the application.\r
48 //\r
49 //*****************************************************************************\r
50 \r
51 \r
52 //*****************************************************************************\r
53 //\r
54 // The entry point for the application.\r
55 //\r
56 //*****************************************************************************\r
57 extern void __iar_program_start(void);\r
58 extern void xPortPendSVHandler(void);\r
59 extern void xPortSysTickHandler(void);\r
60 extern void vEMAC_ISR( void );\r
61 extern Timer0IntHandler( void );\r
62 \r
63 //*****************************************************************************\r
64 //\r
65 // Reserve space for the system stack.\r
66 //\r
67 //*****************************************************************************\r
68 #ifndef STACK_SIZE\r
69 #define STACK_SIZE                              64\r
70 #endif\r
71 static unsigned long pulStack[STACK_SIZE] @ ".noinit";\r
72 \r
73 //*****************************************************************************\r
74 //\r
75 // A union that describes the entries of the vector table.  The union is needed\r
76 // since the first entry is the stack pointer and the remainder are function\r
77 // pointers.\r
78 //\r
79 //*****************************************************************************\r
80 typedef union\r
81 {\r
82     void (*pfnHandler)(void);\r
83     unsigned long ulPtr;\r
84 }\r
85 uVectorEntry;\r
86 \r
87 //*****************************************************************************\r
88 //\r
89 // The minimal vector table for a Cortex M3.  Note that the proper constructs\r
90 // must be placed on this to ensure that it ends up at physical address\r
91 // 0x0000.0000.\r
92 //\r
93 //*****************************************************************************\r
94 __root const uVectorEntry __vector_table[] @ ".intvec" =\r
95 {\r
96     { .ulPtr = (unsigned long)pulStack + sizeof(pulStack) },\r
97                                             // The initial stack pointer\r
98     __iar_program_start,                    // The reset handler\r
99     NmiSR,                                  // The NMI handler\r
100     FaultISR,                               // The hard fault handler\r
101     IntDefaultHandler,                      // The MPU fault handler\r
102     IntDefaultHandler,                      // The bus fault handler\r
103     IntDefaultHandler,                      // The usage fault handler\r
104     0,                                      // Reserved\r
105     0,                                      // Reserved\r
106     0,                                      // Reserved\r
107     0,                                      // Reserved\r
108     IntDefaultHandler,                      // SVCall handler\r
109     IntDefaultHandler,                      // Debug monitor handler\r
110     0,                                      // Reserved\r
111     xPortPendSVHandler,                     // The PendSV handler\r
112     xPortSysTickHandler,                    // The SysTick handler\r
113     IntDefaultHandler,                      // GPIO Port A\r
114     IntDefaultHandler,                      // GPIO Port B\r
115     IntDefaultHandler,                      // GPIO Port C\r
116     IntDefaultHandler,                      // GPIO Port D\r
117     IntDefaultHandler,                      // GPIO Port E\r
118     IntDefaultHandler,                      // UART0 Rx and Tx\r
119     IntDefaultHandler,                      // UART1 Rx and Tx\r
120     IntDefaultHandler,                      // SSI Rx and Tx\r
121     IntDefaultHandler,                      // I2C Master and Slave\r
122     IntDefaultHandler,                      // PWM Fault\r
123     IntDefaultHandler,                      // PWM Generator 0\r
124     IntDefaultHandler,                      // PWM Generator 1\r
125     IntDefaultHandler,                      // PWM Generator 2\r
126     IntDefaultHandler,                      // Quadrature Encoder\r
127     IntDefaultHandler,                      // ADC Sequence 0\r
128     IntDefaultHandler,                      // ADC Sequence 1\r
129     IntDefaultHandler,                      // ADC Sequence 2\r
130     IntDefaultHandler,                      // ADC Sequence 3\r
131     IntDefaultHandler,                      // Watchdog timer\r
132     Timer0IntHandler,                       // Timer 0 subtimer A\r
133     IntDefaultHandler,                      // Timer 0 subtimer B\r
134     IntDefaultHandler,                      // Timer 1 subtimer A\r
135     IntDefaultHandler,                      // Timer 1 subtimer B\r
136     IntDefaultHandler,                      // Timer 2 subtimer A\r
137     IntDefaultHandler,                      // Timer 2 subtimer B\r
138     IntDefaultHandler,                      // Analog Comparator 0\r
139     IntDefaultHandler,                      // Analog Comparator 1\r
140     IntDefaultHandler,                      // Analog Comparator 2\r
141     IntDefaultHandler,                      // System Control (PLL, OSC, BO)\r
142     IntDefaultHandler,                      // FLASH Control\r
143     IntDefaultHandler,                      // GPIO Port F\r
144     IntDefaultHandler,                      // GPIO Port G\r
145     IntDefaultHandler,                      // GPIO Port H\r
146     IntDefaultHandler,                      // UART2 Rx and Tx\r
147     IntDefaultHandler,                      // SSI1 Rx and Tx\r
148     IntDefaultHandler,                      // Timer 3 subtimer A\r
149     IntDefaultHandler,                      // Timer 3 subtimer B\r
150     IntDefaultHandler,                      // I2C1 Master and Slave\r
151     IntDefaultHandler,                      // Quadrature Encoder 1\r
152     IntDefaultHandler,                      // CAN0\r
153     IntDefaultHandler,                      // CAN1\r
154     IntDefaultHandler,                      // CAN2\r
155     vEMAC_ISR,                                          // Ethernet\r
156     IntDefaultHandler                       // Power Island\r
157 };\r
158 \r
159 \r
160 //*****************************************************************************\r
161 //\r
162 // This is the code that gets called when the processor receives a NMI.  This\r
163 // simply enters an infinite loop, preserving the system state for examination\r
164 // by a debugger.\r
165 //\r
166 //*****************************************************************************\r
167 static void\r
168 NmiSR(void)\r
169 {\r
170     //\r
171     // Enter an infinite loop.\r
172     //\r
173     while(1)\r
174     {\r
175     }\r
176 }\r
177 \r
178 //*****************************************************************************\r
179 //\r
180 // This is the code that gets called when the processor receives a fault\r
181 // interrupt.  This simply enters an infinite loop, preserving the system state\r
182 // for examination by a debugger.\r
183 //\r
184 //*****************************************************************************\r
185 static void\r
186 FaultISR(void)\r
187 {\r
188     //\r
189     // Enter an infinite loop.\r
190     //\r
191     while(1)\r
192     {\r
193     }\r
194 }\r
195 \r
196 //*****************************************************************************\r
197 //\r
198 // This is the code that gets called when the processor receives an unexpected\r
199 // interrupt.  This simply enters an infinite loop, preserving the system state\r
200 // for examination by a debugger.\r
201 //\r
202 //*****************************************************************************\r
203 static void\r
204 IntDefaultHandler(void)\r
205 {\r
206     //\r
207     // Go into an infinite loop.\r
208     //\r
209     while(1)\r
210     {\r
211     }\r
212 }\r