/startup_ccs.c

https://github.com/bvernoux/EvalBotADK · C · 214 lines · 110 code · 9 blank · 95 comment · 3 complexity · 257f7df51abdb724effbabd48a17391b MD5 · raw file

  1. //*****************************************************************************
  2. //
  3. // startup_ccs.c - Startup code for use with TI's Code Composer Studio.
  4. //
  5. // Copyright (c) 2009-2011 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Texas Instruments (TI) is supplying this software for use solely and
  9. // exclusively on TI's microcontroller products. The software is owned by
  10. // TI and/or its suppliers, and is protected under applicable copyright
  11. // laws. You may not combine this software with "viral" open-source
  12. // software in order to form a larger program.
  13. //
  14. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
  15. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  16. // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
  18. // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  19. // DAMAGES, FOR ANY REASON WHATSOEVER.
  20. //
  21. // This is part of revision 6852 of the EK-LM3S9B92 Firmware Package.
  22. //
  23. //*****************************************************************************
  24. //*****************************************************************************
  25. //
  26. // Forward declaration of the default fault handlers.
  27. //
  28. //*****************************************************************************
  29. void ResetISR(void);
  30. static void NmiSR(void);
  31. static void FaultISR(void);
  32. static void IntDefaultHandler(void);
  33. //*****************************************************************************
  34. //
  35. // External declaration for the reset handler that is to be called when the
  36. // processor is started
  37. //
  38. //*****************************************************************************
  39. extern void _c_int00(void);
  40. //*****************************************************************************
  41. //
  42. // Linker variable that marks the top of the stack.
  43. //
  44. //*****************************************************************************
  45. extern unsigned long __STACK_TOP;
  46. //*****************************************************************************
  47. //
  48. // External declarations for the interrupt handlers used by the application.
  49. //
  50. //*****************************************************************************
  51. extern void SysTickIntHandler(void);
  52. extern void USB0OTGModeIntHandler(void);
  53. //*****************************************************************************
  54. //
  55. // The vector table. Note that the proper constructs must be placed on this to
  56. // ensure that it ends up at physical address 0x0000.0000 or at the start of
  57. // the program if located at a start address other than 0.
  58. //
  59. //*****************************************************************************
  60. #pragma DATA_SECTION(g_pfnVectors, ".intvecs")
  61. void (* const g_pfnVectors[])(void) =
  62. {
  63. (void (*)(void))((unsigned long)&__STACK_TOP),
  64. // The initial stack pointer
  65. ResetISR, // The reset handler
  66. NmiSR, // The NMI handler
  67. FaultISR, // The hard fault handler
  68. IntDefaultHandler, // The MPU fault handler
  69. IntDefaultHandler, // The bus fault handler
  70. IntDefaultHandler, // The usage fault handler
  71. 0, // Reserved
  72. 0, // Reserved
  73. 0, // Reserved
  74. 0, // Reserved
  75. IntDefaultHandler, // SVCall handler
  76. IntDefaultHandler, // Debug monitor handler
  77. 0, // Reserved
  78. IntDefaultHandler, // The PendSV handler
  79. SysTickIntHandler, // The SysTick handler
  80. IntDefaultHandler, // GPIO Port A
  81. IntDefaultHandler, // GPIO Port B
  82. IntDefaultHandler, // GPIO Port C
  83. IntDefaultHandler, // GPIO Port D
  84. IntDefaultHandler, // GPIO Port E
  85. IntDefaultHandler, // UART0 Rx and Tx
  86. IntDefaultHandler, // UART1 Rx and Tx
  87. IntDefaultHandler, // SSI0 Rx and Tx
  88. IntDefaultHandler, // I2C0 Master and Slave
  89. IntDefaultHandler, // PWM Fault
  90. IntDefaultHandler, // PWM Generator 0
  91. IntDefaultHandler, // PWM Generator 1
  92. IntDefaultHandler, // PWM Generator 2
  93. IntDefaultHandler, // Quadrature Encoder 0
  94. IntDefaultHandler, // ADC Sequence 0
  95. IntDefaultHandler, // ADC Sequence 1
  96. IntDefaultHandler, // ADC Sequence 2
  97. IntDefaultHandler, // ADC Sequence 3
  98. IntDefaultHandler, // Watchdog timer
  99. IntDefaultHandler, // Timer 0 subtimer A
  100. IntDefaultHandler, // Timer 0 subtimer B
  101. IntDefaultHandler, // Timer 1 subtimer A
  102. IntDefaultHandler, // Timer 1 subtimer B
  103. IntDefaultHandler, // Timer 2 subtimer A
  104. IntDefaultHandler, // Timer 2 subtimer B
  105. IntDefaultHandler, // Analog Comparator 0
  106. IntDefaultHandler, // Analog Comparator 1
  107. IntDefaultHandler, // Analog Comparator 2
  108. IntDefaultHandler, // System Control (PLL, OSC, BO)
  109. IntDefaultHandler, // FLASH Control
  110. IntDefaultHandler, // GPIO Port F
  111. IntDefaultHandler, // GPIO Port G
  112. IntDefaultHandler, // GPIO Port H
  113. IntDefaultHandler, // UART2 Rx and Tx
  114. IntDefaultHandler, // SSI1 Rx and Tx
  115. IntDefaultHandler, // Timer 3 subtimer A
  116. IntDefaultHandler, // Timer 3 subtimer B
  117. IntDefaultHandler, // I2C1 Master and Slave
  118. IntDefaultHandler, // Quadrature Encoder 1
  119. IntDefaultHandler, // CAN0
  120. IntDefaultHandler, // CAN1
  121. IntDefaultHandler, // CAN2
  122. IntDefaultHandler, // Ethernet
  123. IntDefaultHandler, // Hibernate
  124. USB0OTGModeIntHandler, // USB0
  125. IntDefaultHandler, // PWM Generator 3
  126. IntDefaultHandler, // uDMA Software Transfer
  127. IntDefaultHandler, // uDMA Error
  128. IntDefaultHandler, // ADC1 Sequence 0
  129. IntDefaultHandler, // ADC1 Sequence 1
  130. IntDefaultHandler, // ADC1 Sequence 2
  131. IntDefaultHandler, // ADC1 Sequence 3
  132. IntDefaultHandler, // I2S0
  133. IntDefaultHandler, // External Bus Interface 0
  134. IntDefaultHandler // GPIO Port J
  135. };
  136. //*****************************************************************************
  137. //
  138. // This is the code that gets called when the processor first starts execution
  139. // following a reset event. Only the absolutely necessary set is performed,
  140. // after which the application supplied entry() routine is called. Any fancy
  141. // actions (such as making decisions based on the reset cause register, and
  142. // resetting the bits in that register) are left solely in the hands of the
  143. // application.
  144. //
  145. //*****************************************************************************
  146. void
  147. ResetISR(void)
  148. {
  149. //
  150. // Jump to the CCS C Initialization Routine.
  151. //
  152. __asm(" .global _c_int00\n"
  153. " b.w _c_int00");
  154. }
  155. //*****************************************************************************
  156. //
  157. // This is the code that gets called when the processor receives a NMI. This
  158. // simply enters an infinite loop, preserving the system state for examination
  159. // by a debugger.
  160. //
  161. //*****************************************************************************
  162. static void
  163. NmiSR(void)
  164. {
  165. //
  166. // Enter an infinite loop.
  167. //
  168. while(1)
  169. {
  170. }
  171. }
  172. //*****************************************************************************
  173. //
  174. // This is the code that gets called when the processor receives a fault
  175. // interrupt. This simply enters an infinite loop, preserving the system state
  176. // for examination by a debugger.
  177. //
  178. //*****************************************************************************
  179. static void
  180. FaultISR(void)
  181. {
  182. //
  183. // Enter an infinite loop.
  184. //
  185. while(1)
  186. {
  187. }
  188. }
  189. //*****************************************************************************
  190. //
  191. // This is the code that gets called when the processor receives an unexpected
  192. // interrupt. This simply enters an infinite loop, preserving the system state
  193. // for examination by a debugger.
  194. //
  195. //*****************************************************************************
  196. static void
  197. IntDefaultHandler(void)
  198. {
  199. //
  200. // Go into an infinite loop.
  201. //
  202. while(1)
  203. {
  204. }
  205. }