-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathos_cpu_a.lst
574 lines (504 loc) · 24.7 KB
/
os_cpu_a.lst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
ARM Macro Assembler Page 1
1 00000000 ;
2 00000000 ;*******************************************************
*************************************************
3 00000000 ; uC/OS-I
II
4 00000000 ; The Real-Time
Kernel
5 00000000 ;
6 00000000 ;
7 00000000 ; (c) Copyright 2009-2013; Micri
um, Inc.; Weston, FL
8 00000000 ; All rights reserved. Protected by
international copyright laws.
9 00000000 ;
10 00000000 ; ARM Cortex-M
4 Port
11 00000000 ;
12 00000000 ; File : OS_CPU_A.ASM
13 00000000 ; Version : V3.03.02
14 00000000 ; By : JJL
15 00000000 ; BAN
16 00000000 ;
17 00000000 ; For : ARMv7 Cortex-M4
18 00000000 ; Mode : Thumb-2 ISA
19 00000000 ; Toolchain : RealView Development Suite
20 00000000 ; RealView Microcontroller Development Kit (
MDK)
21 00000000 ; ARM Developer Suite (ADS)
22 00000000 ; Keil uVision
23 00000000 ;*******************************************************
*************************************************
24 00000000 ;
25 00000000
26 00000000 ;*******************************************************
*************************************************
27 00000000 ; PUBLIC FUNCTI
ONS
28 00000000 ;*******************************************************
*************************************************
29 00000000
30 00000000 IMPORT OSRunning ; External referenc
es
31 00000000 IMPORT OSPrioCur
32 00000000 IMPORT OSPrioHighRdy
33 00000000 IMPORT OSTCBCurPtr
34 00000000 IMPORT OSTCBHighRdyPtr
35 00000000 IMPORT OSIntExit
36 00000000 IMPORT OSTaskSwHook
37 00000000 IMPORT OS_CPU_ExceptStkBase
38 00000000
39 00000000
40 00000000 EXPORT OSStartHighRdy ; Functions decl
ared in this file
41 00000000 EXPORT OSCtxSw
42 00000000 EXPORT OSIntCtxSw
43 00000000 EXPORT OS_CPU_PendSV_Handler
44 00000000
45 00000000
46 00000000 ;*******************************************************
ARM Macro Assembler Page 2
*************************************************
47 00000000 ; EQUATES
48 00000000 ;*******************************************************
*************************************************
49 00000000
50 00000000 E000ED04
NVIC_INT_CTRL
EQU 0xE000ED04 ; Interrupt control
state register.
51 00000000 E000ED22
NVIC_SYSPRI14
EQU 0xE000ED22 ; System priority r
egister (priority 1
4).
52 00000000 0000FFFF
NVIC_PENDSV_PRI
EQU 0xFFFF ; PendSV priority v
alue (lowest).
53 00000000 10000000
NVIC_PENDSVSET
EQU 0x10000000 ; Value to trigger
PendSV exception.
54 00000000
55 00000000
56 00000000 ;*******************************************************
*************************************************
57 00000000 ; CODE GENERATION DI
RECTIVES
58 00000000 ;*******************************************************
*************************************************
59 00000000
60 00000000 PRESERVE8
61 00000000 THUMB
62 00000000
63 00000000 AREA CODE, CODE, READONLY
64 00000000 ;PRESERVE8
65 00000000
66 00000000 ;AREA |.text|, CODE, READONLY
67 00000000 ;THUMB
68 00000000
69 00000000 ;*******************************************************
*************************************************
70 00000000 ; START MULTITAS
KING
71 00000000 ; void OSStartHighR
dy(void)
72 00000000 ;
73 00000000 ; Note(s) : 1) This function triggers a PendSV exception
(essentially, causes a context switch) to cause
74 00000000 ; the first task to start.
75 00000000 ;
76 00000000 ; 2) OSStartHighRdy() MUST:
77 00000000 ; a) Setup PendSV exception priority to low
est;
78 00000000 ; b) Set initial PSP to 0, to tell context
switcher this is first run;
79 00000000 ; c) Set the main stack to OS_CPU_ExceptStk
Base
80 00000000 ; d) Trigger PendSV exception;
ARM Macro Assembler Page 3
81 00000000 ; e) Enable interrupts (tasks will run with
interrupts enabled).
82 00000000 ;*******************************************************
*************************************************
83 00000000
84 00000000 OSStartHighRdy
85 00000000 4822 LDR R0, =NVIC_SYSPRI14 ; Set the Pe
ndSV exception prio
rity
86 00000002 F64F 71FF LDR R1, =NVIC_PENDSV_PRI
87 00000006 7001 STRB R1, [R0]
88 00000008
89 00000008 2000 MOVS R0, #0 ; Set the PSP to 0
for initial context
switch call
90 0000000A F380 8809 MSR PSP, R0
91 0000000E
92 0000000E 4820 LDR R0, =OS_CPU_ExceptStkBase ; Ini
tialize the MSP to
the OS_CPU_ExceptSt
kBase
93 00000010 6801 LDR R1, [R0]
94 00000012 F381 8808 MSR MSP, R1
95 00000016
96 00000016 481F LDR R0, =NVIC_INT_CTRL ; Trigger th
e PendSV exception
(causes context swi
tch)
97 00000018 F04F 5180 LDR R1, =NVIC_PENDSVSET
98 0000001C 6001 STR R1, [R0]
99 0000001E
100 0000001E B662 CPSIE I ; Enable interrupts
at processor level
101 00000020
102 00000020 OSStartHang
103 00000020 E7FE B OSStartHang ; Should never get
here
104 00000022
105 00000022
106 00000022 ;*******************************************************
*************************************************
107 00000022 ; PERFORM A CONTEXT SWITCH (From t
ask level) - OSCtxSw()
108 00000022 ;
109 00000022 ; Note(s) : 1) OSCtxSw() is called when OS wants to perf
orm a task context switch. This function
110 00000022 ; triggers the PendSV exception which is wh
ere the real work is done.
111 00000022 ;*******************************************************
*************************************************
112 00000022
113 00000022 OSCtxSw
114 00000022 481C LDR R0, =NVIC_INT_CTRL ; Trigger th
e PendSV exception
(causes context swi
tch)
115 00000024 F04F 5180 LDR R1, =NVIC_PENDSVSET
116 00000028 6001 STR R1, [R0]
ARM Macro Assembler Page 4
117 0000002A 4770 BX LR
118 0000002C
119 0000002C
120 0000002C ;*******************************************************
*************************************************
121 0000002C ; PERFORM A CONTEXT SWITCH (From inter
rupt level) - OSIntCtxSw()
122 0000002C ;
123 0000002C ; Note(s) : 1) OSIntCtxSw() is called by OSIntExit() whe
n it determines a context switch is needed as
124 0000002C ; the result of an interrupt. This functio
n simply triggers a PendSV exception which will
125 0000002C ; be handled when there are no more interru
pts active and interrupts are enabled.
126 0000002C ;*******************************************************
*************************************************
127 0000002C
128 0000002C OSIntCtxSw
129 0000002C 4819 LDR R0, =NVIC_INT_CTRL ; Trigger th
e PendSV exception
(causes context swi
tch)
130 0000002E F04F 5180 LDR R1, =NVIC_PENDSVSET
131 00000032 6001 STR R1, [R0]
132 00000034 4770 BX LR
133 00000036
134 00000036
135 00000036 ;*******************************************************
*************************************************
136 00000036 ; HANDLE PendSV EX
CEPTION
137 00000036 ; void OS_CPU_PendSVHa
ndler(void)
138 00000036 ;
139 00000036 ; Note(s) : 1) PendSV is used to cause a context switch.
This is a recommended method for performing
140 00000036 ; context switches with Cortex-M3. This is
because the Cortex-M3 auto-saves half of the
141 00000036 ; processor context on any exception, and r
estores same on return from exception. So only
142 00000036 ; saving of R4-R11 is required and fixing u
p the stack pointers. Using the PendSV exception
143 00000036 ; this way means that context saving and re
storing is identical whether it is initiated from
144 00000036 ; a thread or occurs due to an interrupt or
exception.
145 00000036 ;
146 00000036 ; 2) Pseudo-code is:
147 00000036 ; a) Get the process SP, if 0 then skip (go
to d) the saving part (first context switch);
148 00000036 ; b) Save remaining regs r4-r11 on process
stack;
149 00000036 ; c) Save the process SP in its TCB, OSTCBC
urPtr->OSTCBStkPtr = SP;
150 00000036 ; d) Call OSTaskSwHook();
151 00000036 ; e) Get current high priority, OSPrioCur =
OSPrioHighRdy;
152 00000036 ; f) Get current ready thread TCB, OSTCBCur
Ptr = OSTCBHighRdyPtr;
ARM Macro Assembler Page 5
153 00000036 ; g) Get new process SP from TCB, SP = OSTC
BHighRdyPtr->OSTCBStkPtr;
154 00000036 ; h) Restore R4-R11 from new process stack;
155 00000036 ; i) Perform exception return which will re
store remaining context.
156 00000036 ;
157 00000036 ; 3) On entry into PendSV handler:
158 00000036 ; a) The following have been saved on the p
rocess stack (by processor):
159 00000036 ; xPSR, PC, LR, R12, R0-R3
160 00000036 ; b) Processor mode is switched to Handler
mode (from Thread mode)
161 00000036 ; c) Stack is Main stack (switched from Pro
cess stack)
162 00000036 ; d) OSTCBCurPtr points to the OS_TCB
of the task to suspend
163 00000036 ; OSTCBHighRdyPtr points to the OS_TCB
of the task to resume
164 00000036 ;
165 00000036 ; 4) Since PendSV is set to lowest priority in
the system (by OSStartHighRdy() above), we
166 00000036 ; know that it will only be run when no oth
er exception or interrupt is active, and
167 00000036 ; therefore safe to assume that context bei
ng switched out was using the process stack (PSP).
168 00000036 ;*******************************************************
*************************************************
169 00000036
170 00000036 OS_CPU_PendSV_Handler
171 00000036 B672 CPSID I ; Prevent interrupt
ion during context
switch
172 00000038 F3EF 8009 MRS R0, PSP ; PSP is process st
ack pointer
173 0000003C B150 CBZ R0, PendSVHandler_nosave ; Skip
register save the
first time
174 0000003E
175 0000003E ;Is the task using the FPU context? If so, push high vfp
registers.
176 0000003E F01E 0F10 TST R14, #0X10
177 00000042 BF08 IT EQ
178 00000044 ED20 8A10 VSTMDBEQ R0!,{S16-S31}
179 00000048
180 00000048 3820 SUBS R0, R0, #0x20 ; Save remaining
regs r4-11 on proce
ss stack
181 0000004A E880 0FF0 STM R0, {R4-R11}
182 0000004E
183 0000004E 4912 LDR R1, =OSTCBCurPtr ; OSTCBCurPtr-
>OSTCBStkPtr = SP;
184 00000050 6809 LDR R1, [R1]
185 00000052 6008 STR R0, [R1] ; R0 is SP of proce
ss being switched o
ut
186 00000054
187 00000054 ; At this point, entire context of process has been save
d
ARM Macro Assembler Page 6
188 00000054 PendSVHandler_nosave
189 00000054 B500 PUSH {R14} ; Save LR exc_retur
n value
190 00000056 4811 LDR R0, =OSTaskSwHook
; OSTaskSwHook();
191 00000058 4780 BLX R0
192 0000005A F85D EB04 POP {R14}
193 0000005E
194 0000005E 4810 LDR R0, =OSPrioCur ; OSPrioCur =
OSPrioHighRdy;
195 00000060 4910 LDR R1, =OSPrioHighRdy
196 00000062 780A LDRB R2, [R1]
197 00000064 7002 STRB R2, [R0]
198 00000066
199 00000066 480C LDR R0, =OSTCBCurPtr ; OSTCBCurPtr
= OSTCBHighRdyPtr;
200 00000068 490F LDR R1, =OSTCBHighRdyPtr
201 0000006A 680A LDR R2, [R1]
202 0000006C 6002 STR R2, [R0]
203 0000006E
204 0000006E 6810 LDR R0, [R2] ; R0 is new process
SP; SP = OSTCBHigh
RdyPtr->StkPtr;
205 00000070 E890 0FF0 LDM R0, {R4-R11} ; Restore r4-11 fr
om new process stac
k
206 00000074 3020 ADDS R0, R0, #0x20
207 00000076
208 00000076 ;Is the task using the FPU context? If so, push high vfp
registers.
209 00000076 F01E 0F10 TST R14, #0x10
210 0000007A BF08 IT EQ
211 0000007C ECB0 8A10 VLDMIAEQ R0!, {S16-S31}
212 00000080
213 00000080 F380 8809 MSR PSP, R0 ; Load PSP with new
process SP
214 00000084 F04E 0E04 ORR LR, LR, #0x04 ; Ensure exceptio
n return uses proce
ss stack
215 00000088 B662 CPSIE I
216 0000008A 4770 BX LR ; Exception return
will restore remain
ing context
217 0000008C END
E000ED22
00000000
E000ED04
00000000
00000000
00000000
00000000
00000000
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M4.fp --apcs=int
erwork --depend=..\obj\os_cpu_a.d -o..\obj\os_cpu_a.o -I.\RTE\_Template -IC:\ye
phiu\app\KEIL_pack\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\
Include -IC:\yephiu\app\KEIL\ARM\CMSIS\Include --predefine="__UVISION_VERSION S
ETA 527" --predefine="STM32F407xx SETA 1" --list=..\obj\os_cpu_a.lst ..\uCOS-II
I\Port\os_cpu_a.asm
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Relocatable symbols
CODE 00000000
Symbol: CODE
Definitions
At line 63 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
None
Comment: CODE unused
OSCtxSw 00000022
Symbol: OSCtxSw
Definitions
At line 113 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 41 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: OSCtxSw used once
OSIntCtxSw 0000002C
Symbol: OSIntCtxSw
Definitions
At line 128 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 42 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: OSIntCtxSw used once
OSStartHang 00000020
Symbol: OSStartHang
Definitions
At line 102 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 103 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: OSStartHang used once
OSStartHighRdy 00000000
Symbol: OSStartHighRdy
Definitions
At line 84 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 40 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: OSStartHighRdy used once
OS_CPU_PendSV_Handler 00000036
Symbol: OS_CPU_PendSV_Handler
Definitions
At line 170 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 43 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: OS_CPU_PendSV_Handler used once
PendSVHandler_nosave 00000054
Symbol: PendSVHandler_nosave
Definitions
At line 188 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 173 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: PendSVHandler_nosave used once
7 symbols
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Absolute symbols
NVIC_INT_CTRL E000ED04
Symbol: NVIC_INT_CTRL
Definitions
At line 50 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 96 in file ..\uCOS-III\Port\os_cpu_a.asm
At line 114 in file ..\uCOS-III\Port\os_cpu_a.asm
At line 129 in file ..\uCOS-III\Port\os_cpu_a.asm
NVIC_PENDSVSET 10000000
Symbol: NVIC_PENDSVSET
Definitions
At line 53 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 97 in file ..\uCOS-III\Port\os_cpu_a.asm
At line 115 in file ..\uCOS-III\Port\os_cpu_a.asm
At line 130 in file ..\uCOS-III\Port\os_cpu_a.asm
NVIC_PENDSV_PRI 0000FFFF
Symbol: NVIC_PENDSV_PRI
Definitions
At line 52 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 86 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: NVIC_PENDSV_PRI used once
NVIC_SYSPRI14 E000ED22
Symbol: NVIC_SYSPRI14
Definitions
At line 51 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 85 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: NVIC_SYSPRI14 used once
4 symbols
ARM Macro Assembler Page 1 Alphabetic symbol ordering
External symbols
OSIntExit 00000000
Symbol: OSIntExit
Definitions
At line 35 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
None
Comment: OSIntExit unused
OSPrioCur 00000000
Symbol: OSPrioCur
Definitions
At line 31 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 194 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: OSPrioCur used once
OSPrioHighRdy 00000000
Symbol: OSPrioHighRdy
Definitions
At line 32 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 195 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: OSPrioHighRdy used once
OSRunning 00000000
Symbol: OSRunning
Definitions
At line 30 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
None
Comment: OSRunning unused
OSTCBCurPtr 00000000
Symbol: OSTCBCurPtr
Definitions
At line 33 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 183 in file ..\uCOS-III\Port\os_cpu_a.asm
At line 199 in file ..\uCOS-III\Port\os_cpu_a.asm
OSTCBHighRdyPtr 00000000
Symbol: OSTCBHighRdyPtr
Definitions
At line 34 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 200 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: OSTCBHighRdyPtr used once
OSTaskSwHook 00000000
Symbol: OSTaskSwHook
Definitions
At line 36 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 190 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: OSTaskSwHook used once
OS_CPU_ExceptStkBase 00000000
ARM Macro Assembler Page 2 Alphabetic symbol ordering
External symbols
Symbol: OS_CPU_ExceptStkBase
Definitions
At line 37 in file ..\uCOS-III\Port\os_cpu_a.asm
Uses
At line 92 in file ..\uCOS-III\Port\os_cpu_a.asm
Comment: OS_CPU_ExceptStkBase used once
8 symbols
354 symbols in table