\r
static void prvTaskExitError( void )\r
{\r
+volatile uint32_t ulDummy = 0UL;\r
+\r
/* A function that implements a task must not exit or attempt to return to\r
its caller as there is nothing to return to. If a task wants to exit it\r
should instead call vTaskDelete( NULL ).\r
defined, then stop here so application writers can catch the error. */\r
configASSERT( uxCriticalNesting == ~0UL );\r
portDISABLE_INTERRUPTS();\r
- for( ;; );\r
+ while( ulDummy == 0 )\r
+ {\r
+ /* This file calls prvTaskExitError() after the scheduler has been\r
+ started to remove a compiler warning about the function being defined\r
+ but never called. ulDummy is used purely to quieten other warnings\r
+ about code appearing after this function is called - making ulDummy\r
+ volatile makes the compiler think the function could return and\r
+ therefore not output an 'unreachable code' warning for code that appears\r
+ after it. */\r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r
table offset register that can be used to locate the initial stack value.\r
Not all M0 parts have the application vector table at address 0. */\r
__asm volatile(\r
- " ldr r2, pxCurrentTCBConst2 \n" /* Obtain location of pxCurrentTCB. */\r
- " ldr r3, [r2] \n"\r
- " ldr r0, [r3] \n" /* The first item in pxCurrentTCB is the task top of stack. */\r
- " add r0, #32 \n" /* Discard everything up to r0. */\r
- " msr psp, r0 \n" /* This is now the new top of stack to use in the task. */\r
+ " .syntax unified \n"\r
+ " ldr r2, pxCurrentTCBConst2 \n" /* Obtain location of pxCurrentTCB. */\r
+ " ldr r3, [r2] \n"\r
+ " ldr r0, [r3] \n" /* The first item in pxCurrentTCB is the task top of stack. */\r
+ " adds r0, #32 \n" /* Discard everything up to r0. */\r
+ " msr psp, r0 \n" /* This is now the new top of stack to use in the task. */\r
" movs r0, #2 \n" /* Switch to the psp stack. */\r
- " msr CONTROL, r0 \n"\r
+ " msr CONTROL, r0 \n"\r
" isb \n"\r
- " pop {r0-r5} \n" /* Pop the registers that are saved automatically. */\r
- " mov lr, r5 \n" /* lr is now in r5. */\r
- " pop {r3} \n" /* Return address is now in r3. */\r
- " pop {r2} \n" /* Pop and discard XPSR. */\r
+ " pop {r0-r5} \n" /* Pop the registers that are saved automatically. */\r
+ " mov lr, r5 \n" /* lr is now in r5. */\r
+ " pop {r3} \n" /* Return address is now in r3. */\r
+ " pop {r2} \n" /* Pop and discard XPSR. */\r
" cpsie i \n" /* The first task has its context and interrupts can be enabled. */\r
- " bx r3 \n" /* Finally, jump to the user defined task code. */\r
+ " bx r3 \n" /* Finally, jump to the user defined task code. */\r
" \n"\r
" .align 4 \n"\r
"pxCurrentTCBConst2: .word pxCurrentTCB "\r
functionality by defining configTASK_RETURN_ADDRESS. Call\r
vTaskSwitchContext() so link time optimisation does not remove the\r
symbol. */\r
- prvTaskExitError();\r
vTaskSwitchContext();\r
+ prvTaskExitError();\r
\r
/* Should not get here! */\r
return 0;\r
::: "memory"\r
);\r
\r
- /* To avoid compiler warnings. This line will never be reached. */\r
+#if !defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)\r
+ /* To avoid compiler warnings. The return statement will nevere be reached,\r
+ but some compilers warn if it is not included, while others won't compile if\r
+ it is. */\r
return 0;\r
+#endif\r
}\r
/*-----------------------------------------------------------*/\r
\r
-void vClearInterruptMaskFromISR( uint32_t ulMask )\r
+void vClearInterruptMaskFromISR( __attribute__( ( unused ) ) uint32_t ulMask )\r
{\r
__asm volatile(\r
" msr PRIMASK, r0 \n"\r
::: "memory"\r
);\r
\r
- /* Just to avoid compiler warning. */\r
+#if !defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)\r
+ /* Just to avoid compiler warning. ulMask is used from the asm code but\r
+ the compiler can't see that. Some compilers generate warnings without the\r
+ following line, while others generate warnings if the line is included. */\r
( void ) ulMask;\r
+#endif\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
__asm volatile\r
(\r
+ " .syntax unified \n"\r
" mrs r0, psp \n"\r
" \n"\r
" ldr r3, pxCurrentTCBConst \n" /* Get the location of the current TCB. */\r
" ldr r2, [r3] \n"\r
" \n"\r
- " sub r0, r0, #32 \n" /* Make space for the remaining low registers. */\r
+ " subs r0, r0, #32 \n" /* Make space for the remaining low registers. */\r
" str r0, [r2] \n" /* Save the new top of stack. */\r
" stmia r0!, {r4-r7} \n" /* Store the low registers that are not saved automatically. */\r
" mov r4, r8 \n" /* Store the high registers. */\r
" \n"\r
" ldr r1, [r2] \n"\r
" ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */\r
- " add r0, r0, #16 \n" /* Move to the high registers. */\r
+ " adds r0, r0, #16 \n" /* Move to the high registers. */\r
" ldmia r0!, {r4-r7} \n" /* Pop the high registers. */\r
" mov r8, r4 \n"\r
" mov r9, r5 \n"\r
" \n"\r
" msr psp, r0 \n" /* Remember the new top of stack for the task. */\r
" \n"\r
- " sub r0, r0, #32 \n" /* Go back for the low registers that are not automatically restored. */\r
+ " subs r0, r0, #32 \n" /* Go back for the low registers that are not automatically restored. */\r
" ldmia r0!, {r4-r7} \n" /* Pop low registers. */\r
" \n"\r
" bx r3 \n"\r
\r
static void prvTaskExitError( void )\r
{\r
+volatile uint32_t ulDummy = 0UL;\r
+\r
/* A function that implements a task must not exit or attempt to return to\r
its caller as there is nothing to return to. If a task wants to exit it\r
should instead call vTaskDelete( NULL ).\r
defined, then stop here so application writers can catch the error. */\r
configASSERT( uxCriticalNesting == ~0UL );\r
portDISABLE_INTERRUPTS();\r
- for( ;; );\r
+ while( ulDummy == 0 )\r
+ {\r
+ /* This file calls prvTaskExitError() after the scheduler has been\r
+ started to remove a compiler warning about the function being defined\r
+ but never called. ulDummy is used purely to quieten other warnings\r
+ about code appearing after this function is called - making ulDummy\r
+ volatile makes the compiler think the function could return and\r
+ therefore not output an 'unreachable code' warning for code that appears\r
+ after it. */\r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r
functionality by defining configTASK_RETURN_ADDRESS. Call\r
vTaskSwitchContext() so link time optimisation does not remove the\r
symbol. */\r
- prvTaskExitError();\r
vTaskSwitchContext();\r
+ prvTaskExitError();\r
\r
/* Should not get here! */\r
return 0;\r
\r
static void prvTaskExitError( void )\r
{\r
+volatile uint32_t ulDummy = 0;\r
+\r
/* A function that implements a task must not exit or attempt to return to\r
its caller as there is nothing to return to. If a task wants to exit it\r
should instead call vTaskDelete( NULL ).\r
defined, then stop here so application writers can catch the error. */\r
configASSERT( uxCriticalNesting == ~0UL );\r
portDISABLE_INTERRUPTS();\r
- for( ;; );\r
+ while( ulDummy == 0 )\r
+ {\r
+ /* This file calls prvTaskExitError() after the scheduler has been\r
+ started to remove a compiler warning about the function being defined\r
+ but never called. ulDummy is used purely to quieten other warnings\r
+ about code appearing after this function is called - making ulDummy\r
+ volatile makes the compiler think the function could return and\r
+ therefore not output an 'unreachable code' warning for code that appears\r
+ after it. */\r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r
functionality by defining configTASK_RETURN_ADDRESS. Call\r
vTaskSwitchContext() so link time optimisation does not remove the\r
symbol. */\r
- prvTaskExitError();\r
vTaskSwitchContext();\r
+ prvTaskExitError();\r
\r
/* Should not get here! */\r
return 0;\r
\r
static void prvTaskExitError( void )\r
{\r
+volatile uint32_t ulDummy = 0;\r
+\r
/* A function that implements a task must not exit or attempt to return to\r
its caller as there is nothing to return to. If a task wants to exit it\r
should instead call vTaskDelete( NULL ).\r
defined, then stop here so application writers can catch the error. */\r
configASSERT( uxCriticalNesting == ~0UL );\r
portDISABLE_INTERRUPTS();\r
- for( ;; );\r
+ while( ulDummy == 0 )\r
+ {\r
+ /* This file calls prvTaskExitError() after the scheduler has been\r
+ started to remove a compiler warning about the function being defined\r
+ but never called. ulDummy is used purely to quieten other warnings\r
+ about code appearing after this function is called - making ulDummy\r
+ volatile makes the compiler think the function could return and\r
+ therefore not output an 'unreachable code' warning for code that appears\r
+ after it. */\r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r
functionality by defining configTASK_RETURN_ADDRESS. Call\r
vTaskSwitchContext() so link time optimisation does not remove the\r
symbol. */\r
- prvTaskExitError();\r
vTaskSwitchContext();\r
+ prvTaskExitError();\r
\r
/* Should not get here! */\r
return 0;\r