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.

Revision:
112:53ace74b190c
Parent:
101:3d9d2b8b8f17
--- a/rtx/TARGET_CORTEX_M/TARGET_RTOS_M4_M7/TOOLCHAIN_GCC/HAL_CM4.S	Tue May 03 00:15:52 2016 +0100
+++ b/rtx/TARGET_CORTEX_M/TARGET_RTOS_M4_M7/TOOLCHAIN_GCC/HAL_CM4.S	Thu May 05 20:45:13 2016 +0100
@@ -1,12 +1,12 @@
 /*----------------------------------------------------------------------------
- *      RL-ARM - RTX
+ *      CMSIS-RTOS  -  RTX
  *----------------------------------------------------------------------------
  *      Name:    HAL_CM4.S
  *      Purpose: Hardware Abstraction Layer for Cortex-M4
- *      Rev.:    V4.70
+ *      Rev.:    V4.79
  *----------------------------------------------------------------------------
  *
- * Copyright (c) 1999-2009 KEIL, 2009-2013 ARM Germany GmbH
+ * Copyright (c) 1999-2009 KEIL, 2009-2015 ARM Germany GmbH
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -35,8 +35,8 @@
         .file   "HAL_CM4.S"
         .syntax unified
 
-        .equ    TCB_STACKF, 32
-        .equ    TCB_TSTACK, 40
+        .equ    TCB_STACKF, 37
+        .equ    TCB_TSTACK, 44
 
 
 /*----------------------------------------------------------------------------
@@ -142,7 +142,7 @@
 
 /*--------------------------- _free_box -------------------------------------*/
 
-#       int _free_box (void *box_mem, void *box);
+#       U32 _free_box (void *box_mem, void *box);
         /* Function wrapper for Unprivileged/Privileged mode. */
 
         .thumb_func
@@ -208,14 +208,24 @@
         BXEQ    LR                      /* RETI, no task switch */
         .endif
 
-        CBZ     R1,SVC_Next             /* Runtask deleted? */
+        CBNZ    R1,SVC_ContextSave      /* Runtask not deleted? */
+
         TST     LR,#0x10                /* is it extended frame? */
-        #ifdef  __FPU_PRESENT
+        BNE     SVC_ContextRestore
+        LDR     R1,=0xE000EF34
+        LDR     R0,[R1]                 /* Load FPCCR */
+        BIC     R0,#1                   /* Clear LSPACT (Lazy state) */
+        STR     R0,[R1]                 /* Store FPCCR */
+        B       SVC_ContextRestore
+
+SVC_ContextSave:
+        TST     LR,#0x10                /* is it extended frame? */
+#ifdef __FPU_PRESENT
         ITTE    EQ
         VSTMDBEQ R12!,{S16-S31}         /* yes, stack also VFP hi-regs */
-        #else
-        ITE    EQ
-        #endif
+#else
+        ITE     EQ
+#endif
         MOVEQ   R0,#0x01                /* os_tsk->stack_frame val */
         MOVNE   R0,#0x00
         STRB    R0,[R1,#TCB_STACKF]     /* os_tsk.run->stack_frame = val */
@@ -226,21 +236,23 @@
         BL      rt_stk_check            /* Check for Stack overflow */
         POP     {R2,R3}
 
-SVC_Next:
+SVC_ContextRestore:
         STR     R2,[R3]                 /* os_tsk.run = os_tsk.new */
 
         LDR     R12,[R2,#TCB_TSTACK]    /* os_tsk.new->tsk_stack */
         LDMIA   R12!,{R4-R11}           /* Restore New Context */
         LDRB    R0,[R2,#TCB_STACKF]     /* Stack Frame */
         CMP     R0,#0                   /* Basic/Extended Stack Frame */
-        #ifdef  __FPU_PRESENT
-        ITTE    NE
+#ifdef __FPU_PRESENT
+        ITEE    EQ
+#else
+        ITE     EQ
+#endif
+        MVNEQ   LR,#~0xFFFFFFFD         /* set EXC_RETURN value */
+        MVNNE   LR,#~0xFFFFFFED
+#ifdef __FPU_PRESENT
         VLDMIANE R12!,{S16-S31}         /* restore VFP hi-registers */
-        #else
-        ITE    NE
-        #endif
-        MVNNE   LR,#~0xFFFFFFED         /* set EXC_RETURN value */
-        MVNEQ   LR,#~0xFFFFFFFD
+#endif
         MSR     PSP,R12                 /* Write PSP */
 
 SVC_Exit:
@@ -311,12 +323,12 @@
 
         MRS     R12,PSP                 /* Read PSP */
         TST     LR,#0x10                /* is it extended frame? */
-        #ifdef  __FPU_PRESENT
+#ifdef __FPU_PRESENT
         ITTE    EQ
         VSTMDBEQ R12!,{S16-S31}         /* yes, stack also VFP hi-regs */
-        #else
-        ITE    EQ
-        #endif
+#else
+        ITE     EQ
+#endif
         MOVEQ   R0,#0x01                /* os_tsk->stack_frame val */
         MOVNE   R0,#0x00
         STRB    R0,[R1,#TCB_STACKF]     /* os_tsk.run->stack_frame = val */
@@ -333,14 +345,16 @@
         LDMIA   R12!,{R4-R11}           /* Restore New Context */
         LDRB    R0,[R2,#TCB_STACKF]     /* Stack Frame */
         CMP     R0,#0                   /* Basic/Extended Stack Frame */
-        #ifdef  __FPU_PRESENT
-        ITTE    NE
+#ifdef __FPU_PRESENT
+        ITEE    EQ
+#else
+        ITE     EQ
+#endif
+        MVNEQ   LR,#~0xFFFFFFFD         /* set EXC_RETURN value */
+        MVNNE   LR,#~0xFFFFFFED
+#ifdef __FPU_PRESENT
         VLDMIANE R12!,{S16-S31}         /* restore VFP hi-registers */
-        #else
-        ITE    NE
-        #endif
-        MVNNE   LR,#~0xFFFFFFED         /* set EXC_RETURN value */
-        MVNEQ   LR,#~0xFFFFFFFD
+#endif
         MSR     PSP,R12                 /* Write PSP */
 
 Sys_Exit: