start_rvds.S 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. ; <<< Use Configuration Wizard in Context Menu >>>
  2. ;******************************************************************************
  3. ;
  4. ; startup_rvmdk.S - Startup code for use with Keil's uVision.
  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 8264 of the EK-LM4F232 Firmware Package.
  23. ;
  24. ;******************************************************************************
  25. ;******************************************************************************
  26. ;
  27. ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
  28. ;
  29. ;******************************************************************************
  30. Stack EQU 0x00000400
  31. ;******************************************************************************
  32. ;
  33. ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
  34. ;
  35. ;******************************************************************************
  36. Heap EQU 0x00000000
  37. ;******************************************************************************
  38. ;
  39. ; Allocate space for the stack.
  40. ;
  41. ;******************************************************************************
  42. AREA STACK, NOINIT, READWRITE, ALIGN=3
  43. StackMem
  44. SPACE Stack
  45. __initial_sp
  46. ;******************************************************************************
  47. ;
  48. ; Allocate space for the heap.
  49. ;
  50. ;******************************************************************************
  51. AREA HEAP, NOINIT, READWRITE, ALIGN=3
  52. __heap_base
  53. HeapMem
  54. SPACE Heap
  55. __heap_limit
  56. IMPORT PendSV_Handler
  57. IMPORT rt_hw_timer_handler
  58. IMPORT rt_hw_uart_isr_1
  59. IMPORT rt_hw_eth_handler
  60. IMPORT HardFault_Handler
  61. ;******************************************************************************
  62. ;
  63. ; Indicate that the code in this file preserves 8-byte alignment of the stack.
  64. ;
  65. ;******************************************************************************
  66. PRESERVE8
  67. ;******************************************************************************
  68. ;
  69. ; Place code into the reset code section.
  70. ;
  71. ;******************************************************************************
  72. AREA RESET, CODE, READONLY
  73. THUMB
  74. ;******************************************************************************
  75. ;
  76. ; The vector table.
  77. ;
  78. ;******************************************************************************
  79. EXPORT __Vectors
  80. __Vectors
  81. DCD StackMem + Stack ; Top of Stack
  82. DCD Reset_Handler ; Reset Handler
  83. DCD NmiSR ; NMI Handler
  84. DCD HardFault_Handler ; Hard Fault Handler
  85. DCD IntDefaultHandler ; The MPU fault handler
  86. DCD IntDefaultHandler ; The bus fault handler
  87. DCD IntDefaultHandler ; The usage fault handler
  88. DCD 0 ; Reserved
  89. DCD 0 ; Reserved
  90. DCD 0 ; Reserved
  91. DCD 0 ; Reserved
  92. DCD IntDefaultHandler ; SVCall handler
  93. DCD IntDefaultHandler ; Debug monitor handler
  94. DCD 0 ; Reserved
  95. DCD PendSV_Handler ; The PendSV handler
  96. DCD rt_hw_timer_handler ; The SysTick handler
  97. DCD IntDefaultHandler ; GPIO Port A
  98. DCD IntDefaultHandler ; GPIO Port B
  99. DCD IntDefaultHandler ; GPIO Port C
  100. DCD IntDefaultHandler ; GPIO Port D
  101. DCD IntDefaultHandler ; GPIO Port E
  102. DCD rt_hw_uart_isr_1 ; UART0 Rx and Tx
  103. DCD IntDefaultHandler ; UART1 Rx and Tx
  104. DCD IntDefaultHandler ; SSI0 Rx and Tx
  105. DCD IntDefaultHandler ; I2C0 Master and Slave
  106. DCD IntDefaultHandler ; PWM Fault
  107. DCD IntDefaultHandler ; PWM Generator 0
  108. DCD IntDefaultHandler ; PWM Generator 1
  109. DCD IntDefaultHandler ; PWM Generator 2
  110. DCD IntDefaultHandler ; Quadrature Encoder 0
  111. DCD IntDefaultHandler ; ADC Sequence 0
  112. DCD IntDefaultHandler ; ADC Sequence 1
  113. DCD IntDefaultHandler ; ADC Sequence 2
  114. DCD IntDefaultHandler ; ADC Sequence 3
  115. DCD IntDefaultHandler ; Watchdog timer
  116. DCD IntDefaultHandler ; Timer 0 subtimer A
  117. DCD IntDefaultHandler ; Timer 0 subtimer B
  118. DCD IntDefaultHandler ; Timer 1 subtimer A
  119. DCD IntDefaultHandler ; Timer 1 subtimer B
  120. DCD IntDefaultHandler ; Timer 2 subtimer A
  121. DCD IntDefaultHandler ; Timer 2 subtimer B
  122. DCD IntDefaultHandler ; Analog Comparator 0
  123. DCD IntDefaultHandler ; Analog Comparator 1
  124. DCD IntDefaultHandler ; Analog Comparator 2
  125. DCD IntDefaultHandler ; System Control (PLL, OSC, BO)
  126. DCD IntDefaultHandler ; FLASH Control
  127. DCD IntDefaultHandler ; GPIO Port F
  128. DCD IntDefaultHandler ; GPIO Port G
  129. DCD IntDefaultHandler ; GPIO Port H
  130. DCD IntDefaultHandler ; UART2 Rx and Tx
  131. DCD IntDefaultHandler ; SSI1 Rx and Tx
  132. DCD IntDefaultHandler ; Timer 3 subtimer A
  133. DCD IntDefaultHandler ; Timer 3 subtimer B
  134. DCD IntDefaultHandler ; I2C1 Master and Slave
  135. DCD IntDefaultHandler ; Quadrature Encoder 1
  136. DCD IntDefaultHandler ; CAN0
  137. DCD IntDefaultHandler ; CAN1
  138. DCD IntDefaultHandler ; CAN2
  139. DCD IntDefaultHandler ; Ethernet
  140. DCD IntDefaultHandler ; Hibernate
  141. DCD IntDefaultHandler ; USB0
  142. DCD IntDefaultHandler ; PWM Generator 3
  143. DCD IntDefaultHandler ; uDMA Software Transfer
  144. DCD IntDefaultHandler ; uDMA Error
  145. DCD IntDefaultHandler ; ADC1 Sequence 0
  146. DCD IntDefaultHandler ; ADC1 Sequence 1
  147. DCD IntDefaultHandler ; ADC1 Sequence 2
  148. DCD IntDefaultHandler ; ADC1 Sequence 3
  149. DCD IntDefaultHandler ; I2S0
  150. DCD IntDefaultHandler ; External Bus Interface 0
  151. DCD IntDefaultHandler ; GPIO Port J
  152. DCD IntDefaultHandler ; GPIO Port K
  153. DCD IntDefaultHandler ; GPIO Port L
  154. DCD IntDefaultHandler ; SSI2 Rx and Tx
  155. DCD IntDefaultHandler ; SSI3 Rx and Tx
  156. DCD IntDefaultHandler ; UART3 Rx and Tx
  157. DCD IntDefaultHandler ; UART4 Rx and Tx
  158. DCD IntDefaultHandler ; UART5 Rx and Tx
  159. DCD IntDefaultHandler ; UART6 Rx and Tx
  160. DCD IntDefaultHandler ; UART7 Rx and Tx
  161. DCD 0 ; Reserved
  162. DCD 0 ; Reserved
  163. DCD 0 ; Reserved
  164. DCD 0 ; Reserved
  165. DCD IntDefaultHandler ; I2C2 Master and Slave
  166. DCD IntDefaultHandler ; I2C3 Master and Slave
  167. DCD IntDefaultHandler ; Timer 4 subtimer A
  168. DCD IntDefaultHandler ; Timer 4 subtimer B
  169. DCD 0 ; Reserved
  170. DCD 0 ; Reserved
  171. DCD 0 ; Reserved
  172. DCD 0 ; Reserved
  173. DCD 0 ; Reserved
  174. DCD 0 ; Reserved
  175. DCD 0 ; Reserved
  176. DCD 0 ; Reserved
  177. DCD 0 ; Reserved
  178. DCD 0 ; Reserved
  179. DCD 0 ; Reserved
  180. DCD 0 ; Reserved
  181. DCD 0 ; Reserved
  182. DCD 0 ; Reserved
  183. DCD 0 ; Reserved
  184. DCD 0 ; Reserved
  185. DCD 0 ; Reserved
  186. DCD 0 ; Reserved
  187. DCD 0 ; Reserved
  188. DCD 0 ; Reserved
  189. DCD IntDefaultHandler ; Timer 5 subtimer A
  190. DCD IntDefaultHandler ; Timer 5 subtimer B
  191. DCD IntDefaultHandler ; Wide Timer 0 subtimer A
  192. DCD IntDefaultHandler ; Wide Timer 0 subtimer B
  193. DCD IntDefaultHandler ; Wide Timer 1 subtimer A
  194. DCD IntDefaultHandler ; Wide Timer 1 subtimer B
  195. DCD IntDefaultHandler ; Wide Timer 2 subtimer A
  196. DCD IntDefaultHandler ; Wide Timer 2 subtimer B
  197. DCD IntDefaultHandler ; Wide Timer 3 subtimer A
  198. DCD IntDefaultHandler ; Wide Timer 3 subtimer B
  199. DCD IntDefaultHandler ; Wide Timer 4 subtimer A
  200. DCD IntDefaultHandler ; Wide Timer 4 subtimer B
  201. DCD IntDefaultHandler ; Wide Timer 5 subtimer A
  202. DCD IntDefaultHandler ; Wide Timer 5 subtimer B
  203. DCD IntDefaultHandler ; FPU
  204. DCD IntDefaultHandler ; PECI 0
  205. DCD IntDefaultHandler ; LPC 0
  206. DCD IntDefaultHandler ; I2C4 Master and Slave
  207. DCD IntDefaultHandler ; I2C5 Master and Slave
  208. DCD IntDefaultHandler ; GPIO Port M
  209. DCD IntDefaultHandler ; GPIO Port N
  210. DCD IntDefaultHandler ; Quadrature Encoder 2
  211. DCD IntDefaultHandler ; Fan 0
  212. DCD 0 ; Reserved
  213. DCD IntDefaultHandler ; GPIO Port P (Summary or P0)
  214. DCD IntDefaultHandler ; GPIO Port P1
  215. DCD IntDefaultHandler ; GPIO Port P2
  216. DCD IntDefaultHandler ; GPIO Port P3
  217. DCD IntDefaultHandler ; GPIO Port P4
  218. DCD IntDefaultHandler ; GPIO Port P5
  219. DCD IntDefaultHandler ; GPIO Port P6
  220. DCD IntDefaultHandler ; GPIO Port P7
  221. DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0)
  222. DCD IntDefaultHandler ; GPIO Port Q1
  223. DCD IntDefaultHandler ; GPIO Port Q2
  224. DCD IntDefaultHandler ; GPIO Port Q3
  225. DCD IntDefaultHandler ; GPIO Port Q4
  226. DCD IntDefaultHandler ; GPIO Port Q5
  227. DCD IntDefaultHandler ; GPIO Port Q6
  228. DCD IntDefaultHandler ; GPIO Port Q7
  229. DCD IntDefaultHandler ; GPIO Port R
  230. DCD IntDefaultHandler ; GPIO Port S
  231. DCD IntDefaultHandler ; PWM 1 Generator 0
  232. DCD IntDefaultHandler ; PWM 1 Generator 1
  233. DCD IntDefaultHandler ; PWM 1 Generator 2
  234. DCD IntDefaultHandler ; PWM 1 Generator 3
  235. DCD IntDefaultHandler ; PWM 1 Fault
  236. ;******************************************************************************
  237. ;
  238. ; This is the code that gets called when the processor first starts execution
  239. ; following a reset event.
  240. ;
  241. ;******************************************************************************
  242. EXPORT Reset_Handler
  243. Reset_Handler
  244. ;
  245. ; Enable the floating-point unit. This must be done here to handle the
  246. ; case where main() uses floating-point and the function prologue saves
  247. ; floating-point registers (which will fault if floating-point is not
  248. ; enabled). Any configuration of the floating-point unit using
  249. ; DriverLib APIs must be done here prior to the floating-point unit
  250. ; being enabled.
  251. ;
  252. ; Note that this does not use DriverLib since it might not be included
  253. ; in this project.
  254. ;
  255. MOVW R0, #0xED88
  256. MOVT R0, #0xE000
  257. LDR R1, [R0]
  258. ORR R1, #0x00F00000
  259. STR R1, [R0]
  260. ;
  261. ; Call the C library enty point that handles startup. This will copy
  262. ; the .data section initializers from flash to SRAM and zero fill the
  263. ; .bss section.
  264. ;
  265. IMPORT __main
  266. B __main
  267. ;******************************************************************************
  268. ;
  269. ; This is the code that gets called when the processor receives a NMI. This
  270. ; simply enters an infinite loop, preserving the system state for examination
  271. ; by a debugger.
  272. ;
  273. ;******************************************************************************
  274. NmiSR
  275. B NmiSR
  276. ;******************************************************************************
  277. ;
  278. ; This is the code that gets called when the processor receives a fault
  279. ; interrupt. This simply enters an infinite loop, preserving the system state
  280. ; for examination by a debugger.
  281. ;
  282. ;******************************************************************************
  283. FaultISR
  284. B FaultISR
  285. ;******************************************************************************
  286. ;
  287. ; This is the code that gets called when the processor receives an unexpected
  288. ; interrupt. This simply enters an infinite loop, preserving the system state
  289. ; for examination by a debugger.
  290. ;
  291. ;******************************************************************************
  292. IntDefaultHandler
  293. B IntDefaultHandler
  294. ;******************************************************************************
  295. ;
  296. ; Make sure the end of this section is aligned.
  297. ;
  298. ;******************************************************************************
  299. ALIGN
  300. ;******************************************************************************
  301. ;
  302. ; Some code in the normal code section for initializing the heap and stack.
  303. ;
  304. ;******************************************************************************
  305. AREA |.text|, CODE, READONLY
  306. ;******************************************************************************
  307. ;
  308. ; The function expected of the C library startup code for defining the stack
  309. ; and heap memory locations. For the C library version of the startup code,
  310. ; provide this function so that the C library initialization code can find out
  311. ; the location of the stack and heap.
  312. ;
  313. ;******************************************************************************
  314. IF :DEF: __MICROLIB
  315. EXPORT __initial_sp
  316. EXPORT __heap_base
  317. EXPORT __heap_limit
  318. ELSE
  319. IMPORT __use_two_region_memory
  320. EXPORT __user_initial_stackheap
  321. __user_initial_stackheap
  322. LDR R0, =HeapMem
  323. LDR R1, =(StackMem + Stack)
  324. LDR R2, =(HeapMem + Heap)
  325. LDR R3, =StackMem
  326. BX LR
  327. ENDIF
  328. ;******************************************************************************
  329. ;
  330. ; Make sure the end of this section is aligned.
  331. ;
  332. ;******************************************************************************
  333. ALIGN
  334. ;******************************************************************************
  335. ;
  336. ; Tell the assembler that we're done.
  337. ;
  338. ;******************************************************************************
  339. END