ses_startup_nrf51.s 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. /***********************************************************************************
  2. * SEGGER Microcontroller GmbH *
  3. * The Embedded Experts *
  4. ***********************************************************************************
  5. * *
  6. * (c) 2014 - 2018 SEGGER Microcontroller GmbH *
  7. * *
  8. * www.segger.com Support: support@segger.com *
  9. * *
  10. ***********************************************************************************
  11. * *
  12. * All rights reserved. *
  13. * *
  14. * Redistribution and use in source and binary forms, with or *
  15. * without modification, are permitted provided that the following *
  16. * conditions are met: *
  17. * *
  18. * - Redistributions of source code must retain the above copyright *
  19. * notice, this list of conditions and the following disclaimer. *
  20. * *
  21. * - Neither the name of SEGGER Microcontroller GmbH *
  22. * nor the names of its contributors may be used to endorse or *
  23. * promote products derived from this software without specific *
  24. * prior written permission. *
  25. * *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
  27. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
  28. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
  29. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
  30. * DISCLAIMED. *
  31. * IN NO EVENT SHALL SEGGER Microcontroller GmbH BE LIABLE FOR *
  32. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
  34. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
  35. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
  36. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
  37. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
  38. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
  39. * DAMAGE. *
  40. * *
  41. ***********************************************************************************/
  42. /************************************************************************************
  43. * Preprocessor Definitions *
  44. * ------------------------ *
  45. * VECTORS_IN_RAM *
  46. * *
  47. * If defined, an area of RAM will large enough to store the vector table *
  48. * will be reserved. *
  49. * *
  50. ************************************************************************************/
  51. .syntax unified
  52. .code 16
  53. .section .init, "ax"
  54. .align 0
  55. /************************************************************************************
  56. * Default Exception Handlers *
  57. ************************************************************************************/
  58. .thumb_func
  59. .weak NMI_Handler
  60. NMI_Handler:
  61. b .
  62. .thumb_func
  63. .weak HardFault_Handler
  64. HardFault_Handler:
  65. b .
  66. .thumb_func
  67. .weak SVC_Handler
  68. SVC_Handler:
  69. b .
  70. .thumb_func
  71. .weak PendSV_Handler
  72. PendSV_Handler:
  73. b .
  74. .thumb_func
  75. .weak SysTick_Handler
  76. SysTick_Handler:
  77. b .
  78. .thumb_func
  79. .weak Dummy_Handler
  80. Dummy_Handler:
  81. b .
  82. /************************************************************************************
  83. * Default Interrupt Handlers *
  84. ************************************************************************************/
  85. .weak POWER_CLOCK_IRQHandler
  86. .thumb_set POWER_CLOCK_IRQHandler, Dummy_Handler
  87. .weak RADIO_IRQHandler
  88. .thumb_set RADIO_IRQHandler, Dummy_Handler
  89. .weak UART0_IRQHandler
  90. .thumb_set UART0_IRQHandler, Dummy_Handler
  91. .weak SPI0_TWI0_IRQHandler
  92. .thumb_set SPI0_TWI0_IRQHandler, Dummy_Handler
  93. .weak SPI1_TWI1_IRQHandler
  94. .thumb_set SPI1_TWI1_IRQHandler, Dummy_Handler
  95. .weak GPIOTE_IRQHandler
  96. .thumb_set GPIOTE_IRQHandler, Dummy_Handler
  97. .weak ADC_IRQHandler
  98. .thumb_set ADC_IRQHandler, Dummy_Handler
  99. .weak TIMER0_IRQHandler
  100. .thumb_set TIMER0_IRQHandler, Dummy_Handler
  101. .weak TIMER1_IRQHandler
  102. .thumb_set TIMER1_IRQHandler, Dummy_Handler
  103. .weak TIMER2_IRQHandler
  104. .thumb_set TIMER2_IRQHandler, Dummy_Handler
  105. .weak RTC0_IRQHandler
  106. .thumb_set RTC0_IRQHandler, Dummy_Handler
  107. .weak TEMP_IRQHandler
  108. .thumb_set TEMP_IRQHandler, Dummy_Handler
  109. .weak RNG_IRQHandler
  110. .thumb_set RNG_IRQHandler, Dummy_Handler
  111. .weak ECB_IRQHandler
  112. .thumb_set ECB_IRQHandler, Dummy_Handler
  113. .weak CCM_AAR_IRQHandler
  114. .thumb_set CCM_AAR_IRQHandler, Dummy_Handler
  115. .weak WDT_IRQHandler
  116. .thumb_set WDT_IRQHandler, Dummy_Handler
  117. .weak RTC1_IRQHandler
  118. .thumb_set RTC1_IRQHandler, Dummy_Handler
  119. .weak QDEC_IRQHandler
  120. .thumb_set QDEC_IRQHandler, Dummy_Handler
  121. .weak LPCOMP_IRQHandler
  122. .thumb_set LPCOMP_IRQHandler, Dummy_Handler
  123. .weak SWI0_IRQHandler
  124. .thumb_set SWI0_IRQHandler, Dummy_Handler
  125. .weak SWI1_IRQHandler
  126. .thumb_set SWI1_IRQHandler, Dummy_Handler
  127. .weak SWI2_IRQHandler
  128. .thumb_set SWI2_IRQHandler, Dummy_Handler
  129. .weak SWI3_IRQHandler
  130. .thumb_set SWI3_IRQHandler, Dummy_Handler
  131. .weak SWI4_IRQHandler
  132. .thumb_set SWI4_IRQHandler, Dummy_Handler
  133. .weak SWI5_IRQHandler
  134. .thumb_set SWI5_IRQHandler, Dummy_Handler
  135. /************************************************************************************
  136. * Reset Handler Extensions *
  137. ************************************************************************************/
  138. .extern Reset_Handler
  139. .global nRFInitialize
  140. .equ NRF_POWER_RAMON_ADDRESS, 0x40000524
  141. .equ NRF_POWER_RAMONB_ADDRESS, 0x40000554
  142. .equ NRF_POWER_RAMONx_RAMxON_ONMODE_Msk, 0x3
  143. .thumb_func
  144. nRFInitialize:
  145. MOVS R1, #NRF_POWER_RAMONx_RAMxON_ONMODE_Msk
  146. LDR R0, =NRF_POWER_RAMON_ADDRESS
  147. LDR R2, [R0]
  148. ORRS R2, R1
  149. STR R2, [R0]
  150. LDR R0, =NRF_POWER_RAMONB_ADDRESS
  151. LDR R2, [R0]
  152. ORRS R2, R1
  153. STR R2, [R0]
  154. bx lr
  155. /************************************************************************************
  156. * Vector Table *
  157. ************************************************************************************/
  158. .section .vectors, "ax"
  159. .align 0
  160. .global _vectors
  161. .extern __stack_end__
  162. _vectors:
  163. .word __stack_end__
  164. .word Reset_Handler
  165. .word NMI_Handler
  166. .word HardFault_Handler
  167. .word 0 /*Reserved */
  168. .word 0 /*Reserved */
  169. .word 0 /*Reserved */
  170. .word 0 /*Reserved */
  171. .word 0 /*Reserved */
  172. .word 0 /*Reserved */
  173. .word 0 /*Reserved */
  174. .word SVC_Handler
  175. .word 0 /*Reserved */
  176. .word 0 /*Reserved */
  177. .word PendSV_Handler
  178. .word SysTick_Handler
  179. /* External Interrupts */
  180. .word POWER_CLOCK_IRQHandler
  181. .word RADIO_IRQHandler
  182. .word UART0_IRQHandler
  183. .word SPI0_TWI0_IRQHandler
  184. .word SPI1_TWI1_IRQHandler
  185. .word 0 /*Reserved */
  186. .word GPIOTE_IRQHandler
  187. .word ADC_IRQHandler
  188. .word TIMER0_IRQHandler
  189. .word TIMER1_IRQHandler
  190. .word TIMER2_IRQHandler
  191. .word RTC0_IRQHandler
  192. .word TEMP_IRQHandler
  193. .word RNG_IRQHandler
  194. .word ECB_IRQHandler
  195. .word CCM_AAR_IRQHandler
  196. .word WDT_IRQHandler
  197. .word RTC1_IRQHandler
  198. .word QDEC_IRQHandler
  199. .word LPCOMP_IRQHandler
  200. .word SWI0_IRQHandler
  201. .word SWI1_IRQHandler
  202. .word SWI2_IRQHandler
  203. .word SWI3_IRQHandler
  204. .word SWI4_IRQHandler
  205. .word SWI5_IRQHandler
  206. .word 0 /*Reserved */
  207. .word 0 /*Reserved */
  208. .word 0 /*Reserved */
  209. .word 0 /*Reserved */
  210. .word 0 /*Reserved */
  211. .word 0 /*Reserved */
  212. _vectors_end:
  213. #ifdef VECTORS_IN_RAM
  214. .section .vectors_ram, "ax"
  215. .align 0
  216. .global _vectors_ram
  217. _vectors_ram:
  218. .space _vectors_end - _vectors, 0
  219. #endif