\r
This file is part of the FreeRTOS distribution.\r
\r
- FreeRTOS is free software; you can redistribute it and/or modify it under \r
- the terms of the GNU General Public License (version 2) as published by the \r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
Free Software Foundation and modified by the FreeRTOS exception.\r
**NOTE** The exception to the GPL is included to allow you to distribute a\r
- combined work that includes FreeRTOS without being obliged to provide the \r
- source code for proprietary components outside of the FreeRTOS kernel. \r
- Alternative commercial license and support terms are also available upon \r
- request. See the licensing section of http://www.FreeRTOS.org for full \r
+ combined work that includes FreeRTOS without being obliged to provide the\r
+ source code for proprietary components outside of the FreeRTOS kernel.\r
+ Alternative commercial license and support terms are also available upon\r
+ request. See the licensing section of http://www.FreeRTOS.org for full\r
license details.\r
\r
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
*/\r
\r
/*-----------------------------------------------------------\r
- * Implementation of functions defined in portable.h for the ST STR71x ARM7 \r
+ * Implementation of functions defined in portable.h for the ST STR71x ARM7\r
* port.\r
*----------------------------------------------------------*/\r
\r
#include "task.h"\r
\r
/* Constants required to setup the initial stack. */\r
-#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x3f ) /* System mode, THUMB mode, interrupts enabled. */\r
+#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */\r
+#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 )\r
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 )\r
\r
/* Constants required to handle critical sections. */\r
during the kernel initialisation process. */\r
unsigned portLONG ulCriticalNesting = ( unsigned portLONG ) 9999;\r
\r
-/* Tick interrupt routines for cooperative and preemptive operation \r
+/* Tick interrupt routines for cooperative and preemptive operation\r
respectively. The preemptive version is not defined as __irq as it is called\r
from an asm wrapper function. */\r
__arm __irq void vPortNonPreemptiveTick( void );\r
\r
/* The status register is set for system mode, with interrupts enabled. */\r
*pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;\r
+ \r
+ if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00UL )\r
+ {\r
+ /* We want the task to start in thumb mode. */\r
+ *pxTopOfStack |= portTHUMB_MODE_BIT;\r
+ } \r
+ \r
pxTopOfStack--;\r
\r
/* Interrupt flags cannot always be stored on the stack and will\r
vTaskIncrementTick();\r
\r
/* The new tick value might unblock a task. Ensure the highest task that\r
- is ready to execute is the task that will execute when the tick ISR \r
+ is ready to execute is the task that will execute when the tick ISR\r
exits. */\r
vTaskSwitchContext();\r
\r