context_rvds.lst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. ARM Macro Assembler Page 1
  2. 1 00000000 ;/*
  3. 2 00000000 ; * Copyright (c) 2006-2018, RT-Thread Development Team
  4. 3 00000000 ; *
  5. 4 00000000 ; * SPDX-License-Identifier: Apache-2.0
  6. 5 00000000 ; *
  7. 6 00000000 ; * Change Logs:
  8. 7 00000000 ; * Date Author Notes
  9. 8 00000000 ; * 2009-01-17 Bernard first version
  10. 9 00000000 ; * 2013-06-18 aozima add restore MSP feature.
  11. 10 00000000 ; * 2013-07-09 aozima enhancement hard fault e
  12. xception handler.
  13. 11 00000000 ; */
  14. 12 00000000
  15. 13 00000000 ;/**
  16. 14 00000000 ; * @addtogroup CORTEX-M3
  17. 15 00000000 ; */
  18. 16 00000000 ;/*@{*/
  19. 17 00000000
  20. 18 00000000 E000ED08
  21. SCB_VTOR
  22. EQU 0xE000ED08 ; Vector Table Offs
  23. et Register
  24. 19 00000000 E000ED04
  25. NVIC_INT_CTRL
  26. EQU 0xE000ED04 ; interrupt control
  27. state register
  28. 20 00000000 E000ED20
  29. NVIC_SYSPRI2
  30. EQU 0xE000ED20 ; system priority r
  31. egister (2)
  32. 21 00000000 FFFF0000
  33. NVIC_PENDSV_PRI
  34. EQU 0xFFFF0000 ; PendSV and SysTic
  35. k priority value (l
  36. owest)
  37. 22 00000000 10000000
  38. NVIC_PENDSVSET
  39. EQU 0x10000000 ; value to trigger
  40. PendSV exception
  41. 23 00000000
  42. 24 00000000 AREA |.text|, CODE, READONLY, ALIGN=
  43. 2
  44. 25 00000000 THUMB
  45. 26 00000000 REQUIRE8
  46. 27 00000000 PRESERVE8
  47. 28 00000000
  48. 29 00000000 IMPORT rt_thread_switch_interrupt_flag
  49. 30 00000000 IMPORT rt_interrupt_from_thread
  50. 31 00000000 IMPORT rt_interrupt_to_thread
  51. 32 00000000
  52. 33 00000000 ;/*
  53. 34 00000000 ; * rt_base_t rt_hw_interrupt_disable();
  54. 35 00000000 ; */
  55. 36 00000000 rt_hw_interrupt_disable
  56. PROC
  57. 37 00000000 EXPORT rt_hw_interrupt_disable
  58. 38 00000000 F3EF 8010 MRS r0, PRIMASK
  59. 39 00000004 B672 CPSID I
  60. ARM Macro Assembler Page 2
  61. 40 00000006 4770 BX LR
  62. 41 00000008 ENDP
  63. 42 00000008
  64. 43 00000008 ;/*
  65. 44 00000008 ; * void rt_hw_interrupt_enable(rt_base_t level);
  66. 45 00000008 ; */
  67. 46 00000008 rt_hw_interrupt_enable
  68. PROC
  69. 47 00000008 EXPORT rt_hw_interrupt_enable
  70. 48 00000008 F380 8810 MSR PRIMASK, r0
  71. 49 0000000C 4770 BX LR
  72. 50 0000000E ENDP
  73. 51 0000000E
  74. 52 0000000E ;/*
  75. 53 0000000E ; * void rt_hw_context_switch(rt_uint32 from, rt_uint32
  76. to);
  77. 54 0000000E ; * r0 --> from
  78. 55 0000000E ; * r1 --> to
  79. 56 0000000E ; */
  80. 57 0000000E rt_hw_context_switch_interrupt
  81. 58 0000000E EXPORT rt_hw_context_switch_interrupt
  82. 59 0000000E rt_hw_context_switch
  83. PROC
  84. 60 0000000E EXPORT rt_hw_context_switch
  85. 61 0000000E
  86. 62 0000000E ; set rt_thread_switch_interrupt_flag to 1
  87. 63 0000000E 4A32 LDR r2, =rt_thread_switch_interrupt
  88. _flag
  89. 64 00000010 6813 LDR r3, [r2]
  90. 65 00000012 2B01 CMP r3, #1
  91. 66 00000014 D004 BEQ _reswitch
  92. 67 00000016 F04F 0301 MOV r3, #1
  93. 68 0000001A 6013 STR r3, [r2]
  94. 69 0000001C
  95. 70 0000001C 4A2F LDR r2, =rt_interrupt_from_thread ;
  96. set rt_interrupt_f
  97. rom_thread
  98. 71 0000001E 6010 STR r0, [r2]
  99. 72 00000020
  100. 73 00000020 _reswitch
  101. 74 00000020 4A2F LDR r2, =rt_interrupt_to_thread ; s
  102. et rt_interrupt_to_
  103. thread
  104. 75 00000022 6011 STR r1, [r2]
  105. 76 00000024
  106. 77 00000024 482F LDR r0, =NVIC_INT_CTRL ; trigger th
  107. e PendSV exception
  108. (causes context swi
  109. tch)
  110. 78 00000026 F04F 5180 LDR r1, =NVIC_PENDSVSET
  111. 79 0000002A 6001 STR r1, [r0]
  112. 80 0000002C 4770 BX LR
  113. 81 0000002E ENDP
  114. 82 0000002E
  115. 83 0000002E ; r0 --> switch from thread stack
  116. 84 0000002E ; r1 --> switch to thread stack
  117. 85 0000002E ; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from
  118. ] stack
  119. 86 0000002E PendSV_Handler
  120. ARM Macro Assembler Page 3
  121. PROC
  122. 87 0000002E EXPORT PendSV_Handler
  123. 88 0000002E
  124. 89 0000002E ; disable interrupt to protect context switch
  125. 90 0000002E F3EF 8210 MRS r2, PRIMASK
  126. 91 00000032 B672 CPSID I
  127. 92 00000034
  128. 93 00000034 ; get rt_thread_switch_interrupt_flag
  129. 94 00000034 4828 LDR r0, =rt_thread_switch_interrupt
  130. _flag
  131. 95 00000036 6801 LDR r1, [r0]
  132. 96 00000038 B191 CBZ r1, pendsv_exit ; pendsv alread
  133. y handled
  134. 97 0000003A
  135. 98 0000003A ; clear rt_thread_switch_interrupt_flag to 0
  136. 99 0000003A F04F 0100 MOV r1, #0x00
  137. 100 0000003E 6001 STR r1, [r0]
  138. 101 00000040
  139. 102 00000040 4826 LDR r0, =rt_interrupt_from_thread
  140. 103 00000042 6801 LDR r1, [r0]
  141. 104 00000044 B129 CBZ r1, switch_to_thread ; skip reg
  142. ister save at the f
  143. irst time
  144. 105 00000046
  145. 106 00000046 F3EF 8109 MRS r1, psp ; get from thread s
  146. tack pointer
  147. 107 0000004A E921 0FF0 STMFD r1!, {r4 - r11} ; push r4 - r11
  148. register
  149. 108 0000004E 6800 LDR r0, [r0]
  150. 109 00000050 6001 STR r1, [r0] ; update from threa
  151. d stack pointer
  152. 110 00000052
  153. 111 00000052 switch_to_thread
  154. 112 00000052 4923 LDR r1, =rt_interrupt_to_thread
  155. 113 00000054 6809 LDR r1, [r1]
  156. 114 00000056 6809 LDR r1, [r1] ; load thread stack
  157. pointer
  158. 115 00000058
  159. 116 00000058 E8B1 0FF0 LDMFD r1!, {r4 - r11} ; pop r4 - r11
  160. register
  161. 117 0000005C F381 8809 MSR psp, r1 ; update stack poin
  162. ter
  163. 118 00000060
  164. 119 00000060 pendsv_exit
  165. 120 00000060 ; restore interrupt
  166. 121 00000060 F382 8810 MSR PRIMASK, r2
  167. 122 00000064
  168. 123 00000064 F04E 0E04 ORR lr, lr, #0x04
  169. 124 00000068 4770 BX lr
  170. 125 0000006A ENDP
  171. 126 0000006A
  172. 127 0000006A ;/*
  173. 128 0000006A ; * void rt_hw_context_switch_to(rt_uint32 to);
  174. 129 0000006A ; * r0 --> to
  175. 130 0000006A ; * this fucntion is used to perform the first thread sw
  176. itch
  177. 131 0000006A ; */
  178. 132 0000006A rt_hw_context_switch_to
  179. PROC
  180. ARM Macro Assembler Page 4
  181. 133 0000006A EXPORT rt_hw_context_switch_to
  182. 134 0000006A ; set to thread
  183. 135 0000006A 491D LDR r1, =rt_interrupt_to_thread
  184. 136 0000006C 6008 STR r0, [r1]
  185. 137 0000006E
  186. 138 0000006E ; set from thread to 0
  187. 139 0000006E 491B LDR r1, =rt_interrupt_from_thread
  188. 140 00000070 F04F 0000 MOV r0, #0x0
  189. 141 00000074 6008 STR r0, [r1]
  190. 142 00000076
  191. 143 00000076 ; set interrupt flag to 1
  192. 144 00000076 4918 LDR r1, =rt_thread_switch_interrupt
  193. _flag
  194. 145 00000078 F04F 0001 MOV r0, #1
  195. 146 0000007C 6008 STR r0, [r1]
  196. 147 0000007E
  197. 148 0000007E ; set the PendSV and SysTick exception priority
  198. 149 0000007E 481A LDR r0, =NVIC_SYSPRI2
  199. 150 00000080 491A LDR r1, =NVIC_PENDSV_PRI
  200. 151 00000082 F8D0 2000 LDR.W r2, [r0,#0x00] ; read
  201. 152 00000086 EA41 0102 ORR r1,r1,r2 ; modify
  202. 153 0000008A 6001 STR r1, [r0] ; write-back
  203. 154 0000008C
  204. 155 0000008C ; trigger the PendSV exception (causes context switch)
  205. 156 0000008C 4815 LDR r0, =NVIC_INT_CTRL
  206. 157 0000008E F04F 5180 LDR r1, =NVIC_PENDSVSET
  207. 158 00000092 6001 STR r1, [r0]
  208. 159 00000094
  209. 160 00000094 ; restore MSP
  210. 161 00000094 4816 LDR r0, =SCB_VTOR
  211. 162 00000096 6800 LDR r0, [r0]
  212. 163 00000098 6800 LDR r0, [r0]
  213. 164 0000009A F380 8808 MSR msp, r0
  214. 165 0000009E
  215. 166 0000009E ; enable interrupts at processor level
  216. 167 0000009E B661 CPSIE F
  217. 168 000000A0 B662 CPSIE I
  218. 169 000000A2
  219. 170 000000A2 ; never reach here!
  220. 171 000000A2 ENDP
  221. 172 000000A2
  222. 173 000000A2 ; compatible with old version
  223. 174 000000A2 rt_hw_interrupt_thread_switch
  224. PROC
  225. 175 000000A2 EXPORT rt_hw_interrupt_thread_switch
  226. 176 000000A2 4770 BX lr
  227. 177 000000A4 ENDP
  228. 178 000000A4
  229. 179 000000A4 IMPORT rt_hw_hard_fault_exception
  230. 180 000000A4 EXPORT HardFault_Handler
  231. 181 000000A4 HardFault_Handler
  232. PROC
  233. 182 000000A4
  234. 183 000000A4 ; get current context
  235. 184 000000A4 F01E 0F04 TST lr, #0x04 ; if(!EXC_RETURN[2]
  236. )
  237. 185 000000A8 BF0C ITE EQ
  238. 186 000000AA F3EF 8008 MRSEQ r0, msp ; [2]=0 ==> Z=1, ge
  239. t fault context fro
  240. ARM Macro Assembler Page 5
  241. m handler.
  242. 187 000000AE F3EF 8009 MRSNE r0, psp ; [2]=1 ==> Z=0, ge
  243. t fault context fro
  244. m thread.
  245. 188 000000B2
  246. 189 000000B2 E920 0FF0 STMFD r0!, {r4 - r11} ; push r4 - r11
  247. register
  248. 190 000000B6 F840 ED04 STMFD r0!, {lr} ; push exec_return
  249. register
  250. 191 000000BA
  251. 192 000000BA F01E 0F04 TST lr, #0x04 ; if(!EXC_RETURN[2]
  252. )
  253. 193 000000BE BF0C ITE EQ
  254. 194 000000C0 F380 8808 MSREQ msp, r0 ; [2]=0 ==> Z=1, up
  255. date stack pointer
  256. to MSP.
  257. 195 000000C4 F380 8809 MSRNE psp, r0 ; [2]=1 ==> Z=0, up
  258. date stack pointer
  259. to PSP.
  260. 196 000000C8
  261. 197 000000C8 B500 PUSH {lr}
  262. 198 000000CA F7FF FFFE BL rt_hw_hard_fault_exception
  263. 199 000000CE F85D EB04 POP {lr}
  264. 200 000000D2
  265. 201 000000D2 F04E 0E04 ORR lr, lr, #0x04
  266. 202 000000D6 4770 BX lr
  267. 203 000000D8 ENDP
  268. 204 000000D8
  269. 205 000000D8 ALIGN 4
  270. 206 000000D8
  271. 207 000000D8 END
  272. 00000000
  273. 00000000
  274. 00000000
  275. E000ED04
  276. E000ED20
  277. FFFF0000
  278. E000ED08
  279. Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M3 --apcs=interw
  280. ork --depend=.\output\context_rvds.d -o.\output\context_rvds.o -IE:\code\rtt\rt
  281. -thread\bsp\gd32105c-eval\RTE -ID:\Keil_v5\ARM\PACK\GigaDevice\GD32F10x_DFP\2.0
  282. .1\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include --predefine="__MICROLIB SETA 1
  283. " --predefine="__UVISION_VERSION SETA 514" --predefine="GD32F10X_CL SETA 1" --p
  284. redefine="USE_STDPERIPH_DRIVER SETA 1" --list=.\list\context_rvds.lst ..\..\lib
  285. cpu\arm\cortex-m3\context_rvds.S
  286. ARM Macro Assembler Page 1 Alphabetic symbol ordering
  287. Relocatable symbols
  288. .text 00000000
  289. Symbol: .text
  290. Definitions
  291. At line 24 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  292. Uses
  293. None
  294. Comment: .text unused
  295. HardFault_Handler 000000A4
  296. Symbol: HardFault_Handler
  297. Definitions
  298. At line 181 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  299. Uses
  300. At line 180 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  301. Comment: HardFault_Handler used once
  302. PendSV_Handler 0000002E
  303. Symbol: PendSV_Handler
  304. Definitions
  305. At line 86 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  306. Uses
  307. At line 87 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  308. Comment: PendSV_Handler used once
  309. _reswitch 00000020
  310. Symbol: _reswitch
  311. Definitions
  312. At line 73 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  313. Uses
  314. At line 66 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  315. Comment: _reswitch used once
  316. pendsv_exit 00000060
  317. Symbol: pendsv_exit
  318. Definitions
  319. At line 119 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  320. Uses
  321. At line 96 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  322. Comment: pendsv_exit used once
  323. rt_hw_context_switch 0000000E
  324. Symbol: rt_hw_context_switch
  325. Definitions
  326. At line 59 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  327. Uses
  328. At line 60 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  329. Comment: rt_hw_context_switch used once
  330. rt_hw_context_switch_interrupt 0000000E
  331. Symbol: rt_hw_context_switch_interrupt
  332. Definitions
  333. At line 57 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  334. Uses
  335. At line 58 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  336. Comment: rt_hw_context_switch_interrupt used once
  337. rt_hw_context_switch_to 0000006A
  338. Symbol: rt_hw_context_switch_to
  339. ARM Macro Assembler Page 2 Alphabetic symbol ordering
  340. Relocatable symbols
  341. Definitions
  342. At line 132 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  343. Uses
  344. At line 133 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  345. Comment: rt_hw_context_switch_to used once
  346. rt_hw_interrupt_disable 00000000
  347. Symbol: rt_hw_interrupt_disable
  348. Definitions
  349. At line 36 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  350. Uses
  351. At line 37 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  352. Comment: rt_hw_interrupt_disable used once
  353. rt_hw_interrupt_enable 00000008
  354. Symbol: rt_hw_interrupt_enable
  355. Definitions
  356. At line 46 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  357. Uses
  358. At line 47 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  359. Comment: rt_hw_interrupt_enable used once
  360. rt_hw_interrupt_thread_switch 000000A2
  361. Symbol: rt_hw_interrupt_thread_switch
  362. Definitions
  363. At line 174 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  364. Uses
  365. At line 175 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  366. Comment: rt_hw_interrupt_thread_switch used once
  367. switch_to_thread 00000052
  368. Symbol: switch_to_thread
  369. Definitions
  370. At line 111 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  371. Uses
  372. At line 104 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  373. Comment: switch_to_thread used once
  374. 12 symbols
  375. ARM Macro Assembler Page 1 Alphabetic symbol ordering
  376. Absolute symbols
  377. NVIC_INT_CTRL E000ED04
  378. Symbol: NVIC_INT_CTRL
  379. Definitions
  380. At line 19 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  381. Uses
  382. At line 77 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  383. At line 156 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  384. NVIC_PENDSVSET 10000000
  385. Symbol: NVIC_PENDSVSET
  386. Definitions
  387. At line 22 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  388. Uses
  389. At line 78 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  390. At line 157 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  391. NVIC_PENDSV_PRI FFFF0000
  392. Symbol: NVIC_PENDSV_PRI
  393. Definitions
  394. At line 21 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  395. Uses
  396. At line 150 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  397. Comment: NVIC_PENDSV_PRI used once
  398. NVIC_SYSPRI2 E000ED20
  399. Symbol: NVIC_SYSPRI2
  400. Definitions
  401. At line 20 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  402. Uses
  403. At line 149 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  404. Comment: NVIC_SYSPRI2 used once
  405. SCB_VTOR E000ED08
  406. Symbol: SCB_VTOR
  407. Definitions
  408. At line 18 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  409. Uses
  410. At line 161 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  411. Comment: SCB_VTOR used once
  412. 5 symbols
  413. ARM Macro Assembler Page 1 Alphabetic symbol ordering
  414. External symbols
  415. rt_hw_hard_fault_exception 00000000
  416. Symbol: rt_hw_hard_fault_exception
  417. Definitions
  418. At line 179 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  419. Uses
  420. At line 198 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  421. Comment: rt_hw_hard_fault_exception used once
  422. rt_interrupt_from_thread 00000000
  423. Symbol: rt_interrupt_from_thread
  424. Definitions
  425. At line 30 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  426. Uses
  427. At line 70 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  428. At line 102 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  429. At line 139 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  430. rt_interrupt_to_thread 00000000
  431. Symbol: rt_interrupt_to_thread
  432. Definitions
  433. At line 31 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  434. Uses
  435. At line 74 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  436. At line 112 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  437. At line 135 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  438. rt_thread_switch_interrupt_flag 00000000
  439. Symbol: rt_thread_switch_interrupt_flag
  440. Definitions
  441. At line 29 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  442. Uses
  443. At line 63 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  444. At line 94 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  445. At line 144 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  446. 4 symbols
  447. 357 symbols in table