PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/system/IAR/msp432_startup_ewarm.c

https://gitlab.com/21mece13/FreeRTOS
C | 300 lines | 133 code | 13 blank | 154 comment | 0 complexity | dcb7bfb9ad505ee6e9f4e51fcc2fa69f MD5 | raw file
  1. /*
  2. * -------------------------------------------
  3. * MSP432 DriverLib - v3_10_00_09
  4. * -------------------------------------------
  5. *
  6. * --COPYRIGHT--,BSD,BSD
  7. * Copyright (c) 2014, Texas Instruments Incorporated
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. *
  14. * * Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions and the following disclaimer.
  16. *
  17. * * Redistributions in binary form must reproduce the above copyright
  18. * notice, this list of conditions and the following disclaimer in the
  19. * documentation and/or other materials provided with the distribution.
  20. *
  21. * * Neither the name of Texas Instruments Incorporated nor the names of
  22. * its contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  26. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  27. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  28. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  29. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  30. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  31. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  32. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  33. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  34. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  35. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36. * --/COPYRIGHT--*/
  37. //*****************************************************************************
  38. //
  39. // Copyright (C) 2012 - 2015 Texas Instruments Incorporated - http://www.ti.com/
  40. //
  41. // Redistribution and use in source and binary forms, with or without
  42. // modification, are permitted provided that the following conditions
  43. // are met:
  44. //
  45. // Redistributions of source code must retain the above copyright
  46. // notice, this list of conditions and the following disclaimer.
  47. //
  48. // Redistributions in binary form must reproduce the above copyright
  49. // notice, this list of conditions and the following disclaimer in the
  50. // documentation and/or other materials provided with the
  51. // distribution.
  52. //
  53. // Neither the name of Texas Instruments Incorporated nor the names of
  54. // its contributors may be used to endorse or promote products derived
  55. // from this software without specific prior written permission.
  56. //
  57. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  58. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  59. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  60. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  61. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  62. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  63. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  64. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  65. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  66. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  67. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  68. //
  69. // MSP432 Startup Code for IAR Embedded Workbench for ARM
  70. //
  71. //****************************************************************************
  72. #include <stdint.h>
  73. //*****************************************************************************
  74. //
  75. // Enable the IAR extensions for this source file.
  76. //
  77. //*****************************************************************************
  78. #pragma language=extended
  79. //*****************************************************************************
  80. //
  81. // Forward declaration of the default fault handlers.
  82. //
  83. //*****************************************************************************
  84. void ResetISR(void);
  85. static void NmiSR(void);
  86. static void FaultISR(void);
  87. static void IntDefaultHandler(void);
  88. //*****************************************************************************
  89. //
  90. // External declaration for the interrupt handler used by the application.
  91. //
  92. //*****************************************************************************
  93. extern void SysTick_Handler( void );
  94. extern void PendSV_Handler( void );
  95. extern void SVC_Handler( void );
  96. extern void vUART_Handler( void );
  97. extern void vT32_0_Handler( void );
  98. extern void vT32_1_Handler( void );
  99. extern void PORT1_IRQHandler( void );
  100. //*****************************************************************************
  101. //
  102. // The entry point for the application startup code.
  103. //
  104. //*****************************************************************************
  105. extern void __iar_program_start(void);
  106. //*****************************************************************************
  107. //
  108. // Reserve space for the system stack.
  109. //
  110. //*****************************************************************************
  111. static uint32_t systemStack[128] @ ".noinit";
  112. //*****************************************************************************
  113. //
  114. // A union that describes the entries of the vector table. The union is needed
  115. // since the first entry is the stack pointer and the remainder are function
  116. // pointers.
  117. //
  118. //*****************************************************************************
  119. typedef union
  120. {
  121. void (*handler)(void);
  122. uint32_t ptr;
  123. }
  124. uVectorEntry;
  125. //*****************************************************************************
  126. //
  127. // The vector table. Note that the proper constructs must be placed on this to
  128. // ensure that it ends up at physical address 0x0000.0000.
  129. //
  130. //*****************************************************************************
  131. __root const uVectorEntry __vector_table[] @ ".intvec" =
  132. {
  133. { .ptr = (uint32_t)systemStack + sizeof(systemStack) },
  134. // The initial stack pointer
  135. ResetISR, // The reset handler
  136. NmiSR, // The NMI handler
  137. FaultISR, // The hard fault handler
  138. IntDefaultHandler, // The MPU fault handler
  139. IntDefaultHandler, // The bus fault handler
  140. IntDefaultHandler, // The usage fault handler
  141. 0, // Reserved
  142. 0, // Reserved
  143. 0, // Reserved
  144. 0, // Reserved
  145. SVC_Handler, // SVCall handler
  146. IntDefaultHandler, // Debug monitor handler
  147. 0, // Reserved
  148. PendSV_Handler, // The PendSV handler
  149. SysTick_Handler, // The SysTick handler
  150. IntDefaultHandler, // PSS ISR
  151. IntDefaultHandler, // CS ISR
  152. IntDefaultHandler, // PCM ISR
  153. IntDefaultHandler, // WDT ISR
  154. IntDefaultHandler, // FPU ISR
  155. IntDefaultHandler, // FLCTL ISR
  156. IntDefaultHandler, // COMP_E0_MODULE ISR
  157. IntDefaultHandler, // COMP_E1_MODULE ISR
  158. IntDefaultHandler, // TA0_0 ISR
  159. IntDefaultHandler, // TA0_N ISR
  160. IntDefaultHandler, // TA1_0 ISR
  161. IntDefaultHandler, // TA1_N ISR
  162. IntDefaultHandler, // TA2_0 ISR
  163. IntDefaultHandler, // TA2_N ISR
  164. IntDefaultHandler, // TA3_0 ISR
  165. IntDefaultHandler, // TA3_N ISR
  166. vUART_Handler, // EUSCIA0 ISR
  167. IntDefaultHandler, // EUSCIA1 ISR
  168. IntDefaultHandler, // EUSCIA2 ISR
  169. IntDefaultHandler, // EUSCIA3 ISR
  170. IntDefaultHandler, // EUSCIB0 ISR
  171. IntDefaultHandler, // EUSCIB1 ISR
  172. IntDefaultHandler, // EUSCIB2 ISR
  173. IntDefaultHandler, // EUSCIB3 ISR
  174. IntDefaultHandler, // ADC12 ISR
  175. vT32_0_Handler, // T32_INT1 ISR
  176. vT32_1_Handler, // T32_INT2 ISR
  177. IntDefaultHandler, // T32_INTC ISR
  178. IntDefaultHandler, // AES ISR
  179. IntDefaultHandler, // RTC ISR
  180. IntDefaultHandler, // DMA_ERR ISR
  181. IntDefaultHandler, // DMA_INT3 ISR
  182. IntDefaultHandler, // DMA_INT2 ISR
  183. IntDefaultHandler, // DMA_INT1 ISR
  184. IntDefaultHandler, // DMA_INT0 ISR
  185. PORT1_IRQHandler, // PORT1 ISR
  186. IntDefaultHandler, // PORT2 ISR
  187. IntDefaultHandler, // PORT3 ISR
  188. IntDefaultHandler, // PORT4 ISR
  189. IntDefaultHandler, // PORT5 ISR
  190. IntDefaultHandler, // PORT6 ISR
  191. IntDefaultHandler, // Reserved 41
  192. IntDefaultHandler, // Reserved 42
  193. IntDefaultHandler, // Reserved 43
  194. IntDefaultHandler, // Reserved 44
  195. IntDefaultHandler, // Reserved 45
  196. IntDefaultHandler, // Reserved 46
  197. IntDefaultHandler, // Reserved 47
  198. IntDefaultHandler, // Reserved 48
  199. IntDefaultHandler, // Reserved 49
  200. IntDefaultHandler, // Reserved 50
  201. IntDefaultHandler, // Reserved 51
  202. IntDefaultHandler, // Reserved 52
  203. IntDefaultHandler, // Reserved 53
  204. IntDefaultHandler, // Reserved 54
  205. IntDefaultHandler, // Reserved 55
  206. IntDefaultHandler, // Reserved 56
  207. IntDefaultHandler, // Reserved 57
  208. IntDefaultHandler, // Reserved 58
  209. IntDefaultHandler, // Reserved 59
  210. IntDefaultHandler, // Reserved 60
  211. IntDefaultHandler, // Reserved 61
  212. IntDefaultHandler, // Reserved 62
  213. IntDefaultHandler, // Reserved 63
  214. IntDefaultHandler // Reserved 64
  215. };
  216. //*****************************************************************************
  217. //
  218. // This is the code that gets called when the processor first starts execution
  219. // following a reset event. Only the absolutely necessary set is performed,
  220. // after which the application supplied entry() routine is called. Any fancy
  221. // actions (such as making decisions based on the reset cause register, and
  222. // resetting the bits in that register) are left solely in the hands of the
  223. // application.
  224. //
  225. //*****************************************************************************
  226. void
  227. ResetISR(void)
  228. {
  229. void SystemInit(void);
  230. // Initialize the device
  231. SystemInit();
  232. //
  233. // Call the application's entry point.
  234. //
  235. __iar_program_start();
  236. }
  237. //*****************************************************************************
  238. //
  239. // This is the code that gets called when the processor receives a NMI. This
  240. // simply enters an infinite loop, preserving the system state for examination
  241. // by a debugger.
  242. //
  243. //*****************************************************************************
  244. static void
  245. NmiSR(void)
  246. {
  247. //
  248. // Enter an infinite loop.
  249. //
  250. while(1)
  251. {
  252. }
  253. }
  254. //*****************************************************************************
  255. //
  256. // This is the code that gets called when the processor receives a fault
  257. // interrupt. This simply enters an infinite loop, preserving the system state
  258. // for examination by a debugger.
  259. //
  260. //*****************************************************************************
  261. static void
  262. FaultISR(void)
  263. {
  264. //
  265. // Enter an infinite loop.
  266. //
  267. while(1)
  268. {
  269. }
  270. }
  271. //*****************************************************************************
  272. //
  273. // This is the code that gets called when the processor receives an unexpected
  274. // interrupt. This simply enters an infinite loop, preserving the system state
  275. // for examination by a debugger.
  276. //
  277. //*****************************************************************************
  278. static void
  279. IntDefaultHandler(void)
  280. {
  281. //
  282. // Go into an infinite loop.
  283. //
  284. while(1)
  285. {
  286. }
  287. }