iar_startup_nrf51.s 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. ; Copyright (c) 2009-2018 ARM Limited. All rights reserved.
  2. ;
  3. ; SPDX-License-Identifier: Apache-2.0
  4. ;
  5. ; Licensed under the Apache License, Version 2.0 (the License); you may
  6. ; not use this file except in compliance with the License.
  7. ; You may obtain a copy of the License at
  8. ;
  9. ; www.apache.org/licenses/LICENSE-2.0
  10. ;
  11. ; Unless required by applicable law or agreed to in writing, software
  12. ; distributed under the License is distributed on an AS IS BASIS, WITHOUT
  13. ; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ; See the License for the specific language governing permissions and
  15. ; limitations under the License.
  16. ;
  17. ; NOTICE: This file has been modified by Nordic Semiconductor ASA.
  18. ; The modules in this file are included in the libraries, and may be replaced
  19. ; by any user-defined modules that define the PUBLIC symbol _program_start or
  20. ; a user defined start symbol.
  21. ; To override the cstartup defined in the library, simply add your modified
  22. ; version to the workbench project.
  23. ;
  24. ; The vector table is normally located at address 0.
  25. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
  26. ; The name "__vector_table" has special meaning for C-SPY:
  27. ; it is where the SP start value is found, and the NVIC vector
  28. ; table register (VTOR) is initialized to this address if != 0.
  29. MODULE ?cstartup
  30. #if defined(__STARTUP_CONFIG)
  31. #include "startup_config.h"
  32. #ifndef __STARTUP_CONFIG_STACK_ALIGNEMENT
  33. #define __STARTUP_CONFIG_STACK_ALIGNEMENT 3
  34. #endif
  35. SECTION CSTACK:DATA:NOROOT(__STARTUP_CONFIG_STACK_ALIGNEMENT)
  36. DS8 __STARTUP_CONFIG_STACK_SIZE
  37. SECTION HEAP:DATA:NOROOT(3)
  38. DS8 __STARTUP_CONFIG_HEAP_SIZE
  39. #else
  40. ;; Stack size default : Defined in *.icf (linker file). Can be modified inside EW.
  41. ;; Heap size default : Defined in *.icf (linker file). Can be modified inside EW.
  42. ;; Forward declaration of sections.
  43. SECTION CSTACK:DATA:NOROOT(3)
  44. #endif
  45. SECTION .intvec:CODE:NOROOT(2)
  46. EXTERN __iar_program_start
  47. EXTERN SystemInit
  48. PUBLIC __vector_table
  49. PUBLIC __Vectors
  50. PUBLIC __Vectors_End
  51. PUBLIC __Vectors_Size
  52. DATA
  53. __vector_table
  54. DCD sfe(CSTACK)
  55. DCD Reset_Handler
  56. DCD NMI_Handler
  57. DCD HardFault_Handler
  58. DCD 0 ; Reserved
  59. DCD 0 ; Reserved
  60. DCD 0 ; Reserved
  61. DCD 0 ; Reserved
  62. DCD 0 ; Reserved
  63. DCD 0 ; Reserved
  64. DCD 0 ; Reserved
  65. DCD SVC_Handler
  66. DCD 0 ; Reserved
  67. DCD 0 ; Reserved
  68. DCD PendSV_Handler
  69. DCD SysTick_Handler
  70. ; External Interrupts
  71. DCD POWER_CLOCK_IRQHandler
  72. DCD RADIO_IRQHandler
  73. DCD UART0_IRQHandler
  74. DCD SPI0_TWI0_IRQHandler
  75. DCD SPI1_TWI1_IRQHandler
  76. DCD 0 ; Reserved
  77. DCD GPIOTE_IRQHandler
  78. DCD ADC_IRQHandler
  79. DCD TIMER0_IRQHandler
  80. DCD TIMER1_IRQHandler
  81. DCD TIMER2_IRQHandler
  82. DCD RTC0_IRQHandler
  83. DCD TEMP_IRQHandler
  84. DCD RNG_IRQHandler
  85. DCD ECB_IRQHandler
  86. DCD CCM_AAR_IRQHandler
  87. DCD WDT_IRQHandler
  88. DCD RTC1_IRQHandler
  89. DCD QDEC_IRQHandler
  90. DCD LPCOMP_IRQHandler
  91. DCD SWI0_IRQHandler
  92. DCD SWI1_IRQHandler
  93. DCD SWI2_IRQHandler
  94. DCD SWI3_IRQHandler
  95. DCD SWI4_IRQHandler
  96. DCD SWI5_IRQHandler
  97. DCD 0 ; Reserved
  98. DCD 0 ; Reserved
  99. DCD 0 ; Reserved
  100. DCD 0 ; Reserved
  101. DCD 0 ; Reserved
  102. DCD 0 ; Reserved
  103. __Vectors_End
  104. __Vectors EQU __vector_table
  105. __Vectors_Size EQU __Vectors_End - __Vectors
  106. NRF_POWER_RAMON_ADDRESS EQU 0x40000524 ; NRF_POWER->RAMON address
  107. NRF_POWER_RAMONB_ADDRESS EQU 0x40000554 ; NRF_POWER->RAMONB address
  108. NRF_POWER_RAMONx_RAMxON_ONMODE_Msk EQU 0x3 ; All RAM blocks on in onmode bit mask
  109. ; Default handlers.
  110. THUMB
  111. PUBWEAK Reset_Handler
  112. SECTION .text:CODE:REORDER:NOROOT(2)
  113. Reset_Handler
  114. MOVS R1, #NRF_POWER_RAMONx_RAMxON_ONMODE_Msk
  115. LDR R0, =NRF_POWER_RAMON_ADDRESS
  116. LDR R2, [R0]
  117. ORRS R2, R2, R1
  118. STR R2, [R0]
  119. LDR R0, =NRF_POWER_RAMONB_ADDRESS
  120. LDR R2, [R0]
  121. ORRS R2, R2, R1
  122. STR R2, [R0]
  123. LDR R0, =SystemInit
  124. BLX R0
  125. LDR R0, =__iar_program_start
  126. BX R0
  127. ; Dummy exception handlers
  128. PUBWEAK NMI_Handler
  129. SECTION .text:CODE:REORDER:NOROOT(1)
  130. NMI_Handler
  131. B .
  132. PUBWEAK HardFault_Handler
  133. SECTION .text:CODE:REORDER:NOROOT(1)
  134. HardFault_Handler
  135. B .
  136. PUBWEAK SVC_Handler
  137. SECTION .text:CODE:REORDER:NOROOT(1)
  138. SVC_Handler
  139. B .
  140. PUBWEAK PendSV_Handler
  141. SECTION .text:CODE:REORDER:NOROOT(1)
  142. PendSV_Handler
  143. B .
  144. PUBWEAK SysTick_Handler
  145. SECTION .text:CODE:REORDER:NOROOT(1)
  146. SysTick_Handler
  147. B .
  148. ; Dummy interrupt handlers
  149. PUBWEAK POWER_CLOCK_IRQHandler
  150. SECTION .text:CODE:REORDER:NOROOT(1)
  151. POWER_CLOCK_IRQHandler
  152. B .
  153. PUBWEAK RADIO_IRQHandler
  154. SECTION .text:CODE:REORDER:NOROOT(1)
  155. RADIO_IRQHandler
  156. B .
  157. PUBWEAK UART0_IRQHandler
  158. SECTION .text:CODE:REORDER:NOROOT(1)
  159. UART0_IRQHandler
  160. B .
  161. PUBWEAK SPI0_TWI0_IRQHandler
  162. SECTION .text:CODE:REORDER:NOROOT(1)
  163. SPI0_TWI0_IRQHandler
  164. B .
  165. PUBWEAK SPI1_TWI1_IRQHandler
  166. SECTION .text:CODE:REORDER:NOROOT(1)
  167. SPI1_TWI1_IRQHandler
  168. B .
  169. PUBWEAK GPIOTE_IRQHandler
  170. SECTION .text:CODE:REORDER:NOROOT(1)
  171. GPIOTE_IRQHandler
  172. B .
  173. PUBWEAK ADC_IRQHandler
  174. SECTION .text:CODE:REORDER:NOROOT(1)
  175. ADC_IRQHandler
  176. B .
  177. PUBWEAK TIMER0_IRQHandler
  178. SECTION .text:CODE:REORDER:NOROOT(1)
  179. TIMER0_IRQHandler
  180. B .
  181. PUBWEAK TIMER1_IRQHandler
  182. SECTION .text:CODE:REORDER:NOROOT(1)
  183. TIMER1_IRQHandler
  184. B .
  185. PUBWEAK TIMER2_IRQHandler
  186. SECTION .text:CODE:REORDER:NOROOT(1)
  187. TIMER2_IRQHandler
  188. B .
  189. PUBWEAK RTC0_IRQHandler
  190. SECTION .text:CODE:REORDER:NOROOT(1)
  191. RTC0_IRQHandler
  192. B .
  193. PUBWEAK TEMP_IRQHandler
  194. SECTION .text:CODE:REORDER:NOROOT(1)
  195. TEMP_IRQHandler
  196. B .
  197. PUBWEAK RNG_IRQHandler
  198. SECTION .text:CODE:REORDER:NOROOT(1)
  199. RNG_IRQHandler
  200. B .
  201. PUBWEAK ECB_IRQHandler
  202. SECTION .text:CODE:REORDER:NOROOT(1)
  203. ECB_IRQHandler
  204. B .
  205. PUBWEAK CCM_AAR_IRQHandler
  206. SECTION .text:CODE:REORDER:NOROOT(1)
  207. CCM_AAR_IRQHandler
  208. B .
  209. PUBWEAK WDT_IRQHandler
  210. SECTION .text:CODE:REORDER:NOROOT(1)
  211. WDT_IRQHandler
  212. B .
  213. PUBWEAK RTC1_IRQHandler
  214. SECTION .text:CODE:REORDER:NOROOT(1)
  215. RTC1_IRQHandler
  216. B .
  217. PUBWEAK QDEC_IRQHandler
  218. SECTION .text:CODE:REORDER:NOROOT(1)
  219. QDEC_IRQHandler
  220. B .
  221. PUBWEAK LPCOMP_IRQHandler
  222. SECTION .text:CODE:REORDER:NOROOT(1)
  223. LPCOMP_IRQHandler
  224. B .
  225. PUBWEAK SWI0_IRQHandler
  226. SECTION .text:CODE:REORDER:NOROOT(1)
  227. SWI0_IRQHandler
  228. B .
  229. PUBWEAK SWI1_IRQHandler
  230. SECTION .text:CODE:REORDER:NOROOT(1)
  231. SWI1_IRQHandler
  232. B .
  233. PUBWEAK SWI2_IRQHandler
  234. SECTION .text:CODE:REORDER:NOROOT(1)
  235. SWI2_IRQHandler
  236. B .
  237. PUBWEAK SWI3_IRQHandler
  238. SECTION .text:CODE:REORDER:NOROOT(1)
  239. SWI3_IRQHandler
  240. B .
  241. PUBWEAK SWI4_IRQHandler
  242. SECTION .text:CODE:REORDER:NOROOT(1)
  243. SWI4_IRQHandler
  244. B .
  245. PUBWEAK SWI5_IRQHandler
  246. SECTION .text:CODE:REORDER:NOROOT(1)
  247. SWI5_IRQHandler
  248. B .
  249. END