iar_startup_nrf52810.s 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. ; Copyright (c) 2009-2020 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 MemoryManagement_Handler
  59. DCD BusFault_Handler
  60. DCD UsageFault_Handler
  61. DCD 0 ; Reserved
  62. DCD 0 ; Reserved
  63. DCD 0 ; Reserved
  64. DCD 0 ; Reserved
  65. DCD SVC_Handler
  66. DCD DebugMon_Handler
  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 UARTE0_UART0_IRQHandler
  74. DCD TWIM0_TWIS0_TWI0_IRQHandler
  75. DCD SPIM0_SPIS0_SPI0_IRQHandler
  76. DCD 0 ; Reserved
  77. DCD GPIOTE_IRQHandler
  78. DCD SAADC_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 COMP_IRQHandler
  91. DCD SWI0_EGU0_IRQHandler
  92. DCD SWI1_EGU1_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 PWM0_IRQHandler
  100. DCD PDM_IRQHandler
  101. DCD 0 ; Reserved
  102. DCD 0 ; Reserved
  103. DCD 0 ; Reserved
  104. DCD 0 ; Reserved
  105. DCD 0 ; Reserved
  106. DCD 0 ; Reserved
  107. DCD 0 ; Reserved
  108. DCD 0 ; Reserved
  109. DCD 0 ; Reserved
  110. DCD 0 ; Reserved
  111. DCD 0 ; Reserved
  112. DCD 0 ; Reserved
  113. DCD 0 ; Reserved
  114. DCD 0 ; Reserved
  115. DCD 0 ; Reserved
  116. DCD 0 ; Reserved
  117. DCD 0 ; Reserved
  118. DCD 0 ; Reserved
  119. DCD 0 ; Reserved
  120. DCD 0 ; Reserved
  121. DCD 0 ; Reserved
  122. DCD 0 ; Reserved
  123. DCD 0 ; Reserved
  124. DCD 0 ; Reserved
  125. DCD 0 ; Reserved
  126. DCD 0 ; Reserved
  127. DCD 0 ; Reserved
  128. DCD 0 ; Reserved
  129. DCD 0 ; Reserved
  130. DCD 0 ; Reserved
  131. DCD 0 ; Reserved
  132. DCD 0 ; Reserved
  133. DCD 0 ; Reserved
  134. DCD 0 ; Reserved
  135. DCD 0 ; Reserved
  136. DCD 0 ; Reserved
  137. DCD 0 ; Reserved
  138. DCD 0 ; Reserved
  139. DCD 0 ; Reserved
  140. DCD 0 ; Reserved
  141. DCD 0 ; Reserved
  142. DCD 0 ; Reserved
  143. DCD 0 ; Reserved
  144. DCD 0 ; Reserved
  145. DCD 0 ; Reserved
  146. DCD 0 ; Reserved
  147. DCD 0 ; Reserved
  148. DCD 0 ; Reserved
  149. DCD 0 ; Reserved
  150. DCD 0 ; Reserved
  151. DCD 0 ; Reserved
  152. DCD 0 ; Reserved
  153. DCD 0 ; Reserved
  154. DCD 0 ; Reserved
  155. DCD 0 ; Reserved
  156. DCD 0 ; Reserved
  157. DCD 0 ; Reserved
  158. DCD 0 ; Reserved
  159. DCD 0 ; Reserved
  160. DCD 0 ; Reserved
  161. DCD 0 ; Reserved
  162. DCD 0 ; Reserved
  163. DCD 0 ; Reserved
  164. DCD 0 ; Reserved
  165. DCD 0 ; Reserved
  166. DCD 0 ; Reserved
  167. DCD 0 ; Reserved
  168. DCD 0 ; Reserved
  169. DCD 0 ; Reserved
  170. DCD 0 ; Reserved
  171. DCD 0 ; Reserved
  172. DCD 0 ; Reserved
  173. DCD 0 ; Reserved
  174. DCD 0 ; Reserved
  175. DCD 0 ; Reserved
  176. DCD 0 ; Reserved
  177. DCD 0 ; Reserved
  178. DCD 0 ; Reserved
  179. DCD 0 ; Reserved
  180. DCD 0 ; Reserved
  181. DCD 0 ; Reserved
  182. DCD 0 ; Reserved
  183. __Vectors_End
  184. __Vectors EQU __vector_table
  185. __Vectors_Size EQU __Vectors_End - __Vectors
  186. ; Default handlers.
  187. THUMB
  188. PUBWEAK Reset_Handler
  189. SECTION .text:CODE:REORDER:NOROOT(2)
  190. Reset_Handler
  191. /* Workaround for Errata 185 RAM: RAM corruption at extreme corners
  192. * found at the Errata document for your device located
  193. * at https://infocenter.nordicsemi.com/index.jsp */
  194. LDR R0, =0x10000130
  195. LDR R0, [R0]
  196. LDR R1, =0x10000134
  197. LDR R1, [R1]
  198. CMP R0, #0xA
  199. BNE skip
  200. CMP R1, #0x0
  201. BNE skip
  202. LDR R0, =0x40000EE4
  203. LDR R2, [R0]
  204. LDR R3, =0xFFFFFF8F
  205. ANDS R2, R2, R3
  206. LDR R3, =0x00000040
  207. ORRS R2, R2, R3
  208. STR R2, [R0]
  209. skip
  210. LDR R0, =SystemInit
  211. BLX R0
  212. LDR R0, =__iar_program_start
  213. BX R0
  214. ; Dummy exception handlers
  215. PUBWEAK NMI_Handler
  216. SECTION .text:CODE:REORDER:NOROOT(1)
  217. NMI_Handler
  218. B .
  219. PUBWEAK HardFault_Handler
  220. SECTION .text:CODE:REORDER:NOROOT(1)
  221. HardFault_Handler
  222. B .
  223. PUBWEAK MemoryManagement_Handler
  224. SECTION .text:CODE:REORDER:NOROOT(1)
  225. MemoryManagement_Handler
  226. B .
  227. PUBWEAK BusFault_Handler
  228. SECTION .text:CODE:REORDER:NOROOT(1)
  229. BusFault_Handler
  230. B .
  231. PUBWEAK UsageFault_Handler
  232. SECTION .text:CODE:REORDER:NOROOT(1)
  233. UsageFault_Handler
  234. B .
  235. PUBWEAK SVC_Handler
  236. SECTION .text:CODE:REORDER:NOROOT(1)
  237. SVC_Handler
  238. B .
  239. PUBWEAK DebugMon_Handler
  240. SECTION .text:CODE:REORDER:NOROOT(1)
  241. DebugMon_Handler
  242. B .
  243. PUBWEAK PendSV_Handler
  244. SECTION .text:CODE:REORDER:NOROOT(1)
  245. PendSV_Handler
  246. B .
  247. PUBWEAK SysTick_Handler
  248. SECTION .text:CODE:REORDER:NOROOT(1)
  249. SysTick_Handler
  250. B .
  251. ; Dummy interrupt handlers
  252. PUBWEAK POWER_CLOCK_IRQHandler
  253. SECTION .text:CODE:REORDER:NOROOT(1)
  254. POWER_CLOCK_IRQHandler
  255. B .
  256. PUBWEAK RADIO_IRQHandler
  257. SECTION .text:CODE:REORDER:NOROOT(1)
  258. RADIO_IRQHandler
  259. B .
  260. PUBWEAK UARTE0_UART0_IRQHandler
  261. SECTION .text:CODE:REORDER:NOROOT(1)
  262. UARTE0_UART0_IRQHandler
  263. B .
  264. PUBWEAK TWIM0_TWIS0_TWI0_IRQHandler
  265. SECTION .text:CODE:REORDER:NOROOT(1)
  266. TWIM0_TWIS0_TWI0_IRQHandler
  267. B .
  268. PUBWEAK SPIM0_SPIS0_SPI0_IRQHandler
  269. SECTION .text:CODE:REORDER:NOROOT(1)
  270. SPIM0_SPIS0_SPI0_IRQHandler
  271. B .
  272. PUBWEAK GPIOTE_IRQHandler
  273. SECTION .text:CODE:REORDER:NOROOT(1)
  274. GPIOTE_IRQHandler
  275. B .
  276. PUBWEAK SAADC_IRQHandler
  277. SECTION .text:CODE:REORDER:NOROOT(1)
  278. SAADC_IRQHandler
  279. B .
  280. PUBWEAK TIMER0_IRQHandler
  281. SECTION .text:CODE:REORDER:NOROOT(1)
  282. TIMER0_IRQHandler
  283. B .
  284. PUBWEAK TIMER1_IRQHandler
  285. SECTION .text:CODE:REORDER:NOROOT(1)
  286. TIMER1_IRQHandler
  287. B .
  288. PUBWEAK TIMER2_IRQHandler
  289. SECTION .text:CODE:REORDER:NOROOT(1)
  290. TIMER2_IRQHandler
  291. B .
  292. PUBWEAK RTC0_IRQHandler
  293. SECTION .text:CODE:REORDER:NOROOT(1)
  294. RTC0_IRQHandler
  295. B .
  296. PUBWEAK TEMP_IRQHandler
  297. SECTION .text:CODE:REORDER:NOROOT(1)
  298. TEMP_IRQHandler
  299. B .
  300. PUBWEAK RNG_IRQHandler
  301. SECTION .text:CODE:REORDER:NOROOT(1)
  302. RNG_IRQHandler
  303. B .
  304. PUBWEAK ECB_IRQHandler
  305. SECTION .text:CODE:REORDER:NOROOT(1)
  306. ECB_IRQHandler
  307. B .
  308. PUBWEAK CCM_AAR_IRQHandler
  309. SECTION .text:CODE:REORDER:NOROOT(1)
  310. CCM_AAR_IRQHandler
  311. B .
  312. PUBWEAK WDT_IRQHandler
  313. SECTION .text:CODE:REORDER:NOROOT(1)
  314. WDT_IRQHandler
  315. B .
  316. PUBWEAK RTC1_IRQHandler
  317. SECTION .text:CODE:REORDER:NOROOT(1)
  318. RTC1_IRQHandler
  319. B .
  320. PUBWEAK QDEC_IRQHandler
  321. SECTION .text:CODE:REORDER:NOROOT(1)
  322. QDEC_IRQHandler
  323. B .
  324. PUBWEAK COMP_IRQHandler
  325. SECTION .text:CODE:REORDER:NOROOT(1)
  326. COMP_IRQHandler
  327. B .
  328. PUBWEAK SWI0_EGU0_IRQHandler
  329. SECTION .text:CODE:REORDER:NOROOT(1)
  330. SWI0_EGU0_IRQHandler
  331. B .
  332. PUBWEAK SWI1_EGU1_IRQHandler
  333. SECTION .text:CODE:REORDER:NOROOT(1)
  334. SWI1_EGU1_IRQHandler
  335. B .
  336. PUBWEAK SWI2_IRQHandler
  337. SECTION .text:CODE:REORDER:NOROOT(1)
  338. SWI2_IRQHandler
  339. B .
  340. PUBWEAK SWI3_IRQHandler
  341. SECTION .text:CODE:REORDER:NOROOT(1)
  342. SWI3_IRQHandler
  343. B .
  344. PUBWEAK SWI4_IRQHandler
  345. SECTION .text:CODE:REORDER:NOROOT(1)
  346. SWI4_IRQHandler
  347. B .
  348. PUBWEAK SWI5_IRQHandler
  349. SECTION .text:CODE:REORDER:NOROOT(1)
  350. SWI5_IRQHandler
  351. B .
  352. PUBWEAK PWM0_IRQHandler
  353. SECTION .text:CODE:REORDER:NOROOT(1)
  354. PWM0_IRQHandler
  355. B .
  356. PUBWEAK PDM_IRQHandler
  357. SECTION .text:CODE:REORDER:NOROOT(1)
  358. PDM_IRQHandler
  359. B .
  360. END