startup_rvmdk.S 15 KB

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