start_rvds.S 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. ; <<< Use Configuration Wizard in Context Menu >>>
  2. ;******************************************************************************
  3. ;
  4. ; Startup.s - Startup code for Stellaris.
  5. ;
  6. ; Copyright (c) 2006-2008 Luminary Micro, Inc. All rights reserved.
  7. ;
  8. ; Software License Agreement
  9. ;
  10. ; Luminary Micro, Inc. (LMI) is supplying this software for use solely and
  11. ; exclusively on LMI's microcontroller products.
  12. ;
  13. ; The software is owned by LMI and/or its suppliers, and is protected under
  14. ; applicable copyright laws. All rights are reserved. You may not combine
  15. ; this software with "viral" open-source software in order to form a larger
  16. ; program. Any use in violation of the foregoing restrictions may subject
  17. ; the user to criminal sanctions under applicable laws, as well as to civil
  18. ; liability for the breach of the terms and conditions of this license.
  19. ;
  20. ; THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
  21. ; OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
  22. ; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
  23. ; LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
  24. ; CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
  25. ;
  26. ; This is part of revision 2523 of the Stellaris Peripheral Driver Library.
  27. ;
  28. ;******************************************************************************
  29. ;******************************************************************************
  30. ;
  31. ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
  32. ;
  33. ;******************************************************************************
  34. Stack EQU 0x00000100
  35. ;******************************************************************************
  36. ;
  37. ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
  38. ;
  39. ;******************************************************************************
  40. Heap EQU 0x00000000
  41. ;******************************************************************************
  42. ;
  43. ; Allocate space for the stack.
  44. ;
  45. ;******************************************************************************
  46. AREA STACK, NOINIT, READWRITE, ALIGN=3
  47. StackMem
  48. SPACE Stack
  49. __initial_sp
  50. ;******************************************************************************
  51. ;
  52. ; Allocate space for the heap.
  53. ;
  54. ;******************************************************************************
  55. AREA HEAP, NOINIT, READWRITE, ALIGN=3
  56. __heap_base
  57. HeapMem
  58. SPACE Heap
  59. __heap_limit
  60. IMPORT rt_hw_pend_sv
  61. IMPORT rt_hw_timer_handler
  62. IMPORT rt_hw_uart_isr_1
  63. IMPORT rt_hw_eth_handler
  64. IMPORT rt_hw_hard_fault
  65. ;******************************************************************************
  66. ;
  67. ; Indicate that the code in this file preserves 8-byte alignment of the stack.
  68. ;
  69. ;******************************************************************************
  70. PRESERVE8
  71. ;******************************************************************************
  72. ;
  73. ; Place code into the reset code section.
  74. ;
  75. ;******************************************************************************
  76. AREA RESET, CODE, READONLY
  77. THUMB
  78. ;******************************************************************************
  79. ;
  80. ; The vector table.
  81. ;
  82. ;******************************************************************************
  83. EXPORT __Vectors
  84. __Vectors
  85. DCD StackMem + Stack ; Top of Stack
  86. DCD Reset_Handler ; Reset Handler
  87. DCD NmiSR ; NMI Handler
  88. DCD rt_hw_hard_fault ; Hard Fault Handler
  89. DCD IntDefaultHandler ; MPU Fault Handler
  90. DCD IntDefaultHandler ; Bus Fault Handler
  91. DCD IntDefaultHandler ; Usage Fault Handler
  92. DCD 0 ; Reserved
  93. DCD 0 ; Reserved
  94. DCD 0 ; Reserved
  95. DCD 0 ; Reserved
  96. DCD IntDefaultHandler ; SVCall Handler
  97. DCD IntDefaultHandler ; Debug Monitor Handler
  98. DCD 0 ; Reserved
  99. DCD rt_hw_pend_sv ; PendSV Handler
  100. DCD rt_hw_timer_handler ; SysTick Handler
  101. DCD IntDefaultHandler ; GPIO Port A
  102. DCD IntDefaultHandler ; GPIO Port B
  103. DCD IntDefaultHandler ; GPIO Port C
  104. DCD IntDefaultHandler ; GPIO Port D
  105. DCD IntDefaultHandler ; GPIO Port E
  106. DCD rt_hw_uart_isr_1 ; UART0
  107. DCD IntDefaultHandler ; UART1
  108. DCD IntDefaultHandler ; SSI
  109. DCD IntDefaultHandler ; I2C
  110. DCD IntDefaultHandler ; PWM Fault
  111. DCD IntDefaultHandler ; PWM Generator 0
  112. DCD IntDefaultHandler ; PWM Generator 1
  113. DCD IntDefaultHandler ; PWM Generator 2
  114. DCD IntDefaultHandler ; Quadrature Encoder
  115. DCD IntDefaultHandler ; ADC Sequence 0
  116. DCD IntDefaultHandler ; ADC Sequence 1
  117. DCD IntDefaultHandler ; ADC Sequence 2
  118. DCD IntDefaultHandler ; ADC Sequence 3
  119. DCD IntDefaultHandler ; Watchdog
  120. DCD IntDefaultHandler ; Timer 0A
  121. DCD IntDefaultHandler ; Timer 0B
  122. DCD IntDefaultHandler ; Timer 1A
  123. DCD IntDefaultHandler ; Timer 1B
  124. DCD IntDefaultHandler ; Timer 2A
  125. DCD IntDefaultHandler ; Timer 2B
  126. DCD IntDefaultHandler ; Comp 0
  127. DCD IntDefaultHandler ; Comp 1
  128. DCD IntDefaultHandler ; Comp 2
  129. DCD IntDefaultHandler ; System Control
  130. DCD IntDefaultHandler ; Flash Control
  131. DCD IntDefaultHandler ; GPIO Port F
  132. DCD IntDefaultHandler ; GPIO Port G
  133. DCD IntDefaultHandler ; GPIO Port H
  134. DCD IntDefaultHandler ; UART2 Rx and Tx
  135. DCD IntDefaultHandler ; SSI1 Rx and Tx
  136. DCD IntDefaultHandler ; Timer 3 subtimer A
  137. DCD IntDefaultHandler ; Timer 3 subtimer B
  138. DCD IntDefaultHandler ; I2C1 Master and Slave
  139. DCD IntDefaultHandler ; Quadrature Encoder 1
  140. DCD IntDefaultHandler ; CAN0
  141. DCD IntDefaultHandler ; CAN1
  142. DCD IntDefaultHandler ; CAN2
  143. DCD rt_hw_eth_handler ; Ethernet
  144. DCD IntDefaultHandler ; Hibernate
  145. DCD IntDefaultHandler ; USB0
  146. DCD IntDefaultHandler ; PWM Generator 3
  147. DCD IntDefaultHandler ; uDMA Software Transfer
  148. DCD IntDefaultHandler ; uDMA Error
  149. ;******************************************************************************
  150. ;
  151. ; This is the code that gets called when the processor first starts execution
  152. ; following a reset event.
  153. ;
  154. ;******************************************************************************
  155. EXPORT Reset_Handler
  156. Reset_Handler
  157. ;
  158. ; Call the C library enty point that handles startup. This will copy
  159. ; the .data section initializers from flash to SRAM and zero fill the
  160. ; .bss section.
  161. ;
  162. IMPORT __main
  163. B __main
  164. ;******************************************************************************
  165. ;
  166. ; This is the code that gets called when the processor receives a NMI. This
  167. ; simply enters an infinite loop, preserving the system state for examination
  168. ; by a debugger.
  169. ;
  170. ;******************************************************************************
  171. NmiSR
  172. B NmiSR
  173. ;******************************************************************************
  174. ;
  175. ; This is the code that gets called when the processor receives a fault
  176. ; interrupt. This simply enters an infinite loop, preserving the system state
  177. ; for examination by a debugger.
  178. ;
  179. ;******************************************************************************
  180. FaultISR
  181. B FaultISR
  182. ;******************************************************************************
  183. ;
  184. ; This is the code that gets called when the processor receives an unexpected
  185. ; interrupt. This simply enters an infinite loop, preserving the system state
  186. ; for examination by a debugger.
  187. ;
  188. ;******************************************************************************
  189. IntDefaultHandler
  190. B IntDefaultHandler
  191. ;******************************************************************************
  192. ;
  193. ; Make sure the end of this section is aligned.
  194. ;
  195. ;******************************************************************************
  196. ALIGN
  197. ;******************************************************************************
  198. ;
  199. ; Some code in the normal code section for initializing the heap and stack.
  200. ;
  201. ;******************************************************************************
  202. AREA |.text|, CODE, READONLY
  203. ;******************************************************************************
  204. ;
  205. ; The function expected of the C library startup code for defining the stack
  206. ; and heap memory locations. For the C library version of the startup code,
  207. ; provide this function so that the C library initialization code can find out
  208. ; the location of the stack and heap.
  209. ;
  210. ;******************************************************************************
  211. IF :DEF: __MICROLIB
  212. EXPORT __initial_sp
  213. EXPORT __heap_base
  214. EXPORT __heap_limit
  215. ELSE
  216. IMPORT __use_two_region_memory
  217. EXPORT __user_initial_stackheap
  218. __user_initial_stackheap
  219. LDR R0, =HeapMem
  220. LDR R1, =(StackMem + Stack)
  221. LDR R2, =(HeapMem + Heap)
  222. LDR R3, =StackMem
  223. BX LR
  224. ENDIF
  225. ;******************************************************************************
  226. ;
  227. ; Make sure the end of this section is aligned.
  228. ;
  229. ;******************************************************************************
  230. ALIGN
  231. ;******************************************************************************
  232. ;
  233. ; Tell the assembler that we're done.
  234. ;
  235. ;******************************************************************************
  236. END