X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=FreeRTOS%2FSource%2Fportable%2FGCC%2FARM_CM4_MPU%2Fport.c;h=5c33c737ad1e12bc8a7b86f58e23d075aabe0db9;hb=2bd0460cbddacff216d51a45dff54f6e13f8a402;hp=32943ff59828455316d19963035c077ab12f9425;hpb=5dfd53a26521402a63f5eb339a7421288768f5db;p=freertos diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/port.c index 32943ff59..5c33c737a 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/port.c @@ -134,7 +134,7 @@ task.h is included from an application file. */ /* Constants required to set up the initial stack. */ #define portINITIAL_XPSR ( 0x01000000UL ) -#define portINITIAL_EXEC_RETURN ( 0xfffffffdUL ) +#define portINITIAL_EXC_RETURN ( 0xfffffffdUL ) #define portINITIAL_CONTROL_IF_UNPRIVILEGED ( 0x03 ) #define portINITIAL_CONTROL_IF_PRIVILEGED ( 0x02 ) @@ -243,7 +243,7 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px /* A save method is being used that requires each task to maintain its own exec return value. */ pxTopOfStack--; - *pxTopOfStack = portINITIAL_EXEC_RETURN; + *pxTopOfStack = portINITIAL_EXC_RETURN; pxTopOfStack -= 9; /* R11, R10, R9, R8, R7, R6, R5 and R4. */ @@ -514,7 +514,7 @@ void xPortPendSVHandler( void ) " stmdb r0!, {r1, r4-r11, r14} \n" /* Save the remaining registers. */ " str r0, [r2] \n" /* Save the new top of stack into the first member of the TCB. */ " \n" - " stmdb sp!, {r3} \n" + " stmdb sp!, {r0, r3} \n" " mov r0, %0 \n" " msr basepri, r0 \n" " dsb \n" @@ -522,8 +522,8 @@ void xPortPendSVHandler( void ) " bl vTaskSwitchContext \n" " mov r0, #0 \n" " msr basepri, r0 \n" - " ldmia sp!, {r3} \n" - " \n" /* Restore the context. */ + " ldmia sp!, {r0, r3} \n" + " \n" /* Restore the context. */ " ldr r1, [r3] \n" " ldr r0, [r1] \n" /* The first item in the TCB is the task top of stack. */ " add r1, r1, #4 \n" /* Move onto the second item in the TCB... */