start_iar.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. //*****************************************************************************
  2. //
  3. // startup_ewarm.c - Startup code for use with IAR's Embedded Workbench,
  4. // version 5.
  5. //
  6. // Copyright (c) 2011 Texas Instruments Incorporated. All rights reserved.
  7. // Software License Agreement
  8. //
  9. // Texas Instruments (TI) is supplying this software for use solely and
  10. // exclusively on TI's microcontroller products. The software is owned by
  11. // TI and/or its suppliers, and is protected under applicable copyright
  12. // laws. You may not combine this software with "viral" open-source
  13. // software in order to form a larger program.
  14. //
  15. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
  16. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  17. // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  18. // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
  19. // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  20. // DAMAGES, FOR ANY REASON WHATSOEVER.
  21. //
  22. // This is part of revision 8049 of the EK-LM4F232 Firmware Package.
  23. //
  24. //*****************************************************************************
  25. //*****************************************************************************
  26. //
  27. // Enable the IAR extensions for this source file.
  28. //
  29. //*****************************************************************************
  30. #pragma language=extended
  31. //*****************************************************************************
  32. //
  33. // Forward declaration of the default fault handlers.
  34. //
  35. //*****************************************************************************
  36. static void NmiSR(void);
  37. static void FaultISR(void);
  38. static void IntDefaultHandler(void);
  39. //*****************************************************************************
  40. //
  41. // The entry point for the application startup code.
  42. //
  43. //*****************************************************************************
  44. extern void __iar_program_start(void);
  45. //*****************************************************************************
  46. //
  47. // Reserve space for the system stack.
  48. //
  49. //*****************************************************************************
  50. static unsigned long pulStack[256] @ ".noinit";
  51. //*****************************************************************************
  52. //
  53. // A union that describes the entries of the vector table. The union is needed
  54. // since the first entry is the stack pointer and the remainder are function
  55. // pointers.
  56. //
  57. //*****************************************************************************
  58. typedef union
  59. {
  60. void (*pfnHandler)(void);
  61. unsigned long ulPtr;
  62. }
  63. uVectorEntry;
  64. //*****************************************************************************
  65. //
  66. // The vector table. Note that the proper constructs must be placed on this to
  67. // ensure that it ends up at physical address 0x0000.0000.
  68. //
  69. //*****************************************************************************
  70. __root const uVectorEntry __vector_table[] @ ".intvec" =
  71. {
  72. { .ulPtr = (unsigned long)pulStack + sizeof(pulStack) },
  73. // The initial stack pointer
  74. __iar_program_start, // The reset handler
  75. NmiSR, // The NMI handler
  76. FaultISR, // The hard fault handler
  77. IntDefaultHandler, // The MPU fault handler
  78. IntDefaultHandler, // The bus fault handler
  79. IntDefaultHandler, // The usage fault handler
  80. 0, // Reserved
  81. 0, // Reserved
  82. 0, // Reserved
  83. 0, // Reserved
  84. IntDefaultHandler, // SVCall handler
  85. IntDefaultHandler, // Debug monitor handler
  86. 0, // Reserved
  87. IntDefaultHandler, // The PendSV handler
  88. IntDefaultHandler, // The SysTick handler
  89. IntDefaultHandler, // GPIO Port A
  90. IntDefaultHandler, // GPIO Port B
  91. IntDefaultHandler, // GPIO Port C
  92. IntDefaultHandler, // GPIO Port D
  93. IntDefaultHandler, // GPIO Port E
  94. IntDefaultHandler, // UART0 Rx and Tx
  95. IntDefaultHandler, // UART1 Rx and Tx
  96. IntDefaultHandler, // SSI0 Rx and Tx
  97. IntDefaultHandler, // I2C0 Master and Slave
  98. IntDefaultHandler, // PWM Fault
  99. IntDefaultHandler, // PWM Generator 0
  100. IntDefaultHandler, // PWM Generator 1
  101. IntDefaultHandler, // PWM Generator 2
  102. IntDefaultHandler, // Quadrature Encoder 0
  103. IntDefaultHandler, // ADC Sequence 0
  104. IntDefaultHandler, // ADC Sequence 1
  105. IntDefaultHandler, // ADC Sequence 2
  106. IntDefaultHandler, // ADC Sequence 3
  107. IntDefaultHandler, // Watchdog timer
  108. IntDefaultHandler, // Timer 0 subtimer A
  109. IntDefaultHandler, // Timer 0 subtimer B
  110. IntDefaultHandler, // Timer 1 subtimer A
  111. IntDefaultHandler, // Timer 1 subtimer B
  112. IntDefaultHandler, // Timer 2 subtimer A
  113. IntDefaultHandler, // Timer 2 subtimer B
  114. IntDefaultHandler, // Analog Comparator 0
  115. IntDefaultHandler, // Analog Comparator 1
  116. IntDefaultHandler, // Analog Comparator 2
  117. IntDefaultHandler, // System Control (PLL, OSC, BO)
  118. IntDefaultHandler, // FLASH Control
  119. IntDefaultHandler, // GPIO Port F
  120. IntDefaultHandler, // GPIO Port G
  121. IntDefaultHandler, // GPIO Port H
  122. IntDefaultHandler, // UART2 Rx and Tx
  123. IntDefaultHandler, // SSI1 Rx and Tx
  124. IntDefaultHandler, // Timer 3 subtimer A
  125. IntDefaultHandler, // Timer 3 subtimer B
  126. IntDefaultHandler, // I2C1 Master and Slave
  127. IntDefaultHandler, // Quadrature Encoder 1
  128. IntDefaultHandler, // CAN0
  129. IntDefaultHandler, // CAN1
  130. IntDefaultHandler, // CAN2
  131. IntDefaultHandler, // Ethernet
  132. IntDefaultHandler, // Hibernate
  133. IntDefaultHandler, // USB0
  134. IntDefaultHandler, // PWM Generator 3
  135. IntDefaultHandler, // uDMA Software Transfer
  136. IntDefaultHandler, // uDMA Error
  137. IntDefaultHandler, // ADC1 Sequence 0
  138. IntDefaultHandler, // ADC1 Sequence 1
  139. IntDefaultHandler, // ADC1 Sequence 2
  140. IntDefaultHandler, // ADC1 Sequence 3
  141. IntDefaultHandler, // I2S0
  142. IntDefaultHandler, // External Bus Interface 0
  143. IntDefaultHandler, // GPIO Port J
  144. IntDefaultHandler, // GPIO Port K
  145. IntDefaultHandler, // GPIO Port L
  146. IntDefaultHandler, // SSI2 Rx and Tx
  147. IntDefaultHandler, // SSI3 Rx and Tx
  148. IntDefaultHandler, // UART3 Rx and Tx
  149. IntDefaultHandler, // UART4 Rx and Tx
  150. IntDefaultHandler, // UART5 Rx and Tx
  151. IntDefaultHandler, // UART6 Rx and Tx
  152. IntDefaultHandler, // UART7 Rx and Tx
  153. 0, // Reserved
  154. 0, // Reserved
  155. 0, // Reserved
  156. 0, // Reserved
  157. IntDefaultHandler, // I2C2 Master and Slave
  158. IntDefaultHandler, // I2C3 Master and Slave
  159. IntDefaultHandler, // Timer 4 subtimer A
  160. IntDefaultHandler, // Timer 4 subtimer B
  161. 0, // Reserved
  162. 0, // Reserved
  163. 0, // Reserved
  164. 0, // Reserved
  165. 0, // Reserved
  166. 0, // Reserved
  167. 0, // Reserved
  168. 0, // Reserved
  169. 0, // Reserved
  170. 0, // Reserved
  171. 0, // Reserved
  172. 0, // Reserved
  173. 0, // Reserved
  174. 0, // Reserved
  175. 0, // Reserved
  176. 0, // Reserved
  177. 0, // Reserved
  178. 0, // Reserved
  179. 0, // Reserved
  180. 0, // Reserved
  181. IntDefaultHandler, // Timer 5 subtimer A
  182. IntDefaultHandler, // Timer 5 subtimer B
  183. IntDefaultHandler, // Wide Timer 0 subtimer A
  184. IntDefaultHandler, // Wide Timer 0 subtimer B
  185. IntDefaultHandler, // Wide Timer 1 subtimer A
  186. IntDefaultHandler, // Wide Timer 1 subtimer B
  187. IntDefaultHandler, // Wide Timer 2 subtimer A
  188. IntDefaultHandler, // Wide Timer 2 subtimer B
  189. IntDefaultHandler, // Wide Timer 3 subtimer A
  190. IntDefaultHandler, // Wide Timer 3 subtimer B
  191. IntDefaultHandler, // Wide Timer 4 subtimer A
  192. IntDefaultHandler, // Wide Timer 4 subtimer B
  193. IntDefaultHandler, // Wide Timer 5 subtimer A
  194. IntDefaultHandler, // Wide Timer 5 subtimer B
  195. IntDefaultHandler, // FPU
  196. IntDefaultHandler, // PECI 0
  197. IntDefaultHandler, // LPC 0
  198. IntDefaultHandler, // I2C4 Master and Slave
  199. IntDefaultHandler, // I2C5 Master and Slave
  200. IntDefaultHandler, // GPIO Port M
  201. IntDefaultHandler, // GPIO Port N
  202. IntDefaultHandler, // Quadrature Encoder 2
  203. IntDefaultHandler, // Fan 0
  204. 0, // Reserved
  205. IntDefaultHandler, // GPIO Port P (Summary or P0)
  206. IntDefaultHandler, // GPIO Port P1
  207. IntDefaultHandler, // GPIO Port P2
  208. IntDefaultHandler, // GPIO Port P3
  209. IntDefaultHandler, // GPIO Port P4
  210. IntDefaultHandler, // GPIO Port P5
  211. IntDefaultHandler, // GPIO Port P6
  212. IntDefaultHandler, // GPIO Port P7
  213. IntDefaultHandler, // GPIO Port Q (Summary or Q0)
  214. IntDefaultHandler, // GPIO Port Q1
  215. IntDefaultHandler, // GPIO Port Q2
  216. IntDefaultHandler, // GPIO Port Q3
  217. IntDefaultHandler, // GPIO Port Q4
  218. IntDefaultHandler, // GPIO Port Q5
  219. IntDefaultHandler, // GPIO Port Q6
  220. IntDefaultHandler, // GPIO Port Q7
  221. IntDefaultHandler, // GPIO Port R
  222. IntDefaultHandler, // GPIO Port S
  223. IntDefaultHandler, // PWM 1 Generator 0
  224. IntDefaultHandler, // PWM 1 Generator 1
  225. IntDefaultHandler, // PWM 1 Generator 2
  226. IntDefaultHandler, // PWM 1 Generator 3
  227. IntDefaultHandler // PWM 1 Fault
  228. };
  229. //*****************************************************************************
  230. //
  231. // This is the code that gets called when the processor receives a NMI. This
  232. // simply enters an infinite loop, preserving the system state for examination
  233. // by a debugger.
  234. //
  235. //*****************************************************************************
  236. static void
  237. NmiSR(void)
  238. {
  239. //
  240. // Enter an infinite loop.
  241. //
  242. while(1)
  243. {
  244. }
  245. }
  246. //*****************************************************************************
  247. //
  248. // This is the code that gets called when the processor receives a fault
  249. // interrupt. This simply enters an infinite loop, preserving the system state
  250. // for examination by a debugger.
  251. //
  252. //*****************************************************************************
  253. static void
  254. FaultISR(void)
  255. {
  256. //
  257. // Enter an infinite loop.
  258. //
  259. while(1)
  260. {
  261. }
  262. }
  263. //*****************************************************************************
  264. //
  265. // This is the code that gets called when the processor receives an unexpected
  266. // interrupt. This simply enters an infinite loop, preserving the system state
  267. // for examination by a debugger.
  268. //
  269. //*****************************************************************************
  270. static void
  271. IntDefaultHandler(void)
  272. {
  273. //
  274. // Go into an infinite loop.
  275. //
  276. while(1)
  277. {
  278. }
  279. }