mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Allow auto switching between creating tasks in ARM mode and THUMB mode.
This commit is contained in:
parent
2cb1578b30
commit
b500ab8be2
|
@ -58,7 +58,8 @@
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
/* Constants required to setup the initial stack. */
|
/* Constants required to setup the initial stack. */
|
||||||
#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x3f ) /* System mode, THUMB mode, interrupts enabled. */
|
#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
|
||||||
|
#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 )
|
||||||
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 )
|
#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 )
|
||||||
|
|
||||||
/* Constants required to setup the PIT. */
|
/* Constants required to setup the PIT. */
|
||||||
|
@ -141,6 +142,13 @@ portSTACK_TYPE *pxOriginalTOS;
|
||||||
|
|
||||||
/* The status register is set for system mode, with interrupts enabled. */
|
/* The status register is set for system mode, with interrupts enabled. */
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;
|
*pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;
|
||||||
|
|
||||||
|
if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00UL )
|
||||||
|
{
|
||||||
|
/* We want the task to start in thumb mode. */
|
||||||
|
*pxTopOfStack |= portTHUMB_MODE_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
|
|
||||||
/* Interrupt flags cannot always be stored on the stack and will
|
/* Interrupt flags cannot always be stored on the stack and will
|
||||||
|
|
Loading…
Reference in a new issue