⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_cpu_a.lst

📁 stm32 ucos 精简移殖版本 不需作任何修改直接便可运行。包含串口 定时器
💻 LST
📖 第 1 页 / 共 3 页
字号:
                                                            (causes context swi
                                                            tch)
  149 00000030 F04F 5180       LDR              R1, =NVIC_PENDSVSET
  150 00000034 6001            STR              R1, [R0]
  151 00000036 4770            BX               LR
  152 00000038         
  153 00000038         ;*******************************************************
                       *************************************************
  154 00000038         ;                             PERFORM A CONTEXT SWITCH (
                       From interrupt level)
  155 00000038         ;                                         void OSIntCtxS
                       w(void)
  156 00000038         ;
  157 00000038         ; Notes:    1) OSIntCtxSw() is called by OSIntExit() whe
                       n it determines a context switch is needed as



ARM Macro Assembler    Page 5 


  158 00000038         ;              the result of an interrupt.  This functio
                       n simply triggers a PendSV exception which will
  159 00000038         ;              be handled when there are no more interru
                       pts active and interrupts are enabled.
  160 00000038         ;*******************************************************
                       *************************************************
  161 00000038         
  162 00000038         OSIntCtxSw
  163 00000038 4814            LDR              R0, =NVIC_INT_CTRL ; Trigger th
                                                            e PendSV exception 
                                                            (causes context swi
                                                            tch)
  164 0000003A F04F 5180       LDR              R1, =NVIC_PENDSVSET
  165 0000003E 6001            STR              R1, [R0]
  166 00000040 4770            BX               LR
  167 00000042         
  168 00000042         ;*******************************************************
                       *************************************************
  169 00000042         ;                                         HANDLE PendSV 
                       EXCEPTION
  170 00000042         ;                                     void OS_CPU_PendSV
                       Handler(void)
  171 00000042         ;
  172 00000042         ; Note(s) : 1) PendSV is used to cause a context switch.
                         This is a recommended method for performing
  173 00000042         ;              context switches with Cortex-M3.  This is
                        because the Cortex-M3 auto-saves half of the
  174 00000042         ;              processor context on any exception, and r
                       estores same on return from exception.  So only
  175 00000042         ;              saving of R4-R11 is required and fixing u
                       p the stack pointers.  Using the PendSV exception
  176 00000042         ;              this way means that context saving and re
                       storing is identical whether it is initiated from
  177 00000042         ;              a thread or occurs due to an interrupt or
                        exception.
  178 00000042         ;
  179 00000042         ;           2) Pseudo-code is:
  180 00000042         ;              a) Get the process SP, if 0 then skip (go
                       to d) the saving part (first context switch);
  181 00000042         ;              b) Save remaining regs r4-r11 on process 
                       stack;
  182 00000042         ;              c) Save the process SP in its TCB, OSTCBC
                       ur->OSTCBStkPtr = SP;
  183 00000042         ;              d) Call OSTaskSwHook();
  184 00000042         ;              e) Get current high priority, OSPrioCur =
                        OSPrioHighRdy;
  185 00000042         ;              f) Get current ready thread TCB, OSTCBCur
                        = OSTCBHighRdy;
  186 00000042         ;              g) Get new process SP from TCB, SP = OSTC
                       BHighRdy->OSTCBStkPtr;
  187 00000042         ;              h) Restore R4-R11 from new process stack;
                       
  188 00000042         ;              i) Perform exception return which will re
                       store remaining context.
  189 00000042         ;
  190 00000042         ;           3) On entry into PendSV handler:
  191 00000042         ;              a) The following have been saved on the p
                       rocess stack (by processor):
  192 00000042         ;                 xPSR, PC, LR, R12, R0-R3



