📄 os_cpu_a.lst
字号:
ARM Macro Assembler Page 5
162 0000003C 4C1C LDR R4, =NVIC_INT_CTRL ; trigger th
e PendSV exception
(causes context swi
tch)
163 0000003E F04F 5580 LDR R5, =NVIC_PENDSVSET
164 00000042 6025 STR R5, [R4]
165 00000044 4770 BX LR
166 00000046
167 00000046 BF00 NOP
168 00000048
169 00000048 ;*******************************************************
**************************************************
170 00000048 ; PERFORM A CONTEXT SWITCH (From
task level) - OSCtxSw()
171 00000048 ;
172 00000048 ; Note(s) : 1) OSPendSV is used to cause a context switc
h. This is a recommended
173 00000048 ; method for performing context switches wi
th Cortex-M3. This is because
174 00000048 ; Cortex-M3 auto-saves half of the processo
r context on any exception, and
175 00000048 ; restores same on return from exception.
So only saving of R4-R11 is required
176 00000048 ; and fixing up the stack pointers. Using
the PendSV exception this way means
177 00000048 ; that context saving and restoring is iden
tical method whether it is
178 00000048 ; initiated from a thread or occurs due to
an interrupt or exception.
179 00000048 ; Pseudo-code is:
180 00000048 ; a) Get the process SP, if 0 then skip (go
to d) the saving part (first context switch)
181 00000048 ; b) Save remaining regs r4-r11 on process
stack
182 00000048 ; c) Save the process SP in it's TCB, OSTCB
Cur->OSTCBStkPtr = SP;
183 00000048 ; d) Call OSTaskSwHook()
184 00000048 ; e) Get current high priority, OSPrioCur =
OSPrioHighRdy
185 00000048 ; f) Get current ready thread TCB, OSTCBCur
= OSTCBHighRdy
186 00000048 ; g) Get new process SP from TCB, SP = OSTC
BHighRdy->OSTCBStkPtr
187 00000048 ; h) Restore R4-R11 from new process stack
188 00000048 ; i) Perform exception return which will re
store remaining context
189 00000048 ;
190 00000048 ; 2) On entry into OSPendSV handler:
191 00000048 ; a) The following have been saved on the p
rocess stack (by processor):
192 00000048 ; xPSR, PC, LR, R12, R0-R3
193 00000048 ; b) Processor mode is switched to Handler
mode (from Thread mode)
194 00000048 ; c) Stack is Main stack (switched from Pro
cess stack)
195 00000048 ; d) OSTCBCur points to the OS_TCB of
the task to suspend
196 00000048 ; OSTCBHighRdy points to the OS_TCB of
the task to resume
ARM Macro Assembler Page 6
197 00000048 ;
198 00000048 ; 3) Since OSPendSV is set to lowest priority
in the system (by OSCtxSw() above),
199 00000048 ; we know that it will only be run when no
other exception or interrupt is
200 00000048 ; active, and therefore safe to assume that
context being switched out was
201 00000048 ; using the process stack (PSP)
202 00000048 ;*******************************************************
**************************************************
203 00000048
204 00000048 OSPendSV
205 00000048 F3EF 8009 MRS R0, PSP ; PSP is process st
ack pointer
206 0000004C B130 CBZ R0, OSPendSV_nosave ; skip regi
ster save the first
time
207 0000004E
208 0000004E F1A0 0020 SUB R0, R0, #0x20 ; save remaining
regs r4-11 on proce
ss stack
209 00000052 E880 0FF0 STM R0, {R4-R11}
210 00000056
211 00000056 4C13 LDR R4, __OS_TCBCur ; OSTCBCur->OST
CBStkPtr = SP;
212 00000058 6824 LDR R4, [R4]
213 0000005A 6020 STR R0, [R4] ; R0 is SP of proce
ss being switched o
ut
214 0000005C
215 0000005C ; at this point, entire context of process has been save
d
216 0000005C OSPendSV_nosave
217 0000005C B500 PUSH {R14} ; need to save LR e
xc_return value
218 0000005E 480B LDR R0, __OS_TaskSwHook
; OSTaskSwHook();
219 00000060 4780 BLX R0
220 00000062 F85D EB04 POP {R14}
221 00000066
222 00000066 4C0C LDR R4, __OS_PrioCur ; OSPrioCur =
OSPrioHighRdy
223 00000068 4D0C LDR R5, __OS_PrioHighRdy
224 0000006A 782E LDRB R6, [R5]
225 0000006C 7026 STRB R6, [R4]
226 0000006E
227 0000006E 4C0D LDR R4, __OS_TCBCur ; OSTCBCur = O
STCBHighRdy;
228 00000070 4E0D LDR R6, __OS_TCBHighRdy
229 00000072 6836 LDR R6, [R6]
230 00000074 6026 STR R6, [R4]
231 00000076
232 00000076 6830 LDR R0, [R6] ; R0 is new process
SP; SP = OSTCBHigh
Rdy->OSTCBStkPtr;
233 00000078 E890 0FF0 LDM R0, {R4-R11} ; restore r4-11 fr
om new process stac
k
234 0000007C F100 0020 ADD R0, R0, #0x20
ARM Macro Assembler Page 7
235 00000080 F380 8809 MSR PSP, R0 ; load PSP with new
process SP
236 00000084 F04E 0E04 ORR LR, LR, #0x04 ; ensure exceptio
n return uses proce
ss stack
237 00000088 4770 BX LR ; exception return
will restore remain
ing context
238 0000008A
239 0000008A BF00 NOP
240 0000008C
241 0000008C ;*******************************************************
**************************************************
242 0000008C ; POINTERS TO VARIAB
LES
243 0000008C ;*******************************************************
**************************************************
244 0000008C
245 0000008C ; DATA
246 0000008C
247 0000008C __OS_TaskSwHook
248 0000008C 00000000 DCD OSTaskSwHook
249 00000090
250 00000090 __OS_IntExit
251 00000090 00000000 DCD OSIntExit
252 00000094
253 00000094 __OS_IntNesting
254 00000094 00000000 DCD OSIntNesting
255 00000098
256 00000098 __OS_PrioCur
257 00000098 00000000 DCD OSPrioCur
258 0000009C
259 0000009C __OS_PrioHighRdy
260 0000009C 00000000 DCD OSPrioHighRdy
261 000000A0
262 000000A0 __OS_Running
263 000000A0 00000000 DCD OSRunning
264 000000A4
265 000000A4 __OS_TCBCur
266 000000A4 00000000 DCD OSTCBCur
267 000000A8
268 000000A8 __OS_TCBHighRdy
269 000000A8 00000000 DCD OSTCBHighRdy
270 000000AC
271 000000AC END
E000ED20
E000ED04
Command Line: --debug --xref --device=DARMSTM --apcs=interwork -o".\Debug in Ch
ipFLASH\os_cpu_a.o" -IC:\Keil\ARM\INC\ST\STM32F10x --predefine="__DEBUG SETA 1"
--predefine="__CHIP_FLASH SETA 1" --list=.\os_cpu_a.lst uCOS-II\Ports\os_cpu_a
.asm
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Relocatable symbols
.text 00000000
Symbol: .text
Definitions
At line 81 in file uCOS-II\Ports\os_cpu_a.asm
Uses
None
Comment: .text unused
OSCtxSw 00000032
Symbol: OSCtxSw
Definitions
At line 144 in file uCOS-II\Ports\os_cpu_a.asm
Uses
At line 35 in file uCOS-II\Ports\os_cpu_a.asm
Comment: OSCtxSw used once
OSIntCtxSw 0000003C
Symbol: OSIntCtxSw
Definitions
At line 161 in file uCOS-II\Ports\os_cpu_a.asm
Uses
At line 36 in file uCOS-II\Ports\os_cpu_a.asm
Comment: OSIntCtxSw used once
OSPendSV 00000048
Symbol: OSPendSV
Definitions
At line 204 in file uCOS-II\Ports\os_cpu_a.asm
Uses
At line 37 in file uCOS-II\Ports\os_cpu_a.asm
Comment: OSPendSV used once
OSPendSV_nosave 0000005C
Symbol: OSPendSV_nosave
Definitions
At line 216 in file uCOS-II\Ports\os_cpu_a.asm
Uses
At line 206 in file uCOS-II\Ports\os_cpu_a.asm
Comment: OSPendSV_nosave used once
OSStartHang 00000030
Symbol: OSStartHang
Definitions
At line 132 in file uCOS-II\Ports\os_cpu_a.asm
Uses
At line 133 in file uCOS-II\Ports\os_cpu_a.asm
Comment: OSStartHang used once
OSStartHighRdy 0000000E
Symbol: OSStartHighRdy
Definitions
At line 114 in file uCOS-II\Ports\os_cpu_a.asm
Uses
At line 34 in file uCOS-II\Ports\os_cpu_a.asm
Comment: OSStartHighRdy used once
OS_CPU_SR_Restore 00000008
Symbol: OS_CPU_SR_Restore
ARM Macro Assembler Page 2 Alphabetic symbol ordering
Relocatable symbols
Definitions
At line 92 in file uCOS-II\Ports\os_cpu_a.asm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -