start_rvds.S 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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. ;******************************************************************************
  64. ;
  65. ; Indicate that the code in this file preserves 8-byte alignment of the stack.
  66. ;
  67. ;******************************************************************************
  68. PRESERVE8
  69. ;******************************************************************************
  70. ;
  71. ; Place code into the reset code section.
  72. ;
  73. ;******************************************************************************
  74. AREA RESET, CODE, READONLY
  75. THUMB
  76. ;******************************************************************************
  77. ;
  78. ; The vector table.
  79. ;
  80. ;******************************************************************************
  81. EXPORT __Vectors
  82. __Vectors
  83. DCD StackMem + Stack ; Top of Stack
  84. DCD Reset_Handler ; Reset Handler
  85. DCD NmiSR ; NMI Handler
  86. DCD FaultISR ; Hard Fault Handler
  87. DCD IntDefaultHandler ; MPU Fault Handler
  88. DCD IntDefaultHandler ; Bus Fault Handler
  89. DCD IntDefaultHandler ; Usage Fault Handler
  90. DCD 0 ; Reserved
  91. DCD 0 ; Reserved
  92. DCD 0 ; Reserved
  93. DCD 0 ; Reserved
  94. DCD IntDefaultHandler ; SVCall Handler
  95. DCD IntDefaultHandler ; Debug Monitor Handler
  96. DCD 0 ; Reserved
  97. DCD rt_hw_pend_sv ; PendSV Handler
  98. DCD rt_hw_timer_handler ; SysTick Handler
  99. DCD IntDefaultHandler ; GPIO Port A
  100. DCD IntDefaultHandler ; GPIO Port B
  101. DCD IntDefaultHandler ; GPIO Port C
  102. DCD IntDefaultHandler ; GPIO Port D
  103. DCD IntDefaultHandler ; GPIO Port E
  104. DCD rt_hw_uart_isr_1 ; UART0
  105. DCD IntDefaultHandler ; UART1
  106. DCD IntDefaultHandler ; SSI
  107. DCD IntDefaultHandler ; I2C
  108. DCD IntDefaultHandler ; PWM Fault
  109. DCD IntDefaultHandler ; PWM Generator 0
  110. DCD IntDefaultHandler ; PWM Generator 1
  111. DCD IntDefaultHandler ; PWM Generator 2
  112. DCD IntDefaultHandler ; Quadrature Encoder
  113. DCD IntDefaultHandler ; ADC Sequence 0
  114. DCD IntDefaultHandler ; ADC Sequence 1
  115. DCD IntDefaultHandler ; ADC Sequence 2
  116. DCD IntDefaultHandler ; ADC Sequence 3
  117. DCD IntDefaultHandler ; Watchdog
  118. DCD IntDefaultHandler ; Timer 0A
  119. DCD IntDefaultHandler ; Timer 0B
  120. DCD IntDefaultHandler ; Timer 1A
  121. DCD IntDefaultHandler ; Timer 1B
  122. DCD IntDefaultHandler ; Timer 2A
  123. DCD IntDefaultHandler ; Timer 2B
  124. DCD IntDefaultHandler ; Comp 0
  125. DCD IntDefaultHandler ; Comp 1
  126. DCD IntDefaultHandler ; Comp 2
  127. DCD IntDefaultHandler ; System Control
  128. DCD IntDefaultHandler ; Flash Control
  129. DCD IntDefaultHandler ; GPIO Port F
  130. DCD IntDefaultHandler ; GPIO Port G
  131. DCD IntDefaultHandler ; GPIO Port H
  132. DCD IntDefaultHandler ; UART2 Rx and Tx
  133. DCD IntDefaultHandler ; SSI1 Rx and Tx
  134. DCD IntDefaultHandler ; Timer 3 subtimer A
  135. DCD IntDefaultHandler ; Timer 3 subtimer B
  136. DCD IntDefaultHandler ; I2C1 Master and Slave
  137. DCD IntDefaultHandler ; Quadrature Encoder 1
  138. DCD IntDefaultHandler ; CAN0
  139. DCD IntDefaultHandler ; CAN1
  140. DCD IntDefaultHandler ; CAN2
  141. DCD IntDefaultHandler ; Ethernet
  142. DCD IntDefaultHandler ; Hibernate
  143. DCD IntDefaultHandler ; USB0
  144. DCD IntDefaultHandler ; PWM Generator 3
  145. DCD IntDefaultHandler ; uDMA Software Transfer
  146. DCD IntDefaultHandler ; uDMA Error
  147. ;******************************************************************************
  148. ;
  149. ; This is the code that gets called when the processor first starts execution
  150. ; following a reset event.
  151. ;
  152. ;******************************************************************************
  153. EXPORT Reset_Handler
  154. Reset_Handler
  155. ;
  156. ; Call the C library enty point that handles startup. This will copy
  157. ; the .data section initializers from flash to SRAM and zero fill the
  158. ; .bss section.
  159. ;
  160. IMPORT __main
  161. B __main
  162. ;******************************************************************************
  163. ;
  164. ; This is the code that gets called when the processor receives a NMI. This
  165. ; simply enters an infinite loop, preserving the system state for examination
  166. ; by a debugger.
  167. ;
  168. ;******************************************************************************
  169. NmiSR
  170. B NmiSR
  171. ;******************************************************************************
  172. ;
  173. ; This is the code that gets called when the processor receives a fault
  174. ; interrupt. This simply enters an infinite loop, preserving the system state
  175. ; for examination by a debugger.
  176. ;
  177. ;******************************************************************************
  178. FaultISR
  179. B FaultISR
  180. ;******************************************************************************
  181. ;
  182. ; This is the code that gets called when the processor receives an unexpected
  183. ; interrupt. This simply enters an infinite loop, preserving the system state
  184. ; for examination by a debugger.
  185. ;
  186. ;******************************************************************************
  187. IntDefaultHandler
  188. B IntDefaultHandler
  189. ;******************************************************************************
  190. ;
  191. ; Make sure the end of this section is aligned.
  192. ;
  193. ;******************************************************************************
  194. ALIGN
  195. ;******************************************************************************
  196. ;
  197. ; Some code in the normal code section for initializing the heap and stack.
  198. ;
  199. ;******************************************************************************
  200. AREA |.text|, CODE, READONLY
  201. ;******************************************************************************
  202. ;
  203. ; The function expected of the C library startup code for defining the stack
  204. ; and heap memory locations. For the C library version of the startup code,
  205. ; provide this function so that the C library initialization code can find out
  206. ; the location of the stack and heap.
  207. ;
  208. ;******************************************************************************
  209. IF :DEF: __MICROLIB
  210. EXPORT __initial_sp
  211. EXPORT __heap_base
  212. EXPORT __heap_limit
  213. ELSE
  214. IMPORT __use_two_region_memory
  215. EXPORT __user_initial_stackheap
  216. __user_initial_stackheap
  217. LDR R0, =HeapMem
  218. LDR R1, =(StackMem + Stack)
  219. LDR R2, =(HeapMem + Heap)
  220. LDR R3, =StackMem
  221. BX LR
  222. ENDIF
  223. ;******************************************************************************
  224. ;
  225. ; Make sure the end of this section is aligned.
  226. ;
  227. ;******************************************************************************
  228. ALIGN
  229. ;******************************************************************************
  230. ;
  231. ; Tell the assembler that we're done.
  232. ;
  233. ;******************************************************************************
  234. END