/* Hardware specifics. */\r
#define portSTACK_GROWTH ( -1 )\r
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) \r
-#define portBYTE_ALIGNMENT 4\r
+#define portBYTE_ALIGNMENT 8\r
#define portYIELD() asm volatile ( "SWI" )\r
#define portNOP() asm volatile ( "NOP" )\r
\r
/* Architecture specifics. */\r
#define portSTACK_GROWTH ( -1 )\r
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) \r
-#define portBYTE_ALIGNMENT 4\r
+#define portBYTE_ALIGNMENT 8\r
#define portNOP() asm volatile ( "NOP" );\r
/*-----------------------------------------------------------*/ \r
\r
system mode, with interrupts enabled. */\r
*pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;\r
\r
- #ifdef THUMB_INTERWORK\r
+ if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00 )\r
{\r
/* We want the task to start in thumb mode. */\r
*pxTopOfStack |= portTHUMB_MODE_BIT;\r
}\r
- #endif\r
\r
pxTopOfStack--;\r
\r
\r
/* Scheduler includes. */\r
#include "FreeRTOS.h"\r
-#include "task.h"\r
\r
/* Constants required to handle interrupts. */\r
#define portTIMER_MATCH_ISR_BIT ( ( unsigned portCHAR ) 0x01 )\r
/* Within an IRQ ISR the link register has an offset from the true return \r
address, but an SWI ISR does not. Add the offset manually so the same \r
ISR return code can be used in both cases. */\r
- asm volatile ( "ADD LR, LR, #4" );\r
+ __asm volatile ( "ADD LR, LR, #4" );\r
\r
/* Perform the context switch. First save the context of the current task. */\r
portSAVE_CONTEXT();\r
\r
/* Find the highest priority task that is ready to run. */\r
- vTaskSwitchContext();\r
+ __asm volatile ( "bl vTaskSwitchContext" );\r
\r
/* Restore the context of the new task. */\r
portRESTORE_CONTEXT(); \r
\r
/* Increment the RTOS tick count, then look for the highest priority \r
task that is ready to run. */\r
- vTaskIncrementTick();\r
+ __asm volatile( "bl vTaskIncrementTick" );\r
\r
#if configUSE_PREEMPTION == 1\r
- vTaskSwitchContext();\r
+ __asm volatile( "bl vTaskSwitchContext" );\r
#endif\r
\r
/* Ready for the next interrupt. */\r
\r
void vPortDisableInterruptsFromThumb( void )\r
{\r
- asm volatile ( \r
+ __asm volatile ( \r
"STMDB SP!, {R0} \n\t" /* Push R0. */\r
"MRS R0, CPSR \n\t" /* Get CPSR. */\r
"ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */\r
\r
void vPortEnableInterruptsFromThumb( void )\r
{\r
- asm volatile ( \r
+ __asm volatile ( \r
"STMDB SP!, {R0} \n\t" /* Push R0. */ \r
"MRS R0, CPSR \n\t" /* Get CPSR. */ \r
"BIC R0, R0, #0xC0 \n\t" /* Enable IRQ, FIQ. */ \r
void vPortEnterCritical( void )\r
{\r
/* Disable interrupts as per portDISABLE_INTERRUPTS(); */\r
- asm volatile ( \r
+ __asm volatile ( \r
"STMDB SP!, {R0} \n\t" /* Push R0. */\r
"MRS R0, CPSR \n\t" /* Get CPSR. */\r
"ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */\r
if( ulCriticalNesting == portNO_CRITICAL_NESTING )\r
{\r
/* Enable interrupts as per portEXIT_CRITICAL(). */\r
- asm volatile ( \r
+ __asm volatile ( \r
"STMDB SP!, {R0} \n\t" /* Push R0. */ \r
"MRS R0, CPSR \n\t" /* Get CPSR. */ \r
"BIC R0, R0, #0xC0 \n\t" /* Enable IRQ, FIQ. */ \r
licensing and training services.\r
*/\r
\r
-/*\r
- Changes from V3.2.3\r
- \r
- + Modified portENTER_SWITCHING_ISR() to allow use with GCC V4.0.1.\r
-\r
- Changes from V3.2.4\r
-\r
- + Removed the use of the %0 parameter within the assembler macros and \r
- replaced them with hard coded registers. This will ensure the\r
- assembler does not select the link register as the temp register as\r
- was occasionally happening previously.\r
-\r
- + The assembler statements are now included in a single asm block rather\r
- than each line having its own asm block.\r
-\r
- Changes from V4.5.0\r
-\r
- + Removed the portENTER_SWITCHING_ISR() and portEXIT_SWITCHING_ISR() macros\r
- and replaced them with portYIELD_FROM_ISR() macro. Application code \r
- should now make use of the portSAVE_CONTEXT() and portRESTORE_CONTEXT()\r
- macros as per the V4.5.1 demo code.\r
-*/\r
-\r
#ifndef PORTMACRO_H\r
#define PORTMACRO_H\r
\r
/* Architecture specifics. */\r
#define portSTACK_GROWTH ( -1 )\r
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) \r
-#define portBYTE_ALIGNMENT 4\r
-#define portNOP() asm volatile ( "NOP" );\r
+#define portBYTE_ALIGNMENT 8\r
+#define portNOP() __asm volatile ( "NOP" );\r
/*-----------------------------------------------------------*/ \r
\r
\r
extern volatile unsigned portLONG ulCriticalNesting; \\r
\\r
/* Set the LR to the task stack. */ \\r
- asm volatile ( \\r
+ __asm volatile ( \\r
"LDR R0, =pxCurrentTCB \n\t" \\r
"LDR R0, [R0] \n\t" \\r
"LDR LR, [R0] \n\t" \\r
extern volatile unsigned portLONG ulCriticalNesting; \\r
\\r
/* Push R0 as we are going to use the register. */ \\r
- asm volatile ( \\r
+ __asm volatile ( \\r
"STMDB SP!, {R0} \n\t" \\r
\\r
/* Set R0 to point to the task stack pointer. */ \\r
( void ) pxCurrentTCB; \\r
}\r
\r
-\r
+extern void vTaskSwitchContext( void );\r
#define portYIELD_FROM_ISR() vTaskSwitchContext()\r
-#define portYIELD() asm volatile ( "SWI" )\r
+#define portYIELD() __asm volatile ( "SWI" )\r
/*-----------------------------------------------------------*/\r
\r
\r
#else\r
\r
#define portDISABLE_INTERRUPTS() \\r
- asm volatile ( \\r
+ __asm volatile ( \\r
"STMDB SP!, {R0} \n\t" /* Push R0. */ \\r
"MRS R0, CPSR \n\t" /* Get CPSR. */ \\r
"ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */ \\r
"LDMIA SP!, {R0} " ) /* Pop R0. */\r
\r
#define portENABLE_INTERRUPTS() \\r
- asm volatile ( \\r
+ __asm volatile ( \\r
"STMDB SP!, {R0} \n\t" /* Push R0. */ \\r
"MRS R0, CPSR \n\t" /* Get CPSR. */ \\r
"BIC R0, R0, #0xC0 \n\t" /* Enable IRQ, FIQ. */ \\r
/* Within an IRQ ISR the link register has an offset from the true return \r
address, but an SWI ISR does not. Add the offset manually so the same \r
ISR return code can be used in both cases. */\r
- asm volatile ( "ADD LR, LR, #4" );\r
+ __asm volatile ( "ADD LR, LR, #4" );\r
\r
/* Perform the context switch. First save the context of the current task. */\r
portSAVE_CONTEXT();\r
\r
/* Find the highest priority task that is ready to run. */\r
- vTaskSwitchContext();\r
+ __asm volatile( "bl vTaskSwitchContext" );\r
\r
/* Restore the context of the new task. */\r
portRESTORE_CONTEXT(); \r
\r
/* Increment the RTOS tick count, then look for the highest priority \r
task that is ready to run. */\r
- vTaskIncrementTick();\r
- vTaskSwitchContext();\r
+ __asm volatile( "bl vTaskIncrementTick" );\r
+ __asm volatile( "bl vTaskSwitchContext" );\r
\r
/* Ready for the next interrupt. */\r
T0IR = 2;\r
\r
void vPortDisableInterruptsFromThumb( void )\r
{\r
- asm volatile ( \r
+ __asm volatile ( \r
"STMDB SP!, {R0} \n\t" /* Push R0. */\r
"MRS R0, CPSR \n\t" /* Get CPSR. */\r
"ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */\r
\r
void vPortEnableInterruptsFromThumb( void )\r
{\r
- asm volatile ( \r
+ __asm volatile ( \r
"STMDB SP!, {R0} \n\t" /* Push R0. */ \r
"MRS R0, CPSR \n\t" /* Get CPSR. */ \r
"BIC R0, R0, #0xC0 \n\t" /* Enable IRQ, FIQ. */ \r
void vPortEnterCritical( void )\r
{\r
/* Disable interrupts as per portDISABLE_INTERRUPTS(); */\r
- asm volatile ( \r
+ __asm volatile ( \r
"STMDB SP!, {R0} \n\t" /* Push R0. */\r
"MRS R0, CPSR \n\t" /* Get CPSR. */\r
"ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */\r
if( ulCriticalNesting == portNO_CRITICAL_NESTING )\r
{\r
/* Enable interrupts as per portEXIT_CRITICAL(). */\r
- asm volatile ( \r
+ __asm volatile ( \r
"STMDB SP!, {R0} \n\t" /* Push R0. */ \r
"MRS R0, CPSR \n\t" /* Get CPSR. */ \r
"BIC R0, R0, #0xC0 \n\t" /* Enable IRQ, FIQ. */ \r
/* Architecture specifics. */\r
#define portSTACK_GROWTH ( -1 )\r
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) \r
-#define portBYTE_ALIGNMENT 4\r
-#define portNOP() asm volatile ( "NOP" );\r
+#define portBYTE_ALIGNMENT 8\r
+#define portNOP() __asm volatile ( "NOP" );\r
/*-----------------------------------------------------------*/ \r
\r
\r
extern volatile unsigned portLONG ulCriticalNesting; \\r
\\r
/* Set the LR to the task stack. */ \\r
- asm volatile ( \\r
+ __asm volatile ( \\r
"LDR R0, =pxCurrentTCB \n\t" \\r
"LDR R0, [R0] \n\t" \\r
"LDR LR, [R0] \n\t" \\r
extern volatile unsigned portLONG ulCriticalNesting; \\r
\\r
/* Push R0 as we are going to use the register. */ \\r
- asm volatile ( \\r
+ __asm volatile ( \\r
"STMDB SP!, {R0} \n\t" \\r
\\r
/* Set R0 to point to the task stack pointer. */ \\r
\r
\r
#define portYIELD_FROM_ISR() vTaskSwitchContext()\r
-#define portYIELD() asm volatile ( "SWI" )\r
+#define portYIELD() __asm volatile ( "SWI" )\r
/*-----------------------------------------------------------*/\r
\r
\r
#else\r
\r
#define portDISABLE_INTERRUPTS() \\r
- asm volatile ( \\r
+ __asm volatile ( \\r
"STMDB SP!, {R0} \n\t" /* Push R0. */ \\r
"MRS R0, CPSR \n\t" /* Get CPSR. */ \\r
"ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */ \\r
"LDMIA SP!, {R0} " ) /* Pop R0. */\r
\r
#define portENABLE_INTERRUPTS() \\r
- asm volatile ( \\r
+ __asm volatile ( \\r
"STMDB SP!, {R0} \n\t" /* Push R0. */ \\r
"MRS R0, CPSR \n\t" /* Get CPSR. */ \\r
"BIC R0, R0, #0xC0 \n\t" /* Enable IRQ, FIQ. */ \\r
/* Architecture specifics. */\r
#define portSTACK_GROWTH ( -1 )\r
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) \r
-#define portBYTE_ALIGNMENT 4\r
+#define portBYTE_ALIGNMENT 8\r
/*-----------------------------------------------------------*/ \r
\r
\r