From 0dce91538f3d9e095a4625185871beebc2211b4a Mon Sep 17 00:00:00 2001 From: richardbarry Date: Sat, 6 Dec 2008 13:35:43 +0000 Subject: [PATCH] Minor updates only. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@596 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Source/portable/IAR/AtmelSAM9XE/port.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/portable/IAR/AtmelSAM9XE/port.c b/Source/portable/IAR/AtmelSAM9XE/port.c index 32eef0e76..0ecb0ebfc 100644 --- a/Source/portable/IAR/AtmelSAM9XE/port.c +++ b/Source/portable/IAR/AtmelSAM9XE/port.c @@ -72,7 +72,8 @@ /*-----------------------------------------------------------*/ /* 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 ) /* Constants required to setup the PIT. */ @@ -158,6 +159,14 @@ portSTACK_TYPE *pxOriginalTOS; /* The status register is set for system mode, with interrupts enabled. */ *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + + #ifdef THUMB_INTERWORK + { + /* We want the task to start in thumb mode. */ + *pxTopOfStack |= portTHUMB_MODE_BIT; + } + #endif + pxTopOfStack--; /* Interrupt flags cannot always be stored on the stack and will -- 2.39.2