iar_startup_nrf51.s 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. ;/* Copyright (c) 2012 ARM LIMITED
  2. ;
  3. ; All rights reserved.
  4. ; Redistribution and use in source and binary forms, with or without
  5. ; modification, are permitted provided that the following conditions are met:
  6. ; - Redistributions of source code must retain the above copyright
  7. ; notice, this list of conditions and the following disclaimer.
  8. ; - Redistributions in binary form must reproduce the above copyright
  9. ; notice, this list of conditions and the following disclaimer in the
  10. ; documentation and/or other materials provided with the distribution.
  11. ; - Neither the name of ARM nor the names of its contributors may be used
  12. ; to endorse or promote products derived from this software without
  13. ; specific prior written permission.
  14. ; *
  15. ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  16. ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18. ; ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
  19. ; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  20. ; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  21. ; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  22. ; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  23. ; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  24. ; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  25. ; POSSIBILITY OF SUCH DAMAGE.
  26. ; ---------------------------------------------------------------------------*/
  27. ; The modules in this file are included in the libraries, and may be replaced
  28. ; by any user-defined modules that define the PUBLIC symbol _program_start or
  29. ; a user defined start symbol.
  30. ; To override the cstartup defined in the library, simply add your modified
  31. ; version to the workbench project.
  32. ;
  33. ; The vector table is normally located at address 0.
  34. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
  35. ; The name "__vector_table" has special meaning for C-SPY:
  36. ; it is where the SP start value is found, and the NVIC vector
  37. ; table register (VTOR) is initialized to this address if != 0.
  38. MODULE ?cstartup
  39. ;; Stack size default : Defined in *.icf (linker file). Can be modified inside EW.
  40. ;; Heap size default : Defined in *.icf (linker file). Can be modified inside EW.
  41. ;; Forward declaration of sections.
  42. SECTION CSTACK:DATA:NOROOT(3)
  43. SECTION .intvec:CODE:NOROOT(2)
  44. EXTERN __iar_program_start
  45. EXTERN SystemInit
  46. PUBLIC __vector_table
  47. PUBLIC __Vectors
  48. PUBLIC __Vectors_End
  49. PUBLIC __Vectors_Size
  50. DATA
  51. __vector_table
  52. DCD sfe(CSTACK)
  53. DCD Reset_Handler
  54. DCD NMI_Handler
  55. DCD HardFault_Handler
  56. DCD 0 ; Reserved
  57. DCD 0 ; Reserved
  58. DCD 0 ; Reserved
  59. DCD 0 ; Reserved
  60. DCD 0 ; Reserved
  61. DCD 0 ; Reserved
  62. DCD 0 ; Reserved
  63. DCD SVC_Handler
  64. DCD 0 ; Reserved
  65. DCD 0 ; Reserved
  66. DCD PendSV_Handler
  67. DCD SysTick_Handler
  68. ; External Interrupts
  69. DCD POWER_CLOCK_IRQHandler
  70. DCD RADIO_IRQHandler
  71. DCD UART0_IRQHandler
  72. DCD SPI0_TWI0_IRQHandler
  73. DCD SPI1_TWI1_IRQHandler
  74. DCD 0 ; Reserved
  75. DCD GPIOTE_IRQHandler
  76. DCD ADC_IRQHandler
  77. DCD TIMER0_IRQHandler
  78. DCD TIMER1_IRQHandler
  79. DCD TIMER2_IRQHandler
  80. DCD RTC0_IRQHandler
  81. DCD TEMP_IRQHandler
  82. DCD RNG_IRQHandler
  83. DCD ECB_IRQHandler
  84. DCD CCM_AAR_IRQHandler
  85. DCD WDT_IRQHandler
  86. DCD RTC1_IRQHandler
  87. DCD QDEC_IRQHandler
  88. DCD LPCOMP_IRQHandler
  89. DCD SWI0_IRQHandler
  90. DCD SWI1_IRQHandler
  91. DCD SWI2_IRQHandler
  92. DCD SWI3_IRQHandler
  93. DCD SWI4_IRQHandler
  94. DCD SWI5_IRQHandler
  95. DCD 0 ; Reserved
  96. DCD 0 ; Reserved
  97. DCD 0 ; Reserved
  98. DCD 0 ; Reserved
  99. DCD 0 ; Reserved
  100. DCD 0 ; Reserved
  101. __Vectors_End
  102. __Vectors EQU __vector_table
  103. __Vectors_Size EQU __Vectors_End - __Vectors
  104. NRF_POWER_RAMON_ADDRESS EQU 0x40000524 ; NRF_POWER->RAMON address
  105. NRF_POWER_RAMONB_ADDRESS EQU 0x40000554 ; NRF_POWER->RAMONB address
  106. NRF_POWER_RAMONx_RAMxON_ONMODE_Msk EQU 0x3 ; All RAM blocks on in onmode bit mask
  107. ; Default handlers.
  108. THUMB
  109. PUBWEAK Reset_Handler
  110. SECTION .text:CODE:REORDER(2)
  111. Reset_Handler
  112. MOVS R1, #NRF_POWER_RAMONx_RAMxON_ONMODE_Msk
  113. LDR R0, =NRF_POWER_RAMON_ADDRESS
  114. LDR R2, [R0]
  115. ORRS R2, R2, R1
  116. STR R2, [R0]
  117. LDR R0, =NRF_POWER_RAMONB_ADDRESS
  118. LDR R2, [R0]
  119. ORRS R2, R2, R1
  120. STR R2, [R0]
  121. LDR R0, =SystemInit
  122. BLX R0
  123. LDR R0, =__iar_program_start
  124. BX R0
  125. ; Dummy exception handlers
  126. PUBWEAK NMI_Handler
  127. SECTION .text:CODE:REORDER(1)
  128. NMI_Handler
  129. B .
  130. PUBWEAK HardFault_Handler
  131. SECTION .text:CODE:REORDER(1)
  132. HardFault_Handler
  133. B .
  134. PUBWEAK SVC_Handler
  135. SECTION .text:CODE:REORDER(1)
  136. SVC_Handler
  137. B .
  138. PUBWEAK PendSV_Handler
  139. SECTION .text:CODE:REORDER(1)
  140. PendSV_Handler
  141. B .
  142. PUBWEAK SysTick_Handler
  143. SECTION .text:CODE:REORDER(1)
  144. SysTick_Handler
  145. B .
  146. ; Dummy interrupt handlers
  147. PUBWEAK POWER_CLOCK_IRQHandler
  148. SECTION .text:CODE:REORDER(1)
  149. POWER_CLOCK_IRQHandler
  150. B .
  151. PUBWEAK RADIO_IRQHandler
  152. SECTION .text:CODE:REORDER(1)
  153. RADIO_IRQHandler
  154. B .
  155. PUBWEAK UART0_IRQHandler
  156. SECTION .text:CODE:REORDER(1)
  157. UART0_IRQHandler
  158. B .
  159. PUBWEAK SPI0_TWI0_IRQHandler
  160. SECTION .text:CODE:REORDER(1)
  161. SPI0_TWI0_IRQHandler
  162. B .
  163. PUBWEAK SPI1_TWI1_IRQHandler
  164. SECTION .text:CODE:REORDER(1)
  165. SPI1_TWI1_IRQHandler
  166. B .
  167. PUBWEAK GPIOTE_IRQHandler
  168. SECTION .text:CODE:REORDER(1)
  169. GPIOTE_IRQHandler
  170. B .
  171. PUBWEAK ADC_IRQHandler
  172. SECTION .text:CODE:REORDER(1)
  173. ADC_IRQHandler
  174. B .
  175. PUBWEAK TIMER0_IRQHandler
  176. SECTION .text:CODE:REORDER(1)
  177. TIMER0_IRQHandler
  178. B .
  179. PUBWEAK TIMER1_IRQHandler
  180. SECTION .text:CODE:REORDER(1)
  181. TIMER1_IRQHandler
  182. B .
  183. PUBWEAK TIMER2_IRQHandler
  184. SECTION .text:CODE:REORDER(1)
  185. TIMER2_IRQHandler
  186. B .
  187. PUBWEAK RTC0_IRQHandler
  188. SECTION .text:CODE:REORDER(1)
  189. RTC0_IRQHandler
  190. B .
  191. PUBWEAK TEMP_IRQHandler
  192. SECTION .text:CODE:REORDER(1)
  193. TEMP_IRQHandler
  194. B .
  195. PUBWEAK RNG_IRQHandler
  196. SECTION .text:CODE:REORDER(1)
  197. RNG_IRQHandler
  198. B .
  199. PUBWEAK ECB_IRQHandler
  200. SECTION .text:CODE:REORDER(1)
  201. ECB_IRQHandler
  202. B .
  203. PUBWEAK CCM_AAR_IRQHandler
  204. SECTION .text:CODE:REORDER(1)
  205. CCM_AAR_IRQHandler
  206. B .
  207. PUBWEAK WDT_IRQHandler
  208. SECTION .text:CODE:REORDER(1)
  209. WDT_IRQHandler
  210. B .
  211. PUBWEAK RTC1_IRQHandler
  212. SECTION .text:CODE:REORDER(1)
  213. RTC1_IRQHandler
  214. B .
  215. PUBWEAK QDEC_IRQHandler
  216. SECTION .text:CODE:REORDER(1)
  217. QDEC_IRQHandler
  218. B .
  219. PUBWEAK LPCOMP_IRQHandler
  220. SECTION .text:CODE:REORDER(1)
  221. LPCOMP_IRQHandler
  222. B .
  223. PUBWEAK SWI0_IRQHandler
  224. SECTION .text:CODE:REORDER(1)
  225. SWI0_IRQHandler
  226. B .
  227. PUBWEAK SWI1_IRQHandler
  228. SECTION .text:CODE:REORDER(1)
  229. SWI1_IRQHandler
  230. B .
  231. PUBWEAK SWI2_IRQHandler
  232. SECTION .text:CODE:REORDER(1)
  233. SWI2_IRQHandler
  234. B .
  235. PUBWEAK SWI3_IRQHandler
  236. SECTION .text:CODE:REORDER(1)
  237. SWI3_IRQHandler
  238. B .
  239. PUBWEAK SWI4_IRQHandler
  240. SECTION .text:CODE:REORDER(1)
  241. SWI4_IRQHandler
  242. B .
  243. PUBWEAK SWI5_IRQHandler
  244. SECTION .text:CODE:REORDER(1)
  245. SWI5_IRQHandler
  246. B .
  247. END