os_cpu_a.lst
21.6 KB
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
ARM Macro Assembler Page 1
1 00000000 ;/*********************** (C) COPYRIGHT 2010 Libraworks
*************************
2 00000000 ;* File Name : os_cpu_a.asm
3 00000000 ;* Author : Librae
4 00000000 ;* Version : V1.0
5 00000000 ;* Date : 06/10/2010
6 00000000 ;* Description : ¦ÌCOS-II asm port for STM32
7 00000000 ;*******************************************************
************************/
8 00000000
9 00000000 IMPORT OSRunning ; External referenc
es
10 00000000 IMPORT OSPrioCur
11 00000000 IMPORT OSPrioHighRdy
12 00000000 IMPORT OSTCBCur
13 00000000 IMPORT OSTCBHighRdy
14 00000000 IMPORT OSIntNesting
15 00000000 IMPORT OSIntExit
16 00000000 IMPORT OSTaskSwHook
17 00000000
18 00000000 EXPORT OSStartHighRdy
19 00000000 EXPORT OSCtxSw
20 00000000 EXPORT OSIntCtxSw
21 00000000 EXPORT OS_CPU_SR_Save ; Functions decl
ared in this file
22 00000000 EXPORT OS_CPU_SR_Restore
23 00000000 EXPORT PendSV_Handler
24 00000000
25 00000000
26 00000000 E000ED04
NVIC_INT_CTRL
EQU 0xE000ED04 ; ÖжϿØÖƼĴæÆ÷
27 00000000 E000ED22
NVIC_SYSPRI2
EQU 0xE000ED22 ; ϵͳÓÅÏȼ¶¼Ä´æÆ÷(
2)
28 00000000 0000FFFF
NVIC_PENDSV_PRI
EQU 0xFFFF ; PendSVÖжϺÍϵͳ½
ÚÅÄÖжÏ
29 00000000 ; (¶¼Îª×îµÍ£¬0xff).
30 00000000 10000000
NVIC_PENDSVSET
EQU 0x10000000 ; ´¥·¢Èí¼þÖжϵÄÖµ.
31 00000000
32 00000000
33 00000000 PRESERVE8
34 00000000
35 00000000 AREA |.text|, CODE, READONLY
36 00000000 THUMB
37 00000000
38 00000000
39 00000000
40 00000000 ;*******************************************************
*************************************************
41 00000000 ; CRITICAL SECTION MET
HOD 3 FUNCTIONS
ARM Macro Assembler Page 2
42 00000000 ;
43 00000000 ; Description: Disable/Enable interrupts by preserving t
he state of interrupts. Generally speaking you
44 00000000 ; would store the state of the interrupt di
sable flag in the local variable 'cpu_sr' and then
45 00000000 ; disable interrupts. 'cpu_sr' is allocate
d in all of uC/OS-II's functions that need to
46 00000000 ; disable interrupts. You would restore th
e interrupt disable state by copying back 'cpu_sr'
47 00000000 ; into the CPU's status register.
48 00000000 ;
49 00000000 ; Prototypes : OS_CPU_SR OS_CPU_SR_Save(void);
50 00000000 ; void OS_CPU_SR_Restore(OS_CPU_S
R cpu_sr);
51 00000000 ;
52 00000000 ;
53 00000000 ; Note(s) : 1) These functions are used in general li
ke this:
54 00000000 ;
55 00000000 ; void Task (void *p_arg)
56 00000000 ; {
57 00000000 ; #if OS_CRITICAL_METHOD == 3 /
* Allocate storage for CPU status register */
58 00000000 ; OS_CPU_SR cpu_sr;
59 00000000 ; #endif
60 00000000 ;
61 00000000 ; :
62 00000000 ; :
63 00000000 ; OS_ENTER_CRITICAL(); /
* cpu_sr = OS_CPU_SaveSR(); */
64 00000000 ; :
65 00000000 ; :
66 00000000 ; OS_EXIT_CRITICAL(); /
* OS_CPU_RestoreSR(cpu_sr); */
67 00000000 ; :
68 00000000 ; :
69 00000000 ; }
70 00000000 ;*******************************************************
*************************************************
71 00000000
72 00000000 OS_CPU_SR_Save
73 00000000 F3EF 8010 MRS R0, PRIMASK ;¶ÁÈ¡PRIMASKµ½R0,R0
Ϊ·µ»ØÖµ
74 00000004 B672 CPSID I ;PRIMASK=1,¹ØÖжÏ(N
MIºÍÓ²¼þFAULT¿ÉÒÔÏì
Ó¦)
75 00000006 4770 BX LR ;·µ»Ø
76 00000008
77 00000008 OS_CPU_SR_Restore
78 00000008 F380 8810 MSR PRIMASK, R0 ;¶ÁÈ¡R0µ½PRIMASKÖÐ,
R0Ϊ²ÎÊý
79 0000000C 4770 BX LR ;·µ»Ø
80 0000000E
81 0000000E
82 0000000E ;/******************************************************
********************************
83 0000000E ;* º¯ÊýÃû³Æ: OSStartHighRdy
84 0000000E ;*
85 0000000E ;* ¹¦ÄÜÃèÊö: ʹÓõ÷¶ÈÆ÷ÔËÐеÚÒ»¸öÈÎÎñ
ARM Macro Assembler Page 3
86 0000000E ;*
87 0000000E ;* ²Î Êý: None
88 0000000E ;*
89 0000000E ;* ·µ »Ø Öµ: None
90 0000000E ;*******************************************************
*******************************/
91 0000000E
92 0000000E OSStartHighRdy
93 0000000E 4C26 LDR R4, =NVIC_SYSPRI2 ; set the Pen
dSV exception prior
ity
94 00000010 F64F 75FF LDR R5, =NVIC_PENDSV_PRI
95 00000014 6025 STR R5, [R4]
96 00000016
97 00000016 F04F 0400 MOV R4, #0 ; set the PSP to 0
for initial context
switch call
98 0000001A F384 8809 MSR PSP, R4
99 0000001E
100 0000001E 4C23 LDR R4, =OSRunning
; OSRunning = TRUE
101 00000020 F04F 0501 MOV R5, #1
102 00000024 7025 STRB R5, [R4]
103 00000026
104 00000026 ;Çл»µ½×î¸ßÓÅÏȼ¶µÄÈÎÎñ
105 00000026 4C22 LDR R4, =NVIC_INT_CTRL ;rigger the
PendSV exception (c
auses context switc
h)
106 00000028 F04F 5580 LDR R5, =NVIC_PENDSVSET
107 0000002C 6025 STR R5, [R4]
108 0000002E
109 0000002E B662 CPSIE I ;enable interrupts
at processor level
110 00000030 OSStartHang
111 00000030 E7FE B OSStartHang ;should never get h
ere
112 00000032
113 00000032 ;/******************************************************
********************************
114 00000032 ;* º¯ÊýÃû³Æ: OSCtxSw
115 00000032 ;*
116 00000032 ;* ¹¦ÄÜÃèÊö: ÈÎÎñ¼¶ÉÏÏÂÎÄÇл»
117 00000032 ;*
118 00000032 ;* ²Î Êý: None
119 00000032 ;*
120 00000032 ;* ·µ »Ø Öµ: None
121 00000032 ;*******************************************************
********************************/
122 00000032
123 00000032 OSCtxSw
124 00000032 B430 PUSH {R4, R5}
125 00000034 4C1E LDR R4, =NVIC_INT_CTRL ;´¥·¢PendSVÒ
ì³£ (causes context
switch)
126 00000036 F04F 5580 LDR R5, =NVIC_PENDSVSET
127 0000003A 6025 STR R5, [R4]
128 0000003C BC30 POP {R4, R5}
129 0000003E 4770 BX LR
ARM Macro Assembler Page 4
130 00000040
131 00000040 ;/******************************************************
********************************
132 00000040 ;* º¯ÊýÃû³Æ: OSIntCtxSw
133 00000040 ;*
134 00000040 ;* ¹¦ÄÜÃèÊö: Öжϼ¶ÈÎÎñÇл»
135 00000040 ;*
136 00000040 ;* ²Î Êý: None
137 00000040 ;*
138 00000040 ;* ·µ »Ø Öµ: None
139 00000040 ;*******************************************************
********************************/
140 00000040
141 00000040 OSIntCtxSw
142 00000040 B430 PUSH {R4, R5}
143 00000042 4C1B LDR R4, =NVIC_INT_CTRL ;´¥·¢PendSVÒ
ì³£ (causes context
switch)
144 00000044 F04F 5580 LDR R5, =NVIC_PENDSVSET
145 00000048 6025 STR R5, [R4]
146 0000004A BC30 POP {R4, R5}
147 0000004C 4770 BX LR
148 0000004E BF00 NOP
149 00000050
150 00000050 ;/******************************************************
********************************
151 00000050 ;* º¯ÊýÃû³Æ: OSPendSV
152 00000050 ;*
153 00000050 ;* ¹¦ÄÜÃèÊö: OSPendSV is used to cause a context switch.
154 00000050 ;*
155 00000050 ;* ²Î Êý: None
156 00000050 ;*
157 00000050 ;* ·µ »Ø Öµ: None
158 00000050 ;*******************************************************
********************************/
159 00000050 PendSV_Handler
160 00000050 B672 CPSID I ; Prevent interrupt
ion during context
switch
161 00000052 F3EF 8009 MRS R0, PSP ; PSP is process st
ack pointer Èç¹ûÔÚÓ
ÃPSP¶ÑÕ»,Ôò¿ÉÒÔºöÂÔ
±£´æ¼Ä´æÆ÷,²Î¿¼CM3È
¨ÍþÖеÄË«¶ÑÕ»-°×²Ë×
¢
162 00000056 B150 CBZ R0, PendSV_Handler_Nosave ; Ski
p register save the
first time
163 00000058
164 00000058 ;Is the task using the FPU context? If so, push high vfp
registers.
165 00000058 F01E 0F10 TST R14, #0x10
166 0000005C BF08 IT EQ
167 0000005E ED20 8A10 VSTMDBEQ R0!, {S16-S31}
168 00000062
169 00000062 3820 SUBS R0, R0, #0x20 ; Save remaining
regs r4-11 on proce
ss stack
ARM Macro Assembler Page 5
170 00000064 E880 0FF0 STM R0, {R4-R11}
171 00000068
172 00000068 4912 LDR R1, =OSTCBCur ; OSTCBCur->OSTCB
StkPtr = SP;
173 0000006A 6809 LDR R1, [R1]
174 0000006C 6008 STR R0, [R1] ; R0 is SP of proce
ss being switched o
ut
175 0000006E
176 0000006E ; At this point, entire context of process has been save
d
177 0000006E PendSV_Handler_Nosave
178 0000006E B500 PUSH {R14} ; Save LR exc_retur
n value
179 00000070 4811 LDR R0, =OSTaskSwHook
; OSTaskSwHook();
180 00000072 4780 BLX R0
181 00000074 F85D EB04 POP {R14}
182 00000078
183 00000078 4810 LDR R0, =OSPrioCur ; OSPrioCur = OS
PrioHighRdy;
184 0000007A 4911 LDR R1, =OSPrioHighRdy
185 0000007C 780A LDRB R2, [R1]
186 0000007E 7002 STRB R2, [R0]
187 00000080
188 00000080 480C LDR R0, =OSTCBCur ; OSTCBCur = OST
CBHighRdy;
189 00000082 4910 LDR R1, =OSTCBHighRdy
190 00000084 680A LDR R2, [R1]
191 00000086 6002 STR R2, [R0]
192 00000088
193 00000088 6810 LDR R0, [R2] ; R0 is new process
SP; SP = OSTCBHigh
Rdy->OSTCBStkPtr;
194 0000008A E890 0FF0 LDM R0, {R4-R11} ; Restore r4-11 fr
om new process stac
k
195 0000008E 3020 ADDS R0, R0, #0x20
196 00000090
197 00000090 ;Is the task using the FPU context? If so, push high vfp
registers.
198 00000090 F01E 0F10 TST R14, #0x10
199 00000094 BF08 IT EQ
200 00000096 ECB0 8A10 VLDMIAEQ R0!, {S16-S31}
201 0000009A
202 0000009A F380 8809 MSR PSP, R0 ; Load PSP with new
process SP
203 0000009E F04E 0E04 ORR LR, LR, #0x04 ; Ensure exceptio
n return uses proce
ss stack
204 000000A2 B662 CPSIE I
205 000000A4 4770 BX LR ; Exception return
will restore remain
ing context
206 000000A6 BF00 NOP
207 000000A8 end
E000ED22
00000000
E000ED04
ARM Macro Assembler Page 6
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 -IC:\Users\0353\Desktop\¿
ØÖÆÆ÷³ÌÐòV1.0\USER\RTE -IC:\Keil_v5\ARM\PACK\Keil\STM32F4xx_DFP\1.0.8\Device\In
clude -IC:\Keil_v5\ARM\CMSIS\Include --predefine="__UVISION_VERSION SETA 514" -
-predefine="STM32F40_41xxx SETA 1" --list=.\listings\os_cpu_a.lst ..\UCOSII\POR
T\os_cpu_a.asm
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Relocatable symbols
.text 00000000
Symbol: .text
Definitions
At line 35 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
None
Comment: .text unused
OSCtxSw 00000032
Symbol: OSCtxSw
Definitions
At line 123 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 19 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: OSCtxSw used once
OSIntCtxSw 00000040
Symbol: OSIntCtxSw
Definitions
At line 141 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 20 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: OSIntCtxSw used once
OSStartHang 00000030
Symbol: OSStartHang
Definitions
At line 110 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 111 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: OSStartHang used once
OSStartHighRdy 0000000E
Symbol: OSStartHighRdy
Definitions
At line 92 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 18 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: OSStartHighRdy used once
OS_CPU_SR_Restore 00000008
Symbol: OS_CPU_SR_Restore
Definitions
At line 77 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 22 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: OS_CPU_SR_Restore used once
OS_CPU_SR_Save 00000000
Symbol: OS_CPU_SR_Save
Definitions
At line 72 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 21 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: OS_CPU_SR_Save used once
PendSV_Handler 00000050
Symbol: PendSV_Handler
ARM Macro Assembler Page 2 Alphabetic symbol ordering
Relocatable symbols
Definitions
At line 159 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 23 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: PendSV_Handler used once
PendSV_Handler_Nosave 0000006E
Symbol: PendSV_Handler_Nosave
Definitions
At line 177 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 162 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: PendSV_Handler_Nosave used once
9 symbols
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Absolute symbols
NVIC_INT_CTRL E000ED04
Symbol: NVIC_INT_CTRL
Definitions
At line 26 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 105 in file ..\UCOSII\PORT\os_cpu_a.asm
At line 125 in file ..\UCOSII\PORT\os_cpu_a.asm
At line 143 in file ..\UCOSII\PORT\os_cpu_a.asm
NVIC_PENDSVSET 10000000
Symbol: NVIC_PENDSVSET
Definitions
At line 30 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 106 in file ..\UCOSII\PORT\os_cpu_a.asm
At line 126 in file ..\UCOSII\PORT\os_cpu_a.asm
At line 144 in file ..\UCOSII\PORT\os_cpu_a.asm
NVIC_PENDSV_PRI 0000FFFF
Symbol: NVIC_PENDSV_PRI
Definitions
At line 28 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 94 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: NVIC_PENDSV_PRI used once
NVIC_SYSPRI2 E000ED22
Symbol: NVIC_SYSPRI2
Definitions
At line 27 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 93 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: NVIC_SYSPRI2 used once
4 symbols
ARM Macro Assembler Page 1 Alphabetic symbol ordering
External symbols
OSIntExit 00000000
Symbol: OSIntExit
Definitions
At line 15 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
None
Comment: OSIntExit unused
OSIntNesting 00000000
Symbol: OSIntNesting
Definitions
At line 14 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
None
Comment: OSIntNesting unused
OSPrioCur 00000000
Symbol: OSPrioCur
Definitions
At line 10 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 183 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: OSPrioCur used once
OSPrioHighRdy 00000000
Symbol: OSPrioHighRdy
Definitions
At line 11 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 184 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: OSPrioHighRdy used once
OSRunning 00000000
Symbol: OSRunning
Definitions
At line 9 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 100 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: OSRunning used once
OSTCBCur 00000000
Symbol: OSTCBCur
Definitions
At line 12 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 172 in file ..\UCOSII\PORT\os_cpu_a.asm
At line 188 in file ..\UCOSII\PORT\os_cpu_a.asm
OSTCBHighRdy 00000000
Symbol: OSTCBHighRdy
Definitions
At line 13 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 189 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: OSTCBHighRdy used once
OSTaskSwHook 00000000
ARM Macro Assembler Page 2 Alphabetic symbol ordering
External symbols
Symbol: OSTaskSwHook
Definitions
At line 16 in file ..\UCOSII\PORT\os_cpu_a.asm
Uses
At line 179 in file ..\UCOSII\PORT\os_cpu_a.asm
Comment: OSTaskSwHook used once
8 symbols
356 symbols in table