]> git.sur5r.net Git - freertos/blobdiff - Source/portable/GCC/ARM_CM3/port.c
Add an cpsie i before the SVC call that starts the scheduler. This is just in case...
[freertos] / Source / portable / GCC / ARM_CM3 / port.c
index 146efa7eac54096431b9752b4ddf02837d8feec8..85d28c6ecd0029aab1574ebe27016d7634f00b45 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.\r
+    FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
 \r
     ***************************************************************************\r
     *                                                                         *\r
@@ -10,7 +10,7 @@
     *    + Looking for basic training,                                        *\r
     *    + Wanting to improve your FreeRTOS skills and productivity           *\r
     *                                                                         *\r
-    * then take a look at the FreeRTOS eBook                                  *\r
+    * then take a look at the FreeRTOS books - available as PDF or paperback  *\r
     *                                                                         *\r
     *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *\r
     *                  http://www.FreeRTOS.org/Documentation                  *\r
@@ -115,6 +115,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
 {\r
        /* Simulate the stack frame as it would be created by a context switch\r
        interrupt. */\r
+       pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */\r
        *pxTopOfStack = portINITIAL_XPSR;       /* xPSR */\r
        pxTopOfStack--;\r
        *pxTopOfStack = ( portSTACK_TYPE ) pxCode;      /* PC */\r
@@ -154,7 +155,9 @@ void vPortStartFirstTask( void )
                                        " ldr r0, [r0]                  \n"\r
                                        " ldr r0, [r0]                  \n"\r
                                        " msr msp, r0                   \n" /* Set the msp back to the start of the stack. */\r
+                                       " cpsie i                               \n"\r
                                        " svc 0                                 \n" /* System call to start first task. */\r
+                                       " nop                                   \n"\r
                                );\r
 }\r
 /*-----------------------------------------------------------*/\r