Ensure the definition of prvTaskExitError()does not result in a compiler warning in ports where its use can be overridden (GCC Cortex-M ports).

Remove duplicate save/restore of r14 in Cortex-M4F ports.
pull/4/head
Richard Barry 11 years ago
parent 20eb03ed7d
commit b181a3af99

@ -208,6 +208,12 @@ portBASE_TYPE xPortStartScheduler( void )
/* Start the first task. */ /* Start the first task. */
vPortStartFirstTask(); vPortStartFirstTask();
/* Should never get here as the tasks will now be executing! Call the task
exit error function to prevent compiler warnings about a static function
not being called in the case that the application writer overrides this
functionality by defining configTASK_RETURN_ADDRESS. */
prvTaskExitError();
/* Should not get here! */ /* Should not get here! */
return 0; return 0;

@ -1,5 +1,5 @@
/* /*
FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd.
All rights reserved All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
@ -218,13 +218,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
static void prvTaskExitError( void ) static void prvTaskExitError( void )
{ {
/* A function that implements a task must not exit or attempt to return to /* A function that implements a task must not exit or attempt to return to
its caller as there is nothing to return to. If a task wants to exit it its caller as there is nothing to return to. If a task wants to exit it
should instead call vTaskDelete( NULL ). should instead call vTaskDelete( NULL ).
Artificially force an assert() to be triggered if configASSERT() is Artificially force an assert() to be triggered if configASSERT() is
defined, then stop here so application writers can catch the error. */ defined, then stop here so application writers can catch the error. */
configASSERT( uxCriticalNesting == ~0UL ); configASSERT( uxCriticalNesting == ~0UL );
portDISABLE_INTERRUPTS(); portDISABLE_INTERRUPTS();
for( ;; ); for( ;; );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -329,6 +329,12 @@ portBASE_TYPE xPortStartScheduler( void )
/* Start the first task. */ /* Start the first task. */
prvPortStartFirstTask(); prvPortStartFirstTask();
/* Should never get here as the tasks will now be executing! Call the task
exit error function to prevent compiler warnings about a static function
not being called in the case that the application writer overrides this
functionality by defining configTASK_RETURN_ADDRESS. */
prvTaskExitError();
/* Should not get here! */ /* Should not get here! */
return 0; return 0;
} }
@ -497,10 +503,10 @@ void xPortSysTickHandler( void )
/* Restart from whatever is left in the count register to complete /* Restart from whatever is left in the count register to complete
this tick period. */ this tick period. */
portNVIC_SYSTICK_LOAD_REG = portNVIC_SYSTICK_CURRENT_VALUE_REG; portNVIC_SYSTICK_LOAD_REG = portNVIC_SYSTICK_CURRENT_VALUE_REG;
/* Restart SysTick. */ /* Restart SysTick. */
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT; portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
/* Reset the reload register to the value required for normal tick /* Reset the reload register to the value required for normal tick
periods. */ periods. */
portNVIC_SYSTICK_LOAD_REG = ulTimerCountsForOneTick - 1UL; portNVIC_SYSTICK_LOAD_REG = ulTimerCountsForOneTick - 1UL;
@ -549,23 +555,23 @@ void xPortSysTickHandler( void )
if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )
{ {
unsigned long ulCalculatedLoadValue; unsigned long ulCalculatedLoadValue;
/* The tick interrupt has already executed, and the SysTick /* The tick interrupt has already executed, and the SysTick
count reloaded with ulReloadValue. Reset the count reloaded with ulReloadValue. Reset the
portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick
period. */ period. */
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG ); ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG );
/* Don't allow a tiny value, or values that have somehow /* Don't allow a tiny value, or values that have somehow
underflowed because the post sleep hook did something underflowed because the post sleep hook did something
that took too long. */ that took too long. */
if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) ) if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) )
{ {
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ); ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL );
} }
portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue; portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue;
/* The tick interrupt handler will already have pended the tick /* The tick interrupt handler will already have pended the tick
processing in the kernel. As the pending tick will be processing in the kernel. As the pending tick will be
processed as soon as this function exits, the tick value processed as soon as this function exits, the tick value

@ -1,5 +1,5 @@
/* /*
FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd.
All rights reserved All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
@ -353,6 +353,12 @@ portBASE_TYPE xPortStartScheduler( void )
/* Start the first task. */ /* Start the first task. */
prvPortStartFirstTask(); prvPortStartFirstTask();
/* Should never get here as the tasks will now be executing! Call the task
exit error function to prevent compiler warnings about a static function
not being called in the case that the application writer overrides this
functionality by defining configTASK_RETURN_ADDRESS. */
prvTaskExitError();
/* Should not get here! */ /* Should not get here! */
return 0; return 0;
} }
@ -446,13 +452,13 @@ void xPortPendSVHandler( void )
" \n" " \n"
" str r0, [r2] \n" /* Save the new top of stack into the first member of the TCB. */ " str r0, [r2] \n" /* Save the new top of stack into the first member of the TCB. */
" \n" " \n"
" stmdb sp!, {r3, r14} \n" " stmdb sp!, {r3} \n"
" mov r0, %0 \n" " mov r0, %0 \n"
" msr basepri, r0 \n" " msr basepri, r0 \n"
" bl vTaskSwitchContext \n" " bl vTaskSwitchContext \n"
" mov r0, #0 \n" " mov r0, #0 \n"
" msr basepri, r0 \n" " msr basepri, r0 \n"
" ldmia sp!, {r3, r14} \n" " ldmia sp!, {r3} \n"
" \n" " \n"
" ldr r1, [r3] \n" /* The first item in pxCurrentTCB is the task top of stack. */ " ldr r1, [r3] \n" /* The first item in pxCurrentTCB is the task top of stack. */
" ldr r0, [r1] \n" " ldr r0, [r1] \n"
@ -592,23 +598,23 @@ void xPortSysTickHandler( void )
if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )
{ {
unsigned long ulCalculatedLoadValue; unsigned long ulCalculatedLoadValue;
/* The tick interrupt has already executed, and the SysTick /* The tick interrupt has already executed, and the SysTick
count reloaded with ulReloadValue. Reset the count reloaded with ulReloadValue. Reset the
portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick
period. */ period. */
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG ); ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG );
/* Don't allow a tiny value, or values that have somehow /* Don't allow a tiny value, or values that have somehow
underflowed because the post sleep hook did something underflowed because the post sleep hook did something
that took too long. */ that took too long. */
if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) ) if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) )
{ {
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ); ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL );
} }
portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue; portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue;
/* The tick interrupt handler will already have pended the tick /* The tick interrupt handler will already have pended the tick
processing in the kernel. As the pending tick will be processing in the kernel. As the pending tick will be
processed as soon as this function exits, the tick value processed as soon as this function exits, the tick value

@ -1,5 +1,5 @@
/* /*
FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd.
All rights reserved All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
@ -99,13 +99,13 @@ xPortPendSVHandler:
/* Save the new top of stack into the first member of the TCB. */ /* Save the new top of stack into the first member of the TCB. */
str r0, [r2] str r0, [r2]
stmdb sp!, {r3, r14} stmdb sp!, {r3}
mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY
msr basepri, r0 msr basepri, r0
bl vTaskSwitchContext bl vTaskSwitchContext
mov r0, #0 mov r0, #0
msr basepri, r0 msr basepri, r0
ldmia sp!, {r3, r14} ldmia sp!, {r3}
/* The first item in pxCurrentTCB is the task top of stack. */ /* The first item in pxCurrentTCB is the task top of stack. */
ldr r1, [r3] ldr r1, [r3]

