context_rvds.lst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. ARM Macro Assembler Page 1
  2. 1 00000000 ;/*
  3. 2 00000000 ; * Copyright (c) 2006-2022, 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 4A34 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 4A31 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 4A31 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 4831 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 482A 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 4828 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 4925 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 491F 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 491D 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 491A 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 481C LDR r0, =NVIC_SYSPRI2
  199. 150 00000080 491C 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 4817 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 4818 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 ; ensure PendSV exception taken place before subsequent
  220. operation
  221. 171 000000A2 F3BF 8F4F DSB
  222. 172 000000A6 F3BF 8F6F ISB
  223. 173 000000AA
  224. 174 000000AA ; never reach here!
  225. 175 000000AA ENDP
  226. 176 000000AA
  227. 177 000000AA ; compatible with old version
  228. 178 000000AA rt_hw_interrupt_thread_switch
  229. PROC
  230. 179 000000AA EXPORT rt_hw_interrupt_thread_switch
  231. 180 000000AA 4770 BX lr
  232. 181 000000AC ENDP
  233. 182 000000AC
  234. 183 000000AC IMPORT rt_hw_hard_fault_exception
  235. 184 000000AC EXPORT HardFault_Handler
  236. 185 000000AC HardFault_Handler
  237. PROC
  238. 186 000000AC
  239. 187 000000AC ; get current context
  240. ARM Macro Assembler Page 5
  241. 188 000000AC F01E 0F04 TST lr, #0x04 ; if(!EXC_RETURN[2]
  242. )
  243. 189 000000B0 BF0C ITE EQ
  244. 190 000000B2 F3EF 8008 MRSEQ r0, msp ; [2]=0 ==> Z=1, ge
  245. t fault context fro
  246. m handler.
  247. 191 000000B6 F3EF 8009 MRSNE r0, psp ; [2]=1 ==> Z=0, ge
  248. t fault context fro
  249. m thread.
  250. 192 000000BA
  251. 193 000000BA E920 0FF0 STMFD r0!, {r4 - r11} ; push r4 - r11
  252. register
  253. 194 000000BE F840 ED04 STMFD r0!, {lr} ; push exec_return
  254. register
  255. 195 000000C2
  256. 196 000000C2 F01E 0F04 TST lr, #0x04 ; if(!EXC_RETURN[2]
  257. )
  258. 197 000000C6 BF0C ITE EQ
  259. 198 000000C8 F380 8808 MSREQ msp, r0 ; [2]=0 ==> Z=1, up
  260. date stack pointer
  261. to MSP.
  262. 199 000000CC F380 8809 MSRNE psp, r0 ; [2]=1 ==> Z=0, up
  263. date stack pointer
  264. to PSP.
  265. 200 000000D0
  266. 201 000000D0 B500 PUSH {lr}
  267. 202 000000D2 F7FF FFFE BL rt_hw_hard_fault_exception
  268. 203 000000D6 F85D EB04 POP {lr}
  269. 204 000000DA
  270. 205 000000DA F04E 0E04 ORR lr, lr, #0x04
  271. 206 000000DE 4770 BX lr
  272. 207 000000E0 ENDP
  273. 208 000000E0
  274. 209 000000E0 ALIGN 4
  275. 210 000000E0
  276. 211 000000E0 END
  277. 00000000
  278. 00000000
  279. 00000000
  280. E000ED04
  281. E000ED20
  282. FFFF0000
  283. E000ED08
  284. Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M3 --apcs=interw
  285. ork --depend=.\output\context_rvds.d -o.\output\context_rvds.o -I.\RTE\_rt-thre
  286. ad_gd32f105 -ID:\software\KEIL_V5_ArmPacks\GigaDevice\GD32F10x_DFP\2.0.3\Device
  287. \Include -ID:\software\KEIL_V5\ARM\CMSIS\Include --predefine="__MICROLIB SETA 1
  288. " --predefine="__UVISION_VERSION SETA 530" --predefine="GD32F10X_CL SETA 1" --p
  289. redefine="USE_STDPERIPH_DRIVER SETA 1" --predefine="_RTE_ SETA 1" --list=.\list
  290. \context_rvds.lst ..\..\libcpu\arm\cortex-m3\context_rvds.S
  291. ARM Macro Assembler Page 1 Alphabetic symbol ordering
  292. Relocatable symbols
  293. .text 00000000
  294. Symbol: .text
  295. Definitions
  296. At line 24 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  297. Uses
  298. None
  299. Comment: .text unused
  300. HardFault_Handler 000000AC
  301. Symbol: HardFault_Handler
  302. Definitions
  303. At line 185 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  304. Uses
  305. At line 184 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  306. Comment: HardFault_Handler used once
  307. PendSV_Handler 0000002E
  308. Symbol: PendSV_Handler
  309. Definitions
  310. At line 86 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  311. Uses
  312. At line 87 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  313. Comment: PendSV_Handler used once
  314. _reswitch 00000020
  315. Symbol: _reswitch
  316. Definitions
  317. At line 73 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  318. Uses
  319. At line 66 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  320. Comment: _reswitch used once
  321. pendsv_exit 00000060
  322. Symbol: pendsv_exit
  323. Definitions
  324. At line 119 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  325. Uses
  326. At line 96 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  327. Comment: pendsv_exit used once
  328. rt_hw_context_switch 0000000E
  329. Symbol: rt_hw_context_switch
  330. Definitions
  331. At line 59 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  332. Uses
  333. At line 60 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  334. Comment: rt_hw_context_switch used once
  335. rt_hw_context_switch_interrupt 0000000E
  336. Symbol: rt_hw_context_switch_interrupt
  337. Definitions
  338. At line 57 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  339. Uses
  340. At line 58 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  341. Comment: rt_hw_context_switch_interrupt used once
  342. rt_hw_context_switch_to 0000006A
  343. Symbol: rt_hw_context_switch_to
  344. ARM Macro Assembler Page 2 Alphabetic symbol ordering
  345. Relocatable symbols
  346. Definitions
  347. At line 132 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  348. Uses
  349. At line 133 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  350. Comment: rt_hw_context_switch_to used once
  351. rt_hw_interrupt_disable 00000000
  352. Symbol: rt_hw_interrupt_disable
  353. Definitions
  354. At line 36 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  355. Uses
  356. At line 37 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  357. Comment: rt_hw_interrupt_disable used once
  358. rt_hw_interrupt_enable 00000008
  359. Symbol: rt_hw_interrupt_enable
  360. Definitions
  361. At line 46 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  362. Uses
  363. At line 47 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  364. Comment: rt_hw_interrupt_enable used once
  365. rt_hw_interrupt_thread_switch 000000AA
  366. Symbol: rt_hw_interrupt_thread_switch
  367. Definitions
  368. At line 178 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  369. Uses
  370. At line 179 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  371. Comment: rt_hw_interrupt_thread_switch used once
  372. switch_to_thread 00000052
  373. Symbol: switch_to_thread
  374. Definitions
  375. At line 111 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  376. Uses
  377. At line 104 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  378. Comment: switch_to_thread used once
  379. 12 symbols
  380. ARM Macro Assembler Page 1 Alphabetic symbol ordering
  381. Absolute symbols
  382. NVIC_INT_CTRL E000ED04
  383. Symbol: NVIC_INT_CTRL
  384. Definitions
  385. At line 19 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  386. Uses
  387. At line 77 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  388. At line 156 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  389. NVIC_PENDSVSET 10000000
  390. Symbol: NVIC_PENDSVSET
  391. Definitions
  392. At line 22 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  393. Uses
  394. At line 78 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  395. At line 157 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  396. NVIC_PENDSV_PRI FFFF0000
  397. Symbol: NVIC_PENDSV_PRI
  398. Definitions
  399. At line 21 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  400. Uses
  401. At line 150 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  402. Comment: NVIC_PENDSV_PRI used once
  403. NVIC_SYSPRI2 E000ED20
  404. Symbol: NVIC_SYSPRI2
  405. Definitions
  406. At line 20 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  407. Uses
  408. At line 149 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  409. Comment: NVIC_SYSPRI2 used once
  410. SCB_VTOR E000ED08
  411. Symbol: SCB_VTOR
  412. Definitions
  413. At line 18 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  414. Uses
  415. At line 161 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  416. Comment: SCB_VTOR used once
  417. 5 symbols
  418. ARM Macro Assembler Page 1 Alphabetic symbol ordering
  419. External symbols
  420. rt_hw_hard_fault_exception 00000000
  421. Symbol: rt_hw_hard_fault_exception
  422. Definitions
  423. At line 183 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  424. Uses
  425. At line 202 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  426. Comment: rt_hw_hard_fault_exception used once
  427. rt_interrupt_from_thread 00000000
  428. Symbol: rt_interrupt_from_thread
  429. Definitions
  430. At line 30 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  431. Uses
  432. At line 70 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  433. At line 102 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  434. At line 139 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  435. rt_interrupt_to_thread 00000000
  436. Symbol: rt_interrupt_to_thread
  437. Definitions
  438. At line 31 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  439. Uses
  440. At line 74 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  441. At line 112 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  442. At line 135 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  443. rt_thread_switch_interrupt_flag 00000000
  444. Symbol: rt_thread_switch_interrupt_flag
  445. Definitions
  446. At line 29 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  447. Uses
  448. At line 63 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  449. At line 94 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  450. At line 144 in file ..\..\libcpu\arm\cortex-m3\context_rvds.S
  451. 4 symbols
  452. 358 symbols in table