startup.s 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. Stack_Size EQU 0x004000
  2. AREA STACK, NOINIT, READWRITE, ALIGN=4
  3. Stack_Mem SPACE Stack_Size
  4. __initial_sp EQU 0x10014000
  5. ; <h> Heap Configuration
  6. ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
  7. ; </h>
  8. Heap_Size EQU 0x00000400
  9. AREA HEAP, NOINIT, READWRITE, ALIGN=4
  10. __heap_base
  11. Heap_Mem SPACE Heap_Size
  12. __heap_limit
  13. PRESERVE8
  14. THUMB
  15. ; Vector Table Mapped to Address 0 at Reset
  16. AREA RESET, DATA, READONLY
  17. IMPORT NMI_Handler
  18. IMPORT HardFault_Handler
  19. IMPORT SVC_Handler
  20. IMPORT PendSV_Handler
  21. EXPORT __Vectors
  22. EXPORT __Vectors_End
  23. EXPORT __Vectors_Size
  24. __Vectors DCD __initial_sp ; Top of Stack
  25. DCD Reset_Handler ; Reset Handler
  26. DCD NMI_Handler
  27. DCD HardFault_Handler ; Hard Fault Handler
  28. DCD 0 ;
  29. DCD 0 ;
  30. DCD 0 ;
  31. DCD 0 ;
  32. DCD 0 ;
  33. DCD 0 ;
  34. DCD 0 ;
  35. DCD SVC_Handler ;
  36. DCD 0 ;
  37. DCD 0 ;
  38. DCD PendSV_Handler ;
  39. DCD SysTick_Handler ;
  40. DCD USB_IRQHandler ;
  41. DCD IIC_IRQHandler ;
  42. DCD QSPI_IRQHandler ;
  43. DCD SPI_IRQHandler ;
  44. DCD UART_IRQHandler ;
  45. DCD UARTB_IRQHandler ;
  46. DCD ADC_IRQHandler ;
  47. DCD IIS_IRQHandler ;
  48. DCD BT_IRQHandler ;
  49. DCD GPIO0_IRQHandler ;
  50. DCD GPIO1_IRQHandler ;
  51. DCD 0 ;
  52. DCD 0 ;
  53. DCD 0 ;
  54. DCD 0 ;
  55. DCD 0 ;
  56. DCD 0 ;
  57. DCD GPIO8_IRQHandler ;
  58. DCD GPIO9_IRQHandler ;
  59. DCD GPIO10_IRQHandler ;
  60. DCD GPIO11_IRQHandler ;
  61. DCD GPIO12_IRQHandler ;
  62. DCD GPIO13_IRQHandler ;
  63. DCD GPIO14_IRQHandler ;
  64. DCD GPIO15_IRQHandler ;
  65. DCD GPIO16_IRQHandler ;
  66. DCD GPIO17_IRQHandler ;
  67. DCD GPIO18_IRQHandler ;
  68. DCD GPIO19_IRQHandler ;
  69. DCD GPIO20_IRQHandler ;
  70. DCD GPIO21_IRQHandler ;
  71. DCD GPIO22_IRQHandler ;
  72. __Vectors_End
  73. __Vectors_Size EQU __Vectors_End - __Vectors
  74. AREA |.text|, CODE, READONLY ,ALIGN=4
  75. ; Reset Handler
  76. Reset_Handler PROC
  77. EXPORT Reset_Handler [WEAK]
  78. IMPORT __main
  79. LDR R0, =__main
  80. BX R0
  81. ENDP
  82. Default_Handler PROC
  83. ; ToDo: Add here the export definition for the device specific external interrupts handler
  84. EXPORT SysTick_Handler [WEAK]
  85. EXPORT USB_IRQHandler [WEAK]
  86. EXPORT IIC_IRQHandler [WEAK]
  87. EXPORT QSPI_IRQHandler [WEAK]
  88. EXPORT SPI_IRQHandler [WEAK]
  89. EXPORT UART_IRQHandler [WEAK]
  90. EXPORT UARTB_IRQHandler [WEAK]
  91. EXPORT ADC_IRQHandler [WEAK]
  92. EXPORT IIS_IRQHandler [WEAK]
  93. EXPORT BT_IRQHandler [WEAK]
  94. EXPORT GPIO0_IRQHandler [WEAK]
  95. EXPORT GPIO1_IRQHandler [WEAK]
  96. EXPORT GPIO8_IRQHandler [WEAK]
  97. EXPORT GPIO9_IRQHandler [WEAK]
  98. EXPORT GPIO10_IRQHandler [WEAK]
  99. EXPORT GPIO11_IRQHandler [WEAK]
  100. EXPORT GPIO12_IRQHandler [WEAK]
  101. EXPORT GPIO13_IRQHandler [WEAK]
  102. EXPORT GPIO14_IRQHandler [WEAK]
  103. EXPORT GPIO15_IRQHandler [WEAK]
  104. EXPORT GPIO16_IRQHandler [WEAK]
  105. EXPORT GPIO17_IRQHandler [WEAK]
  106. EXPORT GPIO18_IRQHandler [WEAK]
  107. EXPORT GPIO19_IRQHandler [WEAK]
  108. EXPORT GPIO20_IRQHandler [WEAK]
  109. EXPORT GPIO21_IRQHandler [WEAK]
  110. EXPORT GPIO22_IRQHandler [WEAK]
  111. ; ToDo: Add here the names for the device specific external interrupts handler
  112. SysTick_Handler
  113. USB_IRQHandler
  114. IIC_IRQHandler
  115. QSPI_IRQHandler
  116. SPI_IRQHandler
  117. UART_IRQHandler
  118. UARTB_IRQHandler
  119. ADC_IRQHandler
  120. IIS_IRQHandler
  121. BT_IRQHandler
  122. GPIO0_IRQHandler
  123. GPIO1_IRQHandler
  124. GPIO8_IRQHandler
  125. GPIO9_IRQHandler
  126. GPIO10_IRQHandler
  127. GPIO11_IRQHandler
  128. GPIO12_IRQHandler
  129. GPIO13_IRQHandler
  130. GPIO14_IRQHandler
  131. GPIO15_IRQHandler
  132. GPIO16_IRQHandler
  133. GPIO17_IRQHandler
  134. GPIO18_IRQHandler
  135. GPIO19_IRQHandler
  136. GPIO20_IRQHandler
  137. GPIO21_IRQHandler
  138. GPIO22_IRQHandler
  139. B .
  140. ENDP
  141. ALIGN
  142. ; User Initial Stack & Heap
  143. IF :DEF:__MICROLIB
  144. EXPORT __initial_sp
  145. EXPORT __heap_base
  146. EXPORT __heap_limit
  147. ELSE
  148. IMPORT __use_two_region_memory
  149. EXPORT __user_initial_stackheap
  150. __user_initial_stackheap PROC
  151. LDR R0, = Heap_Mem
  152. LDR R1, =(Stack_Mem + Stack_Size)
  153. LDR R2, = (Heap_Mem + Heap_Size)
  154. LDR R3, = Stack_Mem
  155. BX LR
  156. ENDP
  157. ALIGN
  158. ENDIF
  159. END