@ -1,5 +1,5 @@
/* /*
FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd.
All rights reserved All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
@ -196,7 +196,7 @@ static void prvTaskExitError( void );
#endif /* configUSE_TICKLESS_IDLE */ #endif /* configUSE_TICKLESS_IDLE */
/* /*
* Used by the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() macro to ensure * Used by the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() macro to ensure
* FreeRTOS API functions are not called from interrupts that have been assigned * FreeRTOS API functions are not called from interrupts that have been assigned
* a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY. * a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY.
*/ */
@ -244,13 +244,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
static void prvTaskExitError( void ) static void prvTaskExitError( void )
{ {
/* A function that implements a task must not exit or attempt to return to /* A function that implements a task must not exit or attempt to return to
its caller as there is nothing to return to. If a task wants to exit it its caller as there is nothing to return to. If a task wants to exit it
should instead call vTaskDelete( NULL ). should instead call vTaskDelete( NULL ).
Artificially force an assert() to be triggered if configASSERT() is Artificially force an assert() to be triggered if configASSERT() is
defined, then stop here so application writers can catch the error. */ defined, then stop here so application writers can catch the error. */
configASSERT( uxCriticalNesting == ~0UL ); configASSERT( uxCriticalNesting == ~0UL );
portDISABLE_INTERRUPTS(); portDISABLE_INTERRUPTS();
for( ;; ); for( ;; );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -443,13 +443,13 @@ __asm void xPortPendSVHandler( void )
/* Save the new top of stack into the first member of the TCB. */ /* Save the new top of stack into the first member of the TCB. */
str r0, [r2] str r0, [r2]
stmdb sp!, {r3, r14} stmdb sp!, {r3}
mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY
msr basepri, r0 msr basepri, r0
bl vTaskSwitchContext bl vTaskSwitchContext
mov r0, #0 mov r0, #0
msr basepri, r0 msr basepri, r0
ldmia sp!, {r3, r14} ldmia sp!, {r3}
/* The first item in pxCurrentTCB is the task top of stack. */ /* The first item in pxCurrentTCB is the task top of stack. */
ldr r1, [r3] ldr r1, [r3]
@ -465,14 +465,14 @@ __asm void xPortPendSVHandler( void )
vldmiaeq r0!, {s16-s31} vldmiaeq r0!, {s16-s31}
msr psp, r0 msr psp, r0
#ifdef WORKAROUND_PMU_CM001 /* XMC4000 specific errata */ #ifdef WORKAROUND_PMU_CM001 /* XMC4000 specific errata */
#if WORKAROUND_PMU_CM001 == 1 #if WORKAROUND_PMU_CM001 == 1
push { r14 } push { r14 }
pop { pc } pop { pc }
#endif #endif
#endif #endif
bx r14 bx r14
nop nop
} }
@ -537,10 +537,10 @@ void xPortSysTickHandler( void )
/* Restart from whatever is left in the count register to complete /* Restart from whatever is left in the count register to complete
this tick period. */ this tick period. */
portNVIC_SYSTICK_LOAD_REG = portNVIC_SYSTICK_CURRENT_VALUE_REG; portNVIC_SYSTICK_LOAD_REG = portNVIC_SYSTICK_CURRENT_VALUE_REG;
/* Restart SysTick. */ /* Restart SysTick. */
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT; portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;
/* Reset the reload register to the value required for normal tick /* Reset the reload register to the value required for normal tick
periods. */ periods. */
portNVIC_SYSTICK_LOAD_REG = ulTimerCountsForOneTick - 1UL; portNVIC_SYSTICK_LOAD_REG = ulTimerCountsForOneTick - 1UL;
@ -589,23 +589,23 @@ void xPortSysTickHandler( void )
if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )
{ {
unsigned long ulCalculatedLoadValue; unsigned long ulCalculatedLoadValue;
/* The tick interrupt has already executed, and the SysTick /* The tick interrupt has already executed, and the SysTick
count reloaded with ulReloadValue. Reset the count reloaded with ulReloadValue. Reset the
portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick
period. */ period. */
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG ); ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG );
/* Don't allow a tiny value, or values that have somehow /* Don't allow a tiny value, or values that have somehow
underflowed because the post sleep hook did something underflowed because the post sleep hook did something
that took too long. */ that took too long. */
if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) ) if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) )
{ {
ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ); ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL );
} }
portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue; portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue;
/* The tick interrupt handler will already have pended the tick /* The tick interrupt handler will already have pended the tick
processing in the kernel. As the pending tick will be processing in the kernel. As the pending tick will be
processed as soon as this function exits, the tick value processed as soon as this function exits, the tick value
@ -698,7 +698,7 @@ __asm void vPortClearInterruptMask( unsigned long ulNewMask )
__asm unsigned long vPortGetIPSR( void ) __asm unsigned long vPortGetIPSR( void )
{ {
PRESERVE8 PRESERVE8
mrs r0, ipsr mrs r0, ipsr
bx r14 bx r14
} }

@ -64,7 +64,7 @@
.global vPortEnableVFP .global vPortEnableVFP
.global ulPortSetInterruptMask .global ulPortSetInterruptMask
.global vPortClearInterruptMask .global vPortClearInterruptMask
;----------------------------------------------------------- ;-----------------------------------------------------------
.section .text .section .text
@ -89,13 +89,13 @@ _vector_14: .type func
;Save the new top of stack into the first member of the TCB. ;Save the new top of stack into the first member of the TCB.
str r0, [r2] str r0, [r2]
stmdb sp!, {r3, r14} stmdb sp!, {r3}
ldr.w r0, =ulMaxSyscallInterruptPriorityConst ldr.w r0, =ulMaxSyscallInterruptPriorityConst
msr basepri, r0 msr basepri, r0
bl vTaskSwitchContext bl vTaskSwitchContext
mov r0, #0 mov r0, #0
msr basepri, r0 msr basepri, r0
ldmia sp!, {r3, r14} ldmia sp!, {r3}
;The first item in pxCurrentTCB is the task top of stack. ;The first item in pxCurrentTCB is the task top of stack.
ldr r1, [r3] ldr r1, [r3]
@ -141,13 +141,13 @@ _lc_ref__vector_pp_14: .type func
;Save the new top of stack into the first member of the TCB. ;Save the new top of stack into the first member of the TCB.
str r0, [r2] str r0, [r2]
stmdb sp!, {r3, r14} stmdb sp!, {r3}
ldr.w r0, =ulMaxSyscallInterruptPriorityConst ldr.w r0, =ulMaxSyscallInterruptPriorityConst
msr basepri, r0 msr basepri, r0
bl vTaskSwitchContext bl vTaskSwitchContext
mov r0, #0 mov r0, #0
msr basepri, r0 msr basepri, r0
ldmia sp!, {r3, r14} ldmia sp!, {r3}
;The first item in pxCurrentTCB is the task top of stack. ;The first item in pxCurrentTCB is the task top of stack.
ldr r1, [r3] ldr r1, [r3]
@ -249,4 +249,4 @@ vPortClearInterruptMask:
;----------------------------------------------------------- ;-----------------------------------------------------------
.end .end

Loading…
Cancel
Save