\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
#define portRESET_COUNT_ON_MATCH ( ( unsigned portLONG ) 0x02 )\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 setup the PIT. */\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