ARM Macro Assembler    Page 6 


  193 00000042         ;              b) Processor mode is switched to Handler 
                       mode (from Thread mode)
  194 00000042         ;              c) Stack is Main stack (switched from Pro
                       cess stack)
  195 00000042         ;              d) OSTCBCur      points to the OS_TCB of 
                       the task to suspend
  196 00000042         ;                 OSTCBHighRdy  points to the OS_TCB of 
                       the task to resume
  197 00000042         ;
  198 00000042         ;           4) Since PendSV is set to lowest priority in
                        the system (by OSStartHighRdy() above), we
  199 00000042         ;              know that it will only be run when no oth
                       er exception or interrupt is active, and
  200 00000042         ;              therefore safe to assume that context bei
                       ng switched out was using the process stack (PSP).
  201 00000042         ;*******************************************************
                       *************************************************
  202 00000042         
  203 00000042         OS_CPU_PendSVHandler
  204 00000042 B672            CPSID            I           ; Prevent interrupt
                                                            ion during context 
                                                            switch
  205 00000044 F3EF 8009       MRS              R0, PSP     ; PSP is process st
                                                            ack pointer
  206 00000048 B128            CBZ              R0, OS_CPU_PendSVHandler_nosave
 
                                                            ; Skip register sav
                                                            e the first time
  207 0000004A         
  208 0000004A 3820            SUBS             R0, R0, #0x20 ; Save remaining 
                                                            regs r4-11 on proce
                                                            ss stack
  209 0000004C E880 0FF0       STM              R0, {R4-R11}
  210 00000050         
  211 00000050 490F            LDR              R1, =OSTCBCur ; OSTCBCur->OSTCB
                                                            StkPtr = SP;
  212 00000052 6809            LDR              R1, [R1]
  213 00000054 6008            STR              R0, [R1]    ; R0 is SP of proce
                                                            ss being switched o
                                                            ut
  214 00000056         
  215 00000056         ; At this point, entire context of process has been save
                       d
  216 00000056         OS_CPU_PendSVHandler_nosave
  217 00000056 B500            PUSH             {R14}       ; Save LR exc_retur
                                                            n value
  218 00000058 480E            LDR              R0, =OSTaskSwHook 
                                                            ; OSTaskSwHook();
  219 0000005A 4780            BLX              R0
  220 0000005C F85D EB04       POP              {R14}
  221 00000060         
  222 00000060 480D            LDR              R0, =OSPrioCur ; OSPrioCur = OS
                                                            PrioHighRdy;
  223 00000062 490E            LDR              R1, =OSPrioHighRdy
  224 00000064 780A            LDRB             R2, [R1]
  225 00000066 7002            STRB             R2, [R0]
  226 00000068         
  227 00000068 4809            LDR              R0, =OSTCBCur ; OSTCBCur  = OST
                                                            CBHighRdy;



ARM Macro Assembler    Page 7 


  228 0000006A 490D            LDR              R1, =OSTCBHighRdy
  229 0000006C 680A            LDR              R2, [R1]
  230 0000006E 6002            STR              R2, [R0]
  231 00000070         
  232 00000070 6810            LDR              R0, [R2]    ; R0 is new process
                                                             SP; SP = OSTCBHigh
                                                            Rdy->OSTCBStkPtr;
  233 00000072 E890 0FF0       LDM              R0, {R4-R11} ; Restore r4-11 fr
                                                            om new process stac
                                                            k
  234 00000076 3020            ADDS             R0, R0, #0x20
  235 00000078 F380 8809       MSR              PSP, R0     ; Load PSP with new
                                                             process SP
  236 0000007C F04E 0E04       ORR              LR, LR, #0x04 ; Ensure exceptio
                                                            n return uses proce
                                                            ss stack
  237 00000080 B662            CPSIE            I
  238 00000082 4770            BX               LR          ; Exception return 
                                                            will restore remain
                                                            ing context
  239 00000084         
  240 00000084                 END
              E000ED22 
              00000000 
              E000ED04 
              00000000 
              00000000 
              00000000 
              00000000 
              00000000 
Command Line: --debug --xref --device=DARMSTM --apcs=interwork -o.\output\os_cp
u_a.o -IC:\Keil\ARM\INC\ST\STM32F10x --list=.\rvmdk\os_cpu_a.lst ..\..\..\..\..
\uCOS-II\Ports\ARM-Cortex-M3\Generic\RealView\os_cpu_a.asm



ARM Macro Assembler    Page 1 Alphabetic symbol ordering
Relocatable symbols

.text 00000000

Symbol: .text
   Definitions
      At line 56 in file ..\..\..\..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\Rea
lView\os_cpu_a.asm
   Uses
      None
Comment: .text unused
OSCtxSw 0000002E

Symbol: OSCtxSw
   Definitions
      At line 147 in file ..\..\..\..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\Re
alView\os_cpu_a.asm
   Uses
      At line 39 in file ..\..\..\..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\Rea
lView\os_cpu_a.asm
Comment: OSCtxSw used once
OSIntCtxSw 00000038

Symbol: OSIntCtxSw
   Definitions
      At line 162 in file ..\..\..\..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\Re
alView\os_cpu_a.asm
   Uses
      At line 40 in file ..\..\..\..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\Rea
lView\os_cpu_a.asm
Comment: OSIntCtxSw used once
OSStartHang 0000002C

Symbol: OSStartHang
   Definitions
      At line 135 in file ..\..\..\..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\Re
alView\os_cpu_a.asm
   Uses
      At line 136 in file ..\..\..\..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\Re
alView\os_cpu_a.asm
Comment: OSStartHang used once
OSStartHighRdy 0000000E

Symbol: OSStartHighRdy
   Definitions
      At line 117 in file ..\..\..\..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\Re
alView\os_cpu_a.asm
   Uses
      At line 38 in file ..\..\..\..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\Rea
lView\os_cpu_a.asm
Comment: OSStartHighRdy used once
OS_CPU_PendSVHandler 00000042

Symbol: OS_CPU_PendSVHandler
   Definitions
      At line 203 in file ..\..\..\..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\Re
alView\os_cpu_a.asm

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -