]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/portable/CCS/ARM_CM4F/port.c
xTaskGetTaskHandle() changed to xTaskGetHandle().
[freertos] / FreeRTOS / Source / portable / CCS / ARM_CM4F / port.c
index 9f5169bc2a525f74f5ffcfdf6e4acf2d0bdab431..a02254419fb0bfde589b938dee5a5c6804126734 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2016 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
@@ -137,6 +137,10 @@ occurred while the SysTick counter is stopped during tickless idle
 calculations. */\r
 #define portMISSED_COUNTS_FACTOR                       ( 45UL )\r
 \r
+/* For strict compliance with the Cortex-M spec the task start address should\r
+have bit-0 clear, as it is loaded into the PC on exit from an ISR. */\r
+#define portSTART_ADDRESS_MASK         ( ( StackType_t ) 0xfffffffeUL )\r
+\r
 /* Required to allow portasm.asm access the configMAX_SYSCALL_INTERRUPT_PRIORITY\r
 setting. */\r
 const uint32_t ulMaxSyscallInterruptPriority = configMAX_SYSCALL_INTERRUPT_PRIORITY;\r
@@ -224,7 +228,7 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
 \r
        *pxTopOfStack = portINITIAL_XPSR;       /* xPSR */\r
        pxTopOfStack--;\r
-       *pxTopOfStack = ( StackType_t ) pxCode; /* PC */\r
+       *pxTopOfStack = ( ( StackType_t ) pxCode ) & portSTART_ADDRESS_MASK;    /* PC */\r
        pxTopOfStack--;\r
        *pxTopOfStack = ( StackType_t ) prvTaskExitError;       /* LR */\r
 \r
@@ -419,6 +423,9 @@ void xPortSysTickHandler( void )
                /* Enter a critical section but don't use the taskENTER_CRITICAL()\r
                method as that will mask interrupts that should exit sleep mode. */\r
                __asm( "        cpsid i" );\r
+               __asm( "        dsb" );\r
+               __asm( "        isb" );\r
+\r
 \r
                /* If a context switch is pending or a task is waiting for the scheduler\r
                to be unsuspended then abandon the low power entry. */\r
@@ -518,7 +525,7 @@ void xPortSysTickHandler( void )
 \r
                                /* The reload value is set to whatever fraction of a single tick\r
                                period remains. */\r
-                               portNVIC_SYSTICK_LOAD_REG = ( ( ulCompleteTickPeriods + 1 ) * ulTimerCountsForOneTick ) - ulCompletedSysTickDecrements;\r
+                               portNVIC_SYSTICK_LOAD_REG = ( ( ulCompleteTickPeriods + 1UL ) * ulTimerCountsForOneTick ) - ulCompletedSysTickDecrements;\r
                        }\r
 \r
                        /* Restart SysTick so it runs from portNVIC_SYSTICK_LOAD_REG\r