sdf
Dependencies: AvailableMemory mbed-rtos mbed
mbed-rtos/rtx/LPC1768/GCC_ARM/HAL_CM3.s@0:1c8f2727e9f5, 2014-04-03 (annotated)
- Committer:
- y7jin
- Date:
- Thu Apr 03 22:56:32 2014 +0000
- Revision:
- 0:1c8f2727e9f5
hello
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
y7jin | 0:1c8f2727e9f5 | 1 | /*---------------------------------------------------------------------------- |
y7jin | 0:1c8f2727e9f5 | 2 | * RL-ARM - RTX |
y7jin | 0:1c8f2727e9f5 | 3 | *---------------------------------------------------------------------------- |
y7jin | 0:1c8f2727e9f5 | 4 | * Name: HAL_CM3.S |
y7jin | 0:1c8f2727e9f5 | 5 | * Purpose: Hardware Abstraction Layer for Cortex-M3 |
y7jin | 0:1c8f2727e9f5 | 6 | * Rev.: V4.60 |
y7jin | 0:1c8f2727e9f5 | 7 | *---------------------------------------------------------------------------- |
y7jin | 0:1c8f2727e9f5 | 8 | * |
y7jin | 0:1c8f2727e9f5 | 9 | * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH |
y7jin | 0:1c8f2727e9f5 | 10 | * All rights reserved. |
y7jin | 0:1c8f2727e9f5 | 11 | * Redistribution and use in source and binary forms, with or without |
y7jin | 0:1c8f2727e9f5 | 12 | * modification, are permitted provided that the following conditions are met: |
y7jin | 0:1c8f2727e9f5 | 13 | * - Redistributions of source code must retain the above copyright |
y7jin | 0:1c8f2727e9f5 | 14 | * notice, this list of conditions and the following disclaimer. |
y7jin | 0:1c8f2727e9f5 | 15 | * - Redistributions in binary form must reproduce the above copyright |
y7jin | 0:1c8f2727e9f5 | 16 | * notice, this list of conditions and the following disclaimer in the |
y7jin | 0:1c8f2727e9f5 | 17 | * documentation and/or other materials provided with the distribution. |
y7jin | 0:1c8f2727e9f5 | 18 | * - Neither the name of ARM nor the names of its contributors may be used |
y7jin | 0:1c8f2727e9f5 | 19 | * to endorse or promote products derived from this software without |
y7jin | 0:1c8f2727e9f5 | 20 | * specific prior written permission. |
y7jin | 0:1c8f2727e9f5 | 21 | * |
y7jin | 0:1c8f2727e9f5 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
y7jin | 0:1c8f2727e9f5 | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
y7jin | 0:1c8f2727e9f5 | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
y7jin | 0:1c8f2727e9f5 | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
y7jin | 0:1c8f2727e9f5 | 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
y7jin | 0:1c8f2727e9f5 | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
y7jin | 0:1c8f2727e9f5 | 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
y7jin | 0:1c8f2727e9f5 | 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
y7jin | 0:1c8f2727e9f5 | 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
y7jin | 0:1c8f2727e9f5 | 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
y7jin | 0:1c8f2727e9f5 | 32 | * POSSIBILITY OF SUCH DAMAGE. |
y7jin | 0:1c8f2727e9f5 | 33 | *---------------------------------------------------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 34 | |
y7jin | 0:1c8f2727e9f5 | 35 | .file "HAL_CM3.S" |
y7jin | 0:1c8f2727e9f5 | 36 | .syntax unified |
y7jin | 0:1c8f2727e9f5 | 37 | |
y7jin | 0:1c8f2727e9f5 | 38 | .equ TCB_TSTACK, 36 |
y7jin | 0:1c8f2727e9f5 | 39 | |
y7jin | 0:1c8f2727e9f5 | 40 | |
y7jin | 0:1c8f2727e9f5 | 41 | /*---------------------------------------------------------------------------- |
y7jin | 0:1c8f2727e9f5 | 42 | * Functions |
y7jin | 0:1c8f2727e9f5 | 43 | *---------------------------------------------------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 44 | |
y7jin | 0:1c8f2727e9f5 | 45 | .thumb |
y7jin | 0:1c8f2727e9f5 | 46 | |
y7jin | 0:1c8f2727e9f5 | 47 | .section ".text" |
y7jin | 0:1c8f2727e9f5 | 48 | .align 2 |
y7jin | 0:1c8f2727e9f5 | 49 | |
y7jin | 0:1c8f2727e9f5 | 50 | |
y7jin | 0:1c8f2727e9f5 | 51 | /*--------------------------- rt_set_PSP ------------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 52 | |
y7jin | 0:1c8f2727e9f5 | 53 | # void rt_set_PSP (U32 stack); |
y7jin | 0:1c8f2727e9f5 | 54 | |
y7jin | 0:1c8f2727e9f5 | 55 | .thumb_func |
y7jin | 0:1c8f2727e9f5 | 56 | .type rt_set_PSP, %function |
y7jin | 0:1c8f2727e9f5 | 57 | .global rt_set_PSP |
y7jin | 0:1c8f2727e9f5 | 58 | rt_set_PSP: |
y7jin | 0:1c8f2727e9f5 | 59 | .fnstart |
y7jin | 0:1c8f2727e9f5 | 60 | .cantunwind |
y7jin | 0:1c8f2727e9f5 | 61 | |
y7jin | 0:1c8f2727e9f5 | 62 | MSR PSP,R0 |
y7jin | 0:1c8f2727e9f5 | 63 | BX LR |
y7jin | 0:1c8f2727e9f5 | 64 | |
y7jin | 0:1c8f2727e9f5 | 65 | .fnend |
y7jin | 0:1c8f2727e9f5 | 66 | .size rt_set_PSP, .-rt_set_PSP |
y7jin | 0:1c8f2727e9f5 | 67 | |
y7jin | 0:1c8f2727e9f5 | 68 | |
y7jin | 0:1c8f2727e9f5 | 69 | /*--------------------------- rt_get_PSP ------------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 70 | |
y7jin | 0:1c8f2727e9f5 | 71 | # U32 rt_get_PSP (void); |
y7jin | 0:1c8f2727e9f5 | 72 | |
y7jin | 0:1c8f2727e9f5 | 73 | .thumb_func |
y7jin | 0:1c8f2727e9f5 | 74 | .type rt_get_PSP, %function |
y7jin | 0:1c8f2727e9f5 | 75 | .global rt_get_PSP |
y7jin | 0:1c8f2727e9f5 | 76 | rt_get_PSP: |
y7jin | 0:1c8f2727e9f5 | 77 | .fnstart |
y7jin | 0:1c8f2727e9f5 | 78 | .cantunwind |
y7jin | 0:1c8f2727e9f5 | 79 | |
y7jin | 0:1c8f2727e9f5 | 80 | MRS R0,PSP |
y7jin | 0:1c8f2727e9f5 | 81 | BX LR |
y7jin | 0:1c8f2727e9f5 | 82 | |
y7jin | 0:1c8f2727e9f5 | 83 | .fnend |
y7jin | 0:1c8f2727e9f5 | 84 | .size rt_get_PSP, .-rt_get_PSP |
y7jin | 0:1c8f2727e9f5 | 85 | |
y7jin | 0:1c8f2727e9f5 | 86 | |
y7jin | 0:1c8f2727e9f5 | 87 | /*--------------------------- os_set_env ------------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 88 | |
y7jin | 0:1c8f2727e9f5 | 89 | # void os_set_env (void); |
y7jin | 0:1c8f2727e9f5 | 90 | /* Switch to Unprivileged/Privileged Thread mode, use PSP. */ |
y7jin | 0:1c8f2727e9f5 | 91 | |
y7jin | 0:1c8f2727e9f5 | 92 | .thumb_func |
y7jin | 0:1c8f2727e9f5 | 93 | .type os_set_env, %function |
y7jin | 0:1c8f2727e9f5 | 94 | .global os_set_env |
y7jin | 0:1c8f2727e9f5 | 95 | os_set_env: |
y7jin | 0:1c8f2727e9f5 | 96 | .fnstart |
y7jin | 0:1c8f2727e9f5 | 97 | .cantunwind |
y7jin | 0:1c8f2727e9f5 | 98 | |
y7jin | 0:1c8f2727e9f5 | 99 | MOV R0,SP /* PSP = MSP */ |
y7jin | 0:1c8f2727e9f5 | 100 | MSR PSP,R0 |
y7jin | 0:1c8f2727e9f5 | 101 | LDR R0,=os_flags |
y7jin | 0:1c8f2727e9f5 | 102 | LDRB R0,[R0] |
y7jin | 0:1c8f2727e9f5 | 103 | LSLS R0,#31 |
y7jin | 0:1c8f2727e9f5 | 104 | ITE NE |
y7jin | 0:1c8f2727e9f5 | 105 | MOVNE R0,#0x02 /* Privileged Thread mode, use PSP */ |
y7jin | 0:1c8f2727e9f5 | 106 | MOVEQ R0,#0x03 /* Unprivileged Thread mode, use PSP */ |
y7jin | 0:1c8f2727e9f5 | 107 | MSR CONTROL,R0 |
y7jin | 0:1c8f2727e9f5 | 108 | BX LR |
y7jin | 0:1c8f2727e9f5 | 109 | |
y7jin | 0:1c8f2727e9f5 | 110 | .fnend |
y7jin | 0:1c8f2727e9f5 | 111 | .size os_set_env, .-os_set_env |
y7jin | 0:1c8f2727e9f5 | 112 | |
y7jin | 0:1c8f2727e9f5 | 113 | |
y7jin | 0:1c8f2727e9f5 | 114 | /*--------------------------- _alloc_box ------------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 115 | |
y7jin | 0:1c8f2727e9f5 | 116 | # void *_alloc_box (void *box_mem); |
y7jin | 0:1c8f2727e9f5 | 117 | /* Function wrapper for Unprivileged/Privileged mode. */ |
y7jin | 0:1c8f2727e9f5 | 118 | |
y7jin | 0:1c8f2727e9f5 | 119 | .thumb_func |
y7jin | 0:1c8f2727e9f5 | 120 | .type _alloc_box, %function |
y7jin | 0:1c8f2727e9f5 | 121 | .global _alloc_box |
y7jin | 0:1c8f2727e9f5 | 122 | _alloc_box: |
y7jin | 0:1c8f2727e9f5 | 123 | .fnstart |
y7jin | 0:1c8f2727e9f5 | 124 | .cantunwind |
y7jin | 0:1c8f2727e9f5 | 125 | |
y7jin | 0:1c8f2727e9f5 | 126 | LDR R12,=rt_alloc_box |
y7jin | 0:1c8f2727e9f5 | 127 | MRS R3,IPSR |
y7jin | 0:1c8f2727e9f5 | 128 | LSLS R3,#24 |
y7jin | 0:1c8f2727e9f5 | 129 | IT NE |
y7jin | 0:1c8f2727e9f5 | 130 | BXNE R12 |
y7jin | 0:1c8f2727e9f5 | 131 | MRS R3,CONTROL |
y7jin | 0:1c8f2727e9f5 | 132 | LSLS R3,#31 |
y7jin | 0:1c8f2727e9f5 | 133 | IT EQ |
y7jin | 0:1c8f2727e9f5 | 134 | BXEQ R12 |
y7jin | 0:1c8f2727e9f5 | 135 | SVC 0 |
y7jin | 0:1c8f2727e9f5 | 136 | BX LR |
y7jin | 0:1c8f2727e9f5 | 137 | |
y7jin | 0:1c8f2727e9f5 | 138 | .fnend |
y7jin | 0:1c8f2727e9f5 | 139 | .size _alloc_box, .-_alloc_box |
y7jin | 0:1c8f2727e9f5 | 140 | |
y7jin | 0:1c8f2727e9f5 | 141 | |
y7jin | 0:1c8f2727e9f5 | 142 | /*--------------------------- _free_box -------------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 143 | |
y7jin | 0:1c8f2727e9f5 | 144 | # int _free_box (void *box_mem, void *box); |
y7jin | 0:1c8f2727e9f5 | 145 | /* Function wrapper for Unprivileged/Privileged mode. */ |
y7jin | 0:1c8f2727e9f5 | 146 | |
y7jin | 0:1c8f2727e9f5 | 147 | .thumb_func |
y7jin | 0:1c8f2727e9f5 | 148 | .type _free_box, %function |
y7jin | 0:1c8f2727e9f5 | 149 | .global _free_box |
y7jin | 0:1c8f2727e9f5 | 150 | _free_box: |
y7jin | 0:1c8f2727e9f5 | 151 | .fnstart |
y7jin | 0:1c8f2727e9f5 | 152 | .cantunwind |
y7jin | 0:1c8f2727e9f5 | 153 | |
y7jin | 0:1c8f2727e9f5 | 154 | LDR R12,=rt_free_box |
y7jin | 0:1c8f2727e9f5 | 155 | MRS R3,IPSR |
y7jin | 0:1c8f2727e9f5 | 156 | LSLS R3,#24 |
y7jin | 0:1c8f2727e9f5 | 157 | IT NE |
y7jin | 0:1c8f2727e9f5 | 158 | BXNE R12 |
y7jin | 0:1c8f2727e9f5 | 159 | MRS R3,CONTROL |
y7jin | 0:1c8f2727e9f5 | 160 | LSLS R3,#31 |
y7jin | 0:1c8f2727e9f5 | 161 | IT EQ |
y7jin | 0:1c8f2727e9f5 | 162 | BXEQ R12 |
y7jin | 0:1c8f2727e9f5 | 163 | SVC 0 |
y7jin | 0:1c8f2727e9f5 | 164 | BX LR |
y7jin | 0:1c8f2727e9f5 | 165 | |
y7jin | 0:1c8f2727e9f5 | 166 | .fnend |
y7jin | 0:1c8f2727e9f5 | 167 | .size _free_box, .-_free_box |
y7jin | 0:1c8f2727e9f5 | 168 | |
y7jin | 0:1c8f2727e9f5 | 169 | |
y7jin | 0:1c8f2727e9f5 | 170 | /*-------------------------- SVC_Handler ------------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 171 | |
y7jin | 0:1c8f2727e9f5 | 172 | # void SVC_Handler (void); |
y7jin | 0:1c8f2727e9f5 | 173 | |
y7jin | 0:1c8f2727e9f5 | 174 | .thumb_func |
y7jin | 0:1c8f2727e9f5 | 175 | .type SVC_Handler, %function |
y7jin | 0:1c8f2727e9f5 | 176 | .global SVC_Handler |
y7jin | 0:1c8f2727e9f5 | 177 | SVC_Handler: |
y7jin | 0:1c8f2727e9f5 | 178 | .fnstart |
y7jin | 0:1c8f2727e9f5 | 179 | .cantunwind |
y7jin | 0:1c8f2727e9f5 | 180 | |
y7jin | 0:1c8f2727e9f5 | 181 | MRS R0,PSP /* Read PSP */ |
y7jin | 0:1c8f2727e9f5 | 182 | LDR R1,[R0,#24] /* Read Saved PC from Stack */ |
y7jin | 0:1c8f2727e9f5 | 183 | LDRB R1,[R1,#-2] /* Load SVC Number */ |
y7jin | 0:1c8f2727e9f5 | 184 | CBNZ R1,SVC_User |
y7jin | 0:1c8f2727e9f5 | 185 | |
y7jin | 0:1c8f2727e9f5 | 186 | LDM R0,{R0-R3,R12} /* Read R0-R3,R12 from stack */ |
y7jin | 0:1c8f2727e9f5 | 187 | BLX R12 /* Call SVC Function */ |
y7jin | 0:1c8f2727e9f5 | 188 | |
y7jin | 0:1c8f2727e9f5 | 189 | MRS R12,PSP /* Read PSP */ |
y7jin | 0:1c8f2727e9f5 | 190 | STM R12,{R0-R2} /* Store return values */ |
y7jin | 0:1c8f2727e9f5 | 191 | |
y7jin | 0:1c8f2727e9f5 | 192 | LDR R3,=os_tsk |
y7jin | 0:1c8f2727e9f5 | 193 | LDM R3,{R1,R2} /* os_tsk.run, os_tsk.new */ |
y7jin | 0:1c8f2727e9f5 | 194 | CMP R1,R2 |
y7jin | 0:1c8f2727e9f5 | 195 | BEQ SVC_Exit /* no task switch */ |
y7jin | 0:1c8f2727e9f5 | 196 | |
y7jin | 0:1c8f2727e9f5 | 197 | CBZ R1,SVC_Next /* Runtask deleted? */ |
y7jin | 0:1c8f2727e9f5 | 198 | STMDB R12!,{R4-R11} /* Save Old context */ |
y7jin | 0:1c8f2727e9f5 | 199 | STR R12,[R1,#TCB_TSTACK] /* Update os_tsk.run->tsk_stack */ |
y7jin | 0:1c8f2727e9f5 | 200 | |
y7jin | 0:1c8f2727e9f5 | 201 | PUSH {R2,R3} |
y7jin | 0:1c8f2727e9f5 | 202 | BL rt_stk_check /* Check for Stack overflow */ |
y7jin | 0:1c8f2727e9f5 | 203 | POP {R2,R3} |
y7jin | 0:1c8f2727e9f5 | 204 | |
y7jin | 0:1c8f2727e9f5 | 205 | SVC_Next: |
y7jin | 0:1c8f2727e9f5 | 206 | STR R2,[R3] /* os_tsk.run = os_tsk.new */ |
y7jin | 0:1c8f2727e9f5 | 207 | |
y7jin | 0:1c8f2727e9f5 | 208 | LDR R12,[R2,#TCB_TSTACK] /* os_tsk.new->tsk_stack */ |
y7jin | 0:1c8f2727e9f5 | 209 | LDMIA R12!,{R4-R11} /* Restore New Context */ |
y7jin | 0:1c8f2727e9f5 | 210 | MSR PSP,R12 /* Write PSP */ |
y7jin | 0:1c8f2727e9f5 | 211 | |
y7jin | 0:1c8f2727e9f5 | 212 | SVC_Exit: |
y7jin | 0:1c8f2727e9f5 | 213 | MVN LR,#~0xFFFFFFFD /* set EXC_RETURN value */ |
y7jin | 0:1c8f2727e9f5 | 214 | BX LR |
y7jin | 0:1c8f2727e9f5 | 215 | |
y7jin | 0:1c8f2727e9f5 | 216 | /*------------------- User SVC ------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 217 | |
y7jin | 0:1c8f2727e9f5 | 218 | SVC_User: |
y7jin | 0:1c8f2727e9f5 | 219 | PUSH {R4,LR} /* Save Registers */ |
y7jin | 0:1c8f2727e9f5 | 220 | LDR R2,=SVC_Count |
y7jin | 0:1c8f2727e9f5 | 221 | LDR R2,[R2] |
y7jin | 0:1c8f2727e9f5 | 222 | CMP R1,R2 |
y7jin | 0:1c8f2727e9f5 | 223 | BHI SVC_Done /* Overflow */ |
y7jin | 0:1c8f2727e9f5 | 224 | |
y7jin | 0:1c8f2727e9f5 | 225 | LDR R4,=SVC_Table-4 |
y7jin | 0:1c8f2727e9f5 | 226 | LDR R4,[R4,R1,LSL #2] /* Load SVC Function Address */ |
y7jin | 0:1c8f2727e9f5 | 227 | |
y7jin | 0:1c8f2727e9f5 | 228 | LDM R0,{R0-R3,R12} /* Read R0-R3,R12 from stack */ |
y7jin | 0:1c8f2727e9f5 | 229 | BLX R4 /* Call SVC Function */ |
y7jin | 0:1c8f2727e9f5 | 230 | |
y7jin | 0:1c8f2727e9f5 | 231 | MRS R12,PSP |
y7jin | 0:1c8f2727e9f5 | 232 | STM R12,{R0-R3} /* Function return values */ |
y7jin | 0:1c8f2727e9f5 | 233 | SVC_Done: |
y7jin | 0:1c8f2727e9f5 | 234 | POP {R4,PC} /* RETI */ |
y7jin | 0:1c8f2727e9f5 | 235 | |
y7jin | 0:1c8f2727e9f5 | 236 | .fnend |
y7jin | 0:1c8f2727e9f5 | 237 | .size SVC_Handler, .-SVC_Handler |
y7jin | 0:1c8f2727e9f5 | 238 | |
y7jin | 0:1c8f2727e9f5 | 239 | |
y7jin | 0:1c8f2727e9f5 | 240 | /*-------------------------- PendSV_Handler ---------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 241 | |
y7jin | 0:1c8f2727e9f5 | 242 | # void PendSV_Handler (void); |
y7jin | 0:1c8f2727e9f5 | 243 | |
y7jin | 0:1c8f2727e9f5 | 244 | .thumb_func |
y7jin | 0:1c8f2727e9f5 | 245 | .type PendSV_Handler, %function |
y7jin | 0:1c8f2727e9f5 | 246 | .global PendSV_Handler |
y7jin | 0:1c8f2727e9f5 | 247 | .global Sys_Switch |
y7jin | 0:1c8f2727e9f5 | 248 | PendSV_Handler: |
y7jin | 0:1c8f2727e9f5 | 249 | .fnstart |
y7jin | 0:1c8f2727e9f5 | 250 | .cantunwind |
y7jin | 0:1c8f2727e9f5 | 251 | |
y7jin | 0:1c8f2727e9f5 | 252 | BL rt_pop_req |
y7jin | 0:1c8f2727e9f5 | 253 | |
y7jin | 0:1c8f2727e9f5 | 254 | Sys_Switch: |
y7jin | 0:1c8f2727e9f5 | 255 | LDR R3,=os_tsk |
y7jin | 0:1c8f2727e9f5 | 256 | LDM R3,{R1,R2} /* os_tsk.run, os_tsk.new */ |
y7jin | 0:1c8f2727e9f5 | 257 | CMP R1,R2 |
y7jin | 0:1c8f2727e9f5 | 258 | BEQ Sys_Exit |
y7jin | 0:1c8f2727e9f5 | 259 | |
y7jin | 0:1c8f2727e9f5 | 260 | MRS R12,PSP /* Read PSP */ |
y7jin | 0:1c8f2727e9f5 | 261 | STMDB R12!,{R4-R11} /* Save Old context */ |
y7jin | 0:1c8f2727e9f5 | 262 | STR R12,[R1,#TCB_TSTACK] /* Update os_tsk.run->tsk_stack */ |
y7jin | 0:1c8f2727e9f5 | 263 | |
y7jin | 0:1c8f2727e9f5 | 264 | PUSH {R2,R3} |
y7jin | 0:1c8f2727e9f5 | 265 | BL rt_stk_check /* Check for Stack overflow */ |
y7jin | 0:1c8f2727e9f5 | 266 | POP {R2,R3} |
y7jin | 0:1c8f2727e9f5 | 267 | |
y7jin | 0:1c8f2727e9f5 | 268 | STR R2,[R3] /* os_tsk.run = os_tsk.new */ |
y7jin | 0:1c8f2727e9f5 | 269 | |
y7jin | 0:1c8f2727e9f5 | 270 | LDR R12,[R2,#TCB_TSTACK] /* os_tsk.new->tsk_stack */ |
y7jin | 0:1c8f2727e9f5 | 271 | LDMIA R12!,{R4-R11} /* Restore New Context */ |
y7jin | 0:1c8f2727e9f5 | 272 | MSR PSP,R12 /* Write PSP */ |
y7jin | 0:1c8f2727e9f5 | 273 | |
y7jin | 0:1c8f2727e9f5 | 274 | Sys_Exit: |
y7jin | 0:1c8f2727e9f5 | 275 | MVN LR,#~0xFFFFFFFD /* set EXC_RETURN value */ |
y7jin | 0:1c8f2727e9f5 | 276 | BX LR /* Return to Thread Mode */ |
y7jin | 0:1c8f2727e9f5 | 277 | |
y7jin | 0:1c8f2727e9f5 | 278 | .fnend |
y7jin | 0:1c8f2727e9f5 | 279 | .size PendSV_Handler, .-PendSV_Handler |
y7jin | 0:1c8f2727e9f5 | 280 | |
y7jin | 0:1c8f2727e9f5 | 281 | |
y7jin | 0:1c8f2727e9f5 | 282 | /*-------------------------- SysTick_Handler --------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 283 | |
y7jin | 0:1c8f2727e9f5 | 284 | # void SysTick_Handler (void); |
y7jin | 0:1c8f2727e9f5 | 285 | |
y7jin | 0:1c8f2727e9f5 | 286 | .thumb_func |
y7jin | 0:1c8f2727e9f5 | 287 | .type SysTick_Handler, %function |
y7jin | 0:1c8f2727e9f5 | 288 | .global SysTick_Handler |
y7jin | 0:1c8f2727e9f5 | 289 | SysTick_Handler: |
y7jin | 0:1c8f2727e9f5 | 290 | .fnstart |
y7jin | 0:1c8f2727e9f5 | 291 | .cantunwind |
y7jin | 0:1c8f2727e9f5 | 292 | |
y7jin | 0:1c8f2727e9f5 | 293 | BL rt_systick |
y7jin | 0:1c8f2727e9f5 | 294 | B Sys_Switch |
y7jin | 0:1c8f2727e9f5 | 295 | |
y7jin | 0:1c8f2727e9f5 | 296 | .fnend |
y7jin | 0:1c8f2727e9f5 | 297 | .size SysTick_Handler, .-SysTick_Handler |
y7jin | 0:1c8f2727e9f5 | 298 | |
y7jin | 0:1c8f2727e9f5 | 299 | |
y7jin | 0:1c8f2727e9f5 | 300 | /*-------------------------- OS_Tick_Handler --------------------------------*/ |
y7jin | 0:1c8f2727e9f5 | 301 | |
y7jin | 0:1c8f2727e9f5 | 302 | # void OS_Tick_Handler (void); |
y7jin | 0:1c8f2727e9f5 | 303 | |
y7jin | 0:1c8f2727e9f5 | 304 | .thumb_func |
y7jin | 0:1c8f2727e9f5 | 305 | .type OS_Tick_Handler, %function |
y7jin | 0:1c8f2727e9f5 | 306 | .global OS_Tick_Handler |
y7jin | 0:1c8f2727e9f5 | 307 | OS_Tick_Handler: |
y7jin | 0:1c8f2727e9f5 | 308 | .fnstart |
y7jin | 0:1c8f2727e9f5 | 309 | .cantunwind |
y7jin | 0:1c8f2727e9f5 | 310 | |
y7jin | 0:1c8f2727e9f5 | 311 | BL os_tick_irqack |
y7jin | 0:1c8f2727e9f5 | 312 | BL rt_systick |
y7jin | 0:1c8f2727e9f5 | 313 | B Sys_Switch |
y7jin | 0:1c8f2727e9f5 | 314 | |
y7jin | 0:1c8f2727e9f5 | 315 | .fnend |
y7jin | 0:1c8f2727e9f5 | 316 | .size OS_Tick_Handler, .-OS_Tick_Handler |
y7jin | 0:1c8f2727e9f5 | 317 | |
y7jin | 0:1c8f2727e9f5 | 318 | |
y7jin | 0:1c8f2727e9f5 | 319 | .end |
y7jin | 0:1c8f2727e9f5 | 320 | |
y7jin | 0:1c8f2727e9f5 | 321 | /*---------------------------------------------------------------------------- |
y7jin | 0:1c8f2727e9f5 | 322 | * end of file |
y7jin | 0:1c8f2727e9f5 | 323 | *---------------------------------------------------------------------------*/ |