Official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard.
Dependents: denki-yohou_b TestY201 Network-RTOS NTPClient_HelloWorld ... more
Deprecated
This is the mbed 2 rtos library. mbed OS 5 integrates the mbed library with mbed-rtos. With this, we have provided thread safety for all mbed APIs. If you'd like to learn about using mbed OS 5, please see the docs.
rtx/TARGET_CORTEX_M/TARGET_RTOS_M4_M7/TOOLCHAIN_GCC/HAL_CM4.S@112:53ace74b190c, 2016-05-05 (annotated)
- Committer:
- mbed_official
- Date:
- Thu May 05 20:45:13 2016 +0100
- Revision:
- 112:53ace74b190c
- Parent:
- 101:3d9d2b8b8f17
Synchronized with git revision 860fdd282b0dc3631a6c46b39442d4ab5343e534
Full URL: https://github.com/mbedmicro/mbed/commit/860fdd282b0dc3631a6c46b39442d4ab5343e534/
rtx update to v4.79
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 49:77c8e4604045 | 1 | /*---------------------------------------------------------------------------- |
mbed_official | 112:53ace74b190c | 2 | * CMSIS-RTOS - RTX |
mbed_official | 49:77c8e4604045 | 3 | *---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 4 | * Name: HAL_CM4.S |
mbed_official | 49:77c8e4604045 | 5 | * Purpose: Hardware Abstraction Layer for Cortex-M4 |
mbed_official | 112:53ace74b190c | 6 | * Rev.: V4.79 |
mbed_official | 49:77c8e4604045 | 7 | *---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 8 | * |
mbed_official | 112:53ace74b190c | 9 | * Copyright (c) 1999-2009 KEIL, 2009-2015 ARM Germany GmbH |
mbed_official | 49:77c8e4604045 | 10 | * All rights reserved. |
mbed_official | 49:77c8e4604045 | 11 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 49:77c8e4604045 | 12 | * modification, are permitted provided that the following conditions are met: |
mbed_official | 49:77c8e4604045 | 13 | * - Redistributions of source code must retain the above copyright |
mbed_official | 49:77c8e4604045 | 14 | * notice, this list of conditions and the following disclaimer. |
mbed_official | 49:77c8e4604045 | 15 | * - Redistributions in binary form must reproduce the above copyright |
mbed_official | 49:77c8e4604045 | 16 | * notice, this list of conditions and the following disclaimer in the |
mbed_official | 49:77c8e4604045 | 17 | * documentation and/or other materials provided with the distribution. |
mbed_official | 68:d3d0e710b443 | 18 | * - Neither the name of ARM nor the names of its contributors may be used |
mbed_official | 68:d3d0e710b443 | 19 | * to endorse or promote products derived from this software without |
mbed_official | 49:77c8e4604045 | 20 | * specific prior written permission. |
mbed_official | 49:77c8e4604045 | 21 | * |
mbed_official | 68:d3d0e710b443 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 68:d3d0e710b443 | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 49:77c8e4604045 | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
mbed_official | 49:77c8e4604045 | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
mbed_official | 49:77c8e4604045 | 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
mbed_official | 68:d3d0e710b443 | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
mbed_official | 68:d3d0e710b443 | 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
mbed_official | 68:d3d0e710b443 | 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
mbed_official | 68:d3d0e710b443 | 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
mbed_official | 49:77c8e4604045 | 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
mbed_official | 49:77c8e4604045 | 32 | * POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 49:77c8e4604045 | 33 | *---------------------------------------------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 34 | |
mbed_official | 49:77c8e4604045 | 35 | .file "HAL_CM4.S" |
mbed_official | 49:77c8e4604045 | 36 | .syntax unified |
mbed_official | 49:77c8e4604045 | 37 | |
mbed_official | 112:53ace74b190c | 38 | .equ TCB_STACKF, 37 |
mbed_official | 112:53ace74b190c | 39 | .equ TCB_TSTACK, 44 |
mbed_official | 49:77c8e4604045 | 40 | |
mbed_official | 49:77c8e4604045 | 41 | |
mbed_official | 49:77c8e4604045 | 42 | /*---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 43 | * Functions |
mbed_official | 49:77c8e4604045 | 44 | *---------------------------------------------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 45 | |
mbed_official | 49:77c8e4604045 | 46 | .thumb |
mbed_official | 49:77c8e4604045 | 47 | |
mbed_official | 49:77c8e4604045 | 48 | .section ".text" |
mbed_official | 49:77c8e4604045 | 49 | .align 2 |
mbed_official | 49:77c8e4604045 | 50 | |
mbed_official | 49:77c8e4604045 | 51 | |
mbed_official | 49:77c8e4604045 | 52 | /*--------------------------- rt_set_PSP ------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 53 | |
mbed_official | 49:77c8e4604045 | 54 | # void rt_set_PSP (U32 stack); |
mbed_official | 49:77c8e4604045 | 55 | |
mbed_official | 49:77c8e4604045 | 56 | .thumb_func |
mbed_official | 49:77c8e4604045 | 57 | .type rt_set_PSP, %function |
mbed_official | 49:77c8e4604045 | 58 | .global rt_set_PSP |
mbed_official | 49:77c8e4604045 | 59 | rt_set_PSP: |
mbed_official | 49:77c8e4604045 | 60 | .fnstart |
mbed_official | 49:77c8e4604045 | 61 | .cantunwind |
mbed_official | 49:77c8e4604045 | 62 | |
mbed_official | 49:77c8e4604045 | 63 | MSR PSP,R0 |
mbed_official | 49:77c8e4604045 | 64 | BX LR |
mbed_official | 49:77c8e4604045 | 65 | |
mbed_official | 49:77c8e4604045 | 66 | .fnend |
mbed_official | 49:77c8e4604045 | 67 | .size rt_set_PSP, .-rt_set_PSP |
mbed_official | 49:77c8e4604045 | 68 | |
mbed_official | 49:77c8e4604045 | 69 | |
mbed_official | 49:77c8e4604045 | 70 | /*--------------------------- rt_get_PSP ------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 71 | |
mbed_official | 49:77c8e4604045 | 72 | # U32 rt_get_PSP (void); |
mbed_official | 49:77c8e4604045 | 73 | |
mbed_official | 49:77c8e4604045 | 74 | .thumb_func |
mbed_official | 49:77c8e4604045 | 75 | .type rt_get_PSP, %function |
mbed_official | 49:77c8e4604045 | 76 | .global rt_get_PSP |
mbed_official | 49:77c8e4604045 | 77 | rt_get_PSP: |
mbed_official | 49:77c8e4604045 | 78 | .fnstart |
mbed_official | 49:77c8e4604045 | 79 | .cantunwind |
mbed_official | 49:77c8e4604045 | 80 | |
mbed_official | 49:77c8e4604045 | 81 | MRS R0,PSP |
mbed_official | 49:77c8e4604045 | 82 | BX LR |
mbed_official | 49:77c8e4604045 | 83 | |
mbed_official | 49:77c8e4604045 | 84 | .fnend |
mbed_official | 49:77c8e4604045 | 85 | .size rt_get_PSP, .-rt_get_PSP |
mbed_official | 49:77c8e4604045 | 86 | |
mbed_official | 49:77c8e4604045 | 87 | |
mbed_official | 49:77c8e4604045 | 88 | /*--------------------------- os_set_env ------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 89 | |
mbed_official | 49:77c8e4604045 | 90 | # void os_set_env (void); |
mbed_official | 49:77c8e4604045 | 91 | /* Switch to Unprivileged/Privileged Thread mode, use PSP. */ |
mbed_official | 49:77c8e4604045 | 92 | |
mbed_official | 49:77c8e4604045 | 93 | .thumb_func |
mbed_official | 49:77c8e4604045 | 94 | .type os_set_env, %function |
mbed_official | 49:77c8e4604045 | 95 | .global os_set_env |
mbed_official | 49:77c8e4604045 | 96 | os_set_env: |
mbed_official | 49:77c8e4604045 | 97 | .fnstart |
mbed_official | 49:77c8e4604045 | 98 | .cantunwind |
mbed_official | 49:77c8e4604045 | 99 | |
mbed_official | 49:77c8e4604045 | 100 | MOV R0,SP /* PSP = MSP */ |
mbed_official | 49:77c8e4604045 | 101 | MSR PSP,R0 |
mbed_official | 49:77c8e4604045 | 102 | LDR R0,=os_flags |
mbed_official | 49:77c8e4604045 | 103 | LDRB R0,[R0] |
mbed_official | 49:77c8e4604045 | 104 | LSLS R0,#31 |
mbed_official | 49:77c8e4604045 | 105 | ITE NE |
mbed_official | 49:77c8e4604045 | 106 | MOVNE R0,#0x02 /* Privileged Thread mode, use PSP */ |
mbed_official | 49:77c8e4604045 | 107 | MOVEQ R0,#0x03 /* Unprivileged Thread mode, use PSP */ |
mbed_official | 49:77c8e4604045 | 108 | MSR CONTROL,R0 |
mbed_official | 49:77c8e4604045 | 109 | BX LR |
mbed_official | 49:77c8e4604045 | 110 | |
mbed_official | 49:77c8e4604045 | 111 | .fnend |
mbed_official | 49:77c8e4604045 | 112 | .size os_set_env, .-os_set_env |
mbed_official | 49:77c8e4604045 | 113 | |
mbed_official | 49:77c8e4604045 | 114 | |
mbed_official | 49:77c8e4604045 | 115 | /*--------------------------- _alloc_box ------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 116 | |
mbed_official | 49:77c8e4604045 | 117 | # void *_alloc_box (void *box_mem); |
mbed_official | 49:77c8e4604045 | 118 | /* Function wrapper for Unprivileged/Privileged mode. */ |
mbed_official | 49:77c8e4604045 | 119 | |
mbed_official | 49:77c8e4604045 | 120 | .thumb_func |
mbed_official | 49:77c8e4604045 | 121 | .type _alloc_box, %function |
mbed_official | 49:77c8e4604045 | 122 | .global _alloc_box |
mbed_official | 49:77c8e4604045 | 123 | _alloc_box: |
mbed_official | 49:77c8e4604045 | 124 | .fnstart |
mbed_official | 49:77c8e4604045 | 125 | .cantunwind |
mbed_official | 49:77c8e4604045 | 126 | |
mbed_official | 49:77c8e4604045 | 127 | LDR R12,=rt_alloc_box |
mbed_official | 49:77c8e4604045 | 128 | MRS R3,IPSR |
mbed_official | 49:77c8e4604045 | 129 | LSLS R3,#24 |
mbed_official | 49:77c8e4604045 | 130 | IT NE |
mbed_official | 49:77c8e4604045 | 131 | BXNE R12 |
mbed_official | 49:77c8e4604045 | 132 | MRS R3,CONTROL |
mbed_official | 49:77c8e4604045 | 133 | LSLS R3,#31 |
mbed_official | 49:77c8e4604045 | 134 | IT EQ |
mbed_official | 49:77c8e4604045 | 135 | BXEQ R12 |
mbed_official | 49:77c8e4604045 | 136 | SVC 0 |
mbed_official | 49:77c8e4604045 | 137 | BX LR |
mbed_official | 49:77c8e4604045 | 138 | |
mbed_official | 49:77c8e4604045 | 139 | .fnend |
mbed_official | 49:77c8e4604045 | 140 | .size _alloc_box, .-_alloc_box |
mbed_official | 49:77c8e4604045 | 141 | |
mbed_official | 49:77c8e4604045 | 142 | |
mbed_official | 49:77c8e4604045 | 143 | /*--------------------------- _free_box -------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 144 | |
mbed_official | 112:53ace74b190c | 145 | # U32 _free_box (void *box_mem, void *box); |
mbed_official | 49:77c8e4604045 | 146 | /* Function wrapper for Unprivileged/Privileged mode. */ |
mbed_official | 49:77c8e4604045 | 147 | |
mbed_official | 49:77c8e4604045 | 148 | .thumb_func |
mbed_official | 49:77c8e4604045 | 149 | .type _free_box, %function |
mbed_official | 49:77c8e4604045 | 150 | .global _free_box |
mbed_official | 49:77c8e4604045 | 151 | _free_box: |
mbed_official | 49:77c8e4604045 | 152 | .fnstart |
mbed_official | 49:77c8e4604045 | 153 | .cantunwind |
mbed_official | 49:77c8e4604045 | 154 | |
mbed_official | 49:77c8e4604045 | 155 | LDR R12,=rt_free_box |
mbed_official | 49:77c8e4604045 | 156 | MRS R3,IPSR |
mbed_official | 49:77c8e4604045 | 157 | LSLS R3,#24 |
mbed_official | 49:77c8e4604045 | 158 | IT NE |
mbed_official | 49:77c8e4604045 | 159 | BXNE R12 |
mbed_official | 49:77c8e4604045 | 160 | MRS R3,CONTROL |
mbed_official | 49:77c8e4604045 | 161 | LSLS R3,#31 |
mbed_official | 49:77c8e4604045 | 162 | IT EQ |
mbed_official | 49:77c8e4604045 | 163 | BXEQ R12 |
mbed_official | 49:77c8e4604045 | 164 | SVC 0 |
mbed_official | 49:77c8e4604045 | 165 | BX LR |
mbed_official | 49:77c8e4604045 | 166 | |
mbed_official | 49:77c8e4604045 | 167 | .fnend |
mbed_official | 49:77c8e4604045 | 168 | .size _free_box, .-_free_box |
mbed_official | 49:77c8e4604045 | 169 | |
mbed_official | 49:77c8e4604045 | 170 | |
mbed_official | 49:77c8e4604045 | 171 | /*-------------------------- SVC_Handler ------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 172 | |
mbed_official | 49:77c8e4604045 | 173 | # void SVC_Handler (void); |
mbed_official | 49:77c8e4604045 | 174 | |
mbed_official | 49:77c8e4604045 | 175 | .thumb_func |
mbed_official | 49:77c8e4604045 | 176 | .type SVC_Handler, %function |
mbed_official | 49:77c8e4604045 | 177 | .global SVC_Handler |
mbed_official | 49:77c8e4604045 | 178 | SVC_Handler: |
mbed_official | 49:77c8e4604045 | 179 | .ifdef IFX_XMC4XXX |
mbed_official | 49:77c8e4604045 | 180 | .global SVC_Handler_Veneer |
mbed_official | 49:77c8e4604045 | 181 | SVC_Handler_Veneer: |
mbed_official | 49:77c8e4604045 | 182 | .endif |
mbed_official | 49:77c8e4604045 | 183 | .fnstart |
mbed_official | 49:77c8e4604045 | 184 | .cantunwind |
mbed_official | 49:77c8e4604045 | 185 | |
mbed_official | 49:77c8e4604045 | 186 | MRS R0,PSP /* Read PSP */ |
mbed_official | 49:77c8e4604045 | 187 | LDR R1,[R0,#24] /* Read Saved PC from Stack */ |
mbed_official | 49:77c8e4604045 | 188 | LDRB R1,[R1,#-2] /* Load SVC Number */ |
mbed_official | 49:77c8e4604045 | 189 | CBNZ R1,SVC_User |
mbed_official | 49:77c8e4604045 | 190 | |
mbed_official | 49:77c8e4604045 | 191 | LDM R0,{R0-R3,R12} /* Read R0-R3,R12 from stack */ |
mbed_official | 49:77c8e4604045 | 192 | PUSH {R4,LR} /* Save EXC_RETURN */ |
mbed_official | 49:77c8e4604045 | 193 | BLX R12 /* Call SVC Function */ |
mbed_official | 49:77c8e4604045 | 194 | POP {R4,LR} /* Restore EXC_RETURN */ |
mbed_official | 49:77c8e4604045 | 195 | |
mbed_official | 49:77c8e4604045 | 196 | MRS R12,PSP /* Read PSP */ |
mbed_official | 49:77c8e4604045 | 197 | STM R12,{R0-R2} /* Store return values */ |
mbed_official | 49:77c8e4604045 | 198 | |
mbed_official | 49:77c8e4604045 | 199 | LDR R3,=os_tsk |
mbed_official | 49:77c8e4604045 | 200 | LDM R3,{R1,R2} /* os_tsk.run, os_tsk.new */ |
mbed_official | 49:77c8e4604045 | 201 | CMP R1,R2 |
mbed_official | 49:77c8e4604045 | 202 | .ifdef IFX_XMC4XXX |
mbed_official | 49:77c8e4604045 | 203 | ITT EQ |
mbed_official | 49:77c8e4604045 | 204 | PUSHEQ {LR} |
mbed_official | 49:77c8e4604045 | 205 | POPEQ {PC} |
mbed_official | 49:77c8e4604045 | 206 | .else |
mbed_official | 49:77c8e4604045 | 207 | IT EQ |
mbed_official | 49:77c8e4604045 | 208 | BXEQ LR /* RETI, no task switch */ |
mbed_official | 49:77c8e4604045 | 209 | .endif |
mbed_official | 49:77c8e4604045 | 210 | |
mbed_official | 112:53ace74b190c | 211 | CBNZ R1,SVC_ContextSave /* Runtask not deleted? */ |
mbed_official | 112:53ace74b190c | 212 | |
mbed_official | 49:77c8e4604045 | 213 | TST LR,#0x10 /* is it extended frame? */ |
mbed_official | 112:53ace74b190c | 214 | BNE SVC_ContextRestore |
mbed_official | 112:53ace74b190c | 215 | LDR R1,=0xE000EF34 |
mbed_official | 112:53ace74b190c | 216 | LDR R0,[R1] /* Load FPCCR */ |
mbed_official | 112:53ace74b190c | 217 | BIC R0,#1 /* Clear LSPACT (Lazy state) */ |
mbed_official | 112:53ace74b190c | 218 | STR R0,[R1] /* Store FPCCR */ |
mbed_official | 112:53ace74b190c | 219 | B SVC_ContextRestore |
mbed_official | 112:53ace74b190c | 220 | |
mbed_official | 112:53ace74b190c | 221 | SVC_ContextSave: |
mbed_official | 112:53ace74b190c | 222 | TST LR,#0x10 /* is it extended frame? */ |
mbed_official | 112:53ace74b190c | 223 | #ifdef __FPU_PRESENT |
mbed_official | 49:77c8e4604045 | 224 | ITTE EQ |
mbed_official | 49:77c8e4604045 | 225 | VSTMDBEQ R12!,{S16-S31} /* yes, stack also VFP hi-regs */ |
mbed_official | 112:53ace74b190c | 226 | #else |
mbed_official | 112:53ace74b190c | 227 | ITE EQ |
mbed_official | 112:53ace74b190c | 228 | #endif |
mbed_official | 49:77c8e4604045 | 229 | MOVEQ R0,#0x01 /* os_tsk->stack_frame val */ |
mbed_official | 49:77c8e4604045 | 230 | MOVNE R0,#0x00 |
mbed_official | 49:77c8e4604045 | 231 | STRB R0,[R1,#TCB_STACKF] /* os_tsk.run->stack_frame = val */ |
mbed_official | 49:77c8e4604045 | 232 | STMDB R12!,{R4-R11} /* Save Old context */ |
mbed_official | 49:77c8e4604045 | 233 | STR R12,[R1,#TCB_TSTACK] /* Update os_tsk.run->tsk_stack */ |
mbed_official | 49:77c8e4604045 | 234 | |
mbed_official | 49:77c8e4604045 | 235 | PUSH {R2,R3} |
mbed_official | 49:77c8e4604045 | 236 | BL rt_stk_check /* Check for Stack overflow */ |
mbed_official | 49:77c8e4604045 | 237 | POP {R2,R3} |
mbed_official | 49:77c8e4604045 | 238 | |
mbed_official | 112:53ace74b190c | 239 | SVC_ContextRestore: |
mbed_official | 49:77c8e4604045 | 240 | STR R2,[R3] /* os_tsk.run = os_tsk.new */ |
mbed_official | 49:77c8e4604045 | 241 | |
mbed_official | 49:77c8e4604045 | 242 | LDR R12,[R2,#TCB_TSTACK] /* os_tsk.new->tsk_stack */ |
mbed_official | 49:77c8e4604045 | 243 | LDMIA R12!,{R4-R11} /* Restore New Context */ |
mbed_official | 49:77c8e4604045 | 244 | LDRB R0,[R2,#TCB_STACKF] /* Stack Frame */ |
mbed_official | 49:77c8e4604045 | 245 | CMP R0,#0 /* Basic/Extended Stack Frame */ |
mbed_official | 112:53ace74b190c | 246 | #ifdef __FPU_PRESENT |
mbed_official | 112:53ace74b190c | 247 | ITEE EQ |
mbed_official | 112:53ace74b190c | 248 | #else |
mbed_official | 112:53ace74b190c | 249 | ITE EQ |
mbed_official | 112:53ace74b190c | 250 | #endif |
mbed_official | 112:53ace74b190c | 251 | MVNEQ LR,#~0xFFFFFFFD /* set EXC_RETURN value */ |
mbed_official | 112:53ace74b190c | 252 | MVNNE LR,#~0xFFFFFFED |
mbed_official | 112:53ace74b190c | 253 | #ifdef __FPU_PRESENT |
mbed_official | 49:77c8e4604045 | 254 | VLDMIANE R12!,{S16-S31} /* restore VFP hi-registers */ |
mbed_official | 112:53ace74b190c | 255 | #endif |
mbed_official | 49:77c8e4604045 | 256 | MSR PSP,R12 /* Write PSP */ |
mbed_official | 49:77c8e4604045 | 257 | |
mbed_official | 49:77c8e4604045 | 258 | SVC_Exit: |
mbed_official | 49:77c8e4604045 | 259 | .ifdef IFX_XMC4XXX |
mbed_official | 49:77c8e4604045 | 260 | PUSH {LR} |
mbed_official | 49:77c8e4604045 | 261 | POP {PC} |
mbed_official | 49:77c8e4604045 | 262 | .else |
mbed_official | 49:77c8e4604045 | 263 | BX LR |
mbed_official | 49:77c8e4604045 | 264 | .endif |
mbed_official | 49:77c8e4604045 | 265 | |
mbed_official | 49:77c8e4604045 | 266 | /*------------------- User SVC ------------------------------*/ |
mbed_official | 49:77c8e4604045 | 267 | |
mbed_official | 49:77c8e4604045 | 268 | SVC_User: |
mbed_official | 49:77c8e4604045 | 269 | PUSH {R4,LR} /* Save Registers */ |
mbed_official | 49:77c8e4604045 | 270 | LDR R2,=SVC_Count |
mbed_official | 49:77c8e4604045 | 271 | LDR R2,[R2] |
mbed_official | 49:77c8e4604045 | 272 | CMP R1,R2 |
mbed_official | 49:77c8e4604045 | 273 | BHI SVC_Done /* Overflow */ |
mbed_official | 49:77c8e4604045 | 274 | |
mbed_official | 49:77c8e4604045 | 275 | LDR R4,=SVC_Table-4 |
mbed_official | 49:77c8e4604045 | 276 | LDR R4,[R4,R1,LSL #2] /* Load SVC Function Address */ |
mbed_official | 49:77c8e4604045 | 277 | |
mbed_official | 49:77c8e4604045 | 278 | LDM R0,{R0-R3,R12} /* Read R0-R3,R12 from stack */ |
mbed_official | 49:77c8e4604045 | 279 | BLX R4 /* Call SVC Function */ |
mbed_official | 49:77c8e4604045 | 280 | |
mbed_official | 49:77c8e4604045 | 281 | MRS R12,PSP |
mbed_official | 49:77c8e4604045 | 282 | STM R12,{R0-R3} /* Function return values */ |
mbed_official | 49:77c8e4604045 | 283 | SVC_Done: |
mbed_official | 49:77c8e4604045 | 284 | POP {R4,PC} /* RETI */ |
mbed_official | 49:77c8e4604045 | 285 | |
mbed_official | 49:77c8e4604045 | 286 | .fnend |
mbed_official | 49:77c8e4604045 | 287 | .size SVC_Handler, .-SVC_Handler |
mbed_official | 68:d3d0e710b443 | 288 | |
mbed_official | 49:77c8e4604045 | 289 | |
mbed_official | 49:77c8e4604045 | 290 | /*-------------------------- PendSV_Handler ---------------------------------*/ |
mbed_official | 49:77c8e4604045 | 291 | |
mbed_official | 49:77c8e4604045 | 292 | # void PendSV_Handler (void); |
mbed_official | 49:77c8e4604045 | 293 | |
mbed_official | 49:77c8e4604045 | 294 | .thumb_func |
mbed_official | 49:77c8e4604045 | 295 | .type PendSV_Handler, %function |
mbed_official | 49:77c8e4604045 | 296 | .global PendSV_Handler |
mbed_official | 49:77c8e4604045 | 297 | .global Sys_Switch |
mbed_official | 49:77c8e4604045 | 298 | PendSV_Handler: |
mbed_official | 49:77c8e4604045 | 299 | .ifdef IFX_XMC4XXX |
mbed_official | 49:77c8e4604045 | 300 | .global PendSV_Handler_Veneer |
mbed_official | 49:77c8e4604045 | 301 | PendSV_Handler_Veneer: |
mbed_official | 49:77c8e4604045 | 302 | .endif |
mbed_official | 49:77c8e4604045 | 303 | .fnstart |
mbed_official | 49:77c8e4604045 | 304 | .cantunwind |
mbed_official | 49:77c8e4604045 | 305 | |
mbed_official | 49:77c8e4604045 | 306 | PUSH {R4,LR} /* Save EXC_RETURN */ |
mbed_official | 49:77c8e4604045 | 307 | BL rt_pop_req |
mbed_official | 49:77c8e4604045 | 308 | |
mbed_official | 49:77c8e4604045 | 309 | Sys_Switch: |
mbed_official | 49:77c8e4604045 | 310 | POP {R4,LR} /* Restore EXC_RETURN */ |
mbed_official | 49:77c8e4604045 | 311 | |
mbed_official | 49:77c8e4604045 | 312 | LDR R3,=os_tsk |
mbed_official | 49:77c8e4604045 | 313 | LDM R3,{R1,R2} /* os_tsk.run, os_tsk.new */ |
mbed_official | 49:77c8e4604045 | 314 | CMP R1,R2 |
mbed_official | 49:77c8e4604045 | 315 | .ifdef IFX_XMC4XXX |
mbed_official | 49:77c8e4604045 | 316 | ITT EQ |
mbed_official | 49:77c8e4604045 | 317 | PUSHEQ {LR} |
mbed_official | 49:77c8e4604045 | 318 | POPEQ {PC} |
mbed_official | 49:77c8e4604045 | 319 | .else |
mbed_official | 49:77c8e4604045 | 320 | IT EQ |
mbed_official | 49:77c8e4604045 | 321 | BXEQ LR /* RETI, no task switch */ |
mbed_official | 49:77c8e4604045 | 322 | .endif |
mbed_official | 49:77c8e4604045 | 323 | |
mbed_official | 49:77c8e4604045 | 324 | MRS R12,PSP /* Read PSP */ |
mbed_official | 49:77c8e4604045 | 325 | TST LR,#0x10 /* is it extended frame? */ |
mbed_official | 112:53ace74b190c | 326 | #ifdef __FPU_PRESENT |
mbed_official | 49:77c8e4604045 | 327 | ITTE EQ |
mbed_official | 49:77c8e4604045 | 328 | VSTMDBEQ R12!,{S16-S31} /* yes, stack also VFP hi-regs */ |
mbed_official | 112:53ace74b190c | 329 | #else |
mbed_official | 112:53ace74b190c | 330 | ITE EQ |
mbed_official | 112:53ace74b190c | 331 | #endif |
mbed_official | 49:77c8e4604045 | 332 | MOVEQ R0,#0x01 /* os_tsk->stack_frame val */ |
mbed_official | 49:77c8e4604045 | 333 | MOVNE R0,#0x00 |
mbed_official | 49:77c8e4604045 | 334 | STRB R0,[R1,#TCB_STACKF] /* os_tsk.run->stack_frame = val */ |
mbed_official | 49:77c8e4604045 | 335 | STMDB R12!,{R4-R11} /* Save Old context */ |
mbed_official | 49:77c8e4604045 | 336 | STR R12,[R1,#TCB_TSTACK] /* Update os_tsk.run->tsk_stack */ |
mbed_official | 49:77c8e4604045 | 337 | |
mbed_official | 49:77c8e4604045 | 338 | PUSH {R2,R3} |
mbed_official | 49:77c8e4604045 | 339 | BL rt_stk_check /* Check for Stack overflow */ |
mbed_official | 49:77c8e4604045 | 340 | POP {R2,R3} |
mbed_official | 49:77c8e4604045 | 341 | |
mbed_official | 49:77c8e4604045 | 342 | STR R2,[R3] /* os_tsk.run = os_tsk.new */ |
mbed_official | 49:77c8e4604045 | 343 | |
mbed_official | 49:77c8e4604045 | 344 | LDR R12,[R2,#TCB_TSTACK] /* os_tsk.new->tsk_stack */ |
mbed_official | 49:77c8e4604045 | 345 | LDMIA R12!,{R4-R11} /* Restore New Context */ |
mbed_official | 49:77c8e4604045 | 346 | LDRB R0,[R2,#TCB_STACKF] /* Stack Frame */ |
mbed_official | 49:77c8e4604045 | 347 | CMP R0,#0 /* Basic/Extended Stack Frame */ |
mbed_official | 112:53ace74b190c | 348 | #ifdef __FPU_PRESENT |
mbed_official | 112:53ace74b190c | 349 | ITEE EQ |
mbed_official | 112:53ace74b190c | 350 | #else |
mbed_official | 112:53ace74b190c | 351 | ITE EQ |
mbed_official | 112:53ace74b190c | 352 | #endif |
mbed_official | 112:53ace74b190c | 353 | MVNEQ LR,#~0xFFFFFFFD /* set EXC_RETURN value */ |
mbed_official | 112:53ace74b190c | 354 | MVNNE LR,#~0xFFFFFFED |
mbed_official | 112:53ace74b190c | 355 | #ifdef __FPU_PRESENT |
mbed_official | 49:77c8e4604045 | 356 | VLDMIANE R12!,{S16-S31} /* restore VFP hi-registers */ |
mbed_official | 112:53ace74b190c | 357 | #endif |
mbed_official | 49:77c8e4604045 | 358 | MSR PSP,R12 /* Write PSP */ |
mbed_official | 49:77c8e4604045 | 359 | |
mbed_official | 49:77c8e4604045 | 360 | Sys_Exit: |
mbed_official | 49:77c8e4604045 | 361 | .ifdef IFX_XMC4XXX |
mbed_official | 49:77c8e4604045 | 362 | PUSH {LR} |
mbed_official | 49:77c8e4604045 | 363 | POP {PC} |
mbed_official | 49:77c8e4604045 | 364 | .else |
mbed_official | 49:77c8e4604045 | 365 | BX LR /* Return to Thread Mode */ |
mbed_official | 49:77c8e4604045 | 366 | .endif |
mbed_official | 49:77c8e4604045 | 367 | |
mbed_official | 49:77c8e4604045 | 368 | .fnend |
mbed_official | 49:77c8e4604045 | 369 | .size PendSV_Handler, .-PendSV_Handler |
mbed_official | 49:77c8e4604045 | 370 | |
mbed_official | 49:77c8e4604045 | 371 | |
mbed_official | 49:77c8e4604045 | 372 | /*-------------------------- SysTick_Handler --------------------------------*/ |
mbed_official | 49:77c8e4604045 | 373 | |
mbed_official | 49:77c8e4604045 | 374 | # void SysTick_Handler (void); |
mbed_official | 49:77c8e4604045 | 375 | |
mbed_official | 49:77c8e4604045 | 376 | .thumb_func |
mbed_official | 49:77c8e4604045 | 377 | .type SysTick_Handler, %function |
mbed_official | 49:77c8e4604045 | 378 | .global SysTick_Handler |
mbed_official | 49:77c8e4604045 | 379 | SysTick_Handler: |
mbed_official | 49:77c8e4604045 | 380 | .ifdef IFX_XMC4XXX |
mbed_official | 49:77c8e4604045 | 381 | .global SysTick_Handler_Veneer |
mbed_official | 49:77c8e4604045 | 382 | SysTick_Handler_Veneer: |
mbed_official | 49:77c8e4604045 | 383 | .endif |
mbed_official | 49:77c8e4604045 | 384 | .fnstart |
mbed_official | 49:77c8e4604045 | 385 | .cantunwind |
mbed_official | 49:77c8e4604045 | 386 | |
mbed_official | 49:77c8e4604045 | 387 | PUSH {R4,LR} /* Save EXC_RETURN */ |
mbed_official | 49:77c8e4604045 | 388 | BL rt_systick |
mbed_official | 49:77c8e4604045 | 389 | B Sys_Switch |
mbed_official | 49:77c8e4604045 | 390 | |
mbed_official | 49:77c8e4604045 | 391 | .fnend |
mbed_official | 49:77c8e4604045 | 392 | .size SysTick_Handler, .-SysTick_Handler |
mbed_official | 49:77c8e4604045 | 393 | |
mbed_official | 49:77c8e4604045 | 394 | |
mbed_official | 49:77c8e4604045 | 395 | /*-------------------------- OS_Tick_Handler --------------------------------*/ |
mbed_official | 49:77c8e4604045 | 396 | |
mbed_official | 49:77c8e4604045 | 397 | # void OS_Tick_Handler (void); |
mbed_official | 49:77c8e4604045 | 398 | |
mbed_official | 49:77c8e4604045 | 399 | .thumb_func |
mbed_official | 49:77c8e4604045 | 400 | .type OS_Tick_Handler, %function |
mbed_official | 49:77c8e4604045 | 401 | .global OS_Tick_Handler |
mbed_official | 49:77c8e4604045 | 402 | OS_Tick_Handler: |
mbed_official | 49:77c8e4604045 | 403 | .fnstart |
mbed_official | 49:77c8e4604045 | 404 | .cantunwind |
mbed_official | 49:77c8e4604045 | 405 | |
mbed_official | 49:77c8e4604045 | 406 | PUSH {R4,LR} /* Save EXC_RETURN */ |
mbed_official | 49:77c8e4604045 | 407 | BL os_tick_irqack |
mbed_official | 49:77c8e4604045 | 408 | BL rt_systick |
mbed_official | 49:77c8e4604045 | 409 | B Sys_Switch |
mbed_official | 49:77c8e4604045 | 410 | |
mbed_official | 49:77c8e4604045 | 411 | .fnend |
mbed_official | 49:77c8e4604045 | 412 | .size OS_Tick_Handler, .-OS_Tick_Handler |
mbed_official | 49:77c8e4604045 | 413 | |
mbed_official | 49:77c8e4604045 | 414 | |
mbed_official | 49:77c8e4604045 | 415 | .end |
mbed_official | 49:77c8e4604045 | 416 | |
mbed_official | 49:77c8e4604045 | 417 | /*---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 418 | * end of file |
mbed_official | 49:77c8e4604045 | 419 | *---------------------------------------------------------------------------*/ |