From 3d6d02dc299e50cad8135a0fadbd27a9583ce870 Mon Sep 17 00:00:00 2001 From: rtel Date: Tue, 4 Feb 2014 17:02:52 +0000 Subject: [PATCH] Add configCLEAR_TICK_INTERRUPT() to the IAR and RVDS Cortex-A9 ports. Replace LDMFD with POP instructions in IAR and RVDS Cortex-A9 ports. Replace branch to address with indirect branch and exchange to address in register in the IAR and RVDS Cortex-A9 ports. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2193 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- FreeRTOS/Source/include/list.h | 2 +- FreeRTOS/Source/include/task.h | 3 +++ FreeRTOS/Source/portable/IAR/ARM_CA9/port.c | 6 +++++- FreeRTOS/Source/portable/IAR/ARM_CA9/portASM.h | 2 +- FreeRTOS/Source/portable/IAR/ARM_CA9/portASM.s | 6 ++++-- FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c | 6 +++++- FreeRTOS/Source/portable/RVDS/ARM_CA9/portASM.s | 6 ++++-- FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.inc | 2 +- FreeRTOS/Source/tasks.c | 4 +++- 9 files changed, 27 insertions(+), 10 deletions(-) diff --git a/FreeRTOS/Source/include/list.h b/FreeRTOS/Source/include/list.h index 3f40a6737..f31cc5588 100644 --- a/FreeRTOS/Source/include/list.h +++ b/FreeRTOS/Source/include/list.h @@ -218,7 +218,7 @@ typedef struct xLIST /* * Return the list item at the head of the list. * - * \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY + * \page listGET_NEXT listGET_NEXT * \ingroup LinkedList */ #define listGET_NEXT( pxListItem ) ( ( pxListItem )->pxNext ) diff --git a/FreeRTOS/Source/include/task.h b/FreeRTOS/Source/include/task.h index 39de192f5..614565b88 100644 --- a/FreeRTOS/Source/include/task.h +++ b/FreeRTOS/Source/include/task.h @@ -82,6 +82,9 @@ extern "C" { *----------------------------------------------------------*/ #define tskKERNEL_VERSION_NUMBER "V8.0.0 release candidate 1" +#define tskKERNEL_VERSION_MAJOR 8 +#define tskKERNEL_VERSION_MINOR 0 +#define tskKERNEL_VERSION_BUILD 0 /** * task. h diff --git a/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c b/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c index 75c5eadeb..5722d4772 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c @@ -113,6 +113,10 @@ #error configMAX_API_CALL_INTERRUPT_PRIORITY must be greater than ( configUNIQUE_INTERRUPT_PRIORITIES / 2 ) #endif +#ifndef configCLEAR_TICK_INTERRUPT + #define configCLEAR_TICK_INTERRUPT() +#endif + /* A critical section is exited when the critical section nesting count reaches this value. */ #define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) @@ -131,7 +135,6 @@ context. */ /* Constants required to setup the initial task context. */ #define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ #define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) -#define portINTERRUPT_ENABLE_BIT ( 0x80UL ) #define portTHUMB_MODE_ADDRESS ( 0x01UL ) /* Used by portASSERT_IF_INTERRUPT_PRIORITY_INVALID() when ensuring the binary @@ -354,6 +357,7 @@ void FreeRTOS_Tick_Handler( void ) /* Ensure all interrupt priorities are active again. */ portCLEAR_INTERRUPT_MASK(); + configCLEAR_TICK_INTERRUPT(); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CA9/portASM.h b/FreeRTOS/Source/portable/IAR/ARM_CA9/portASM.h index b2d47c82c..4c8cb5608 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CA9/portASM.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CA9/portASM.h @@ -113,7 +113,7 @@ portRESTORE_CONTEXT macro CMP R1, #0 ; Restore the floating point context, if any - LDMFDNE SP!, {R0} + POPNE {R0} VPOPNE {D16-D31} VPOPNE {D0-D15} VMSRNE FPSCR, R0 diff --git a/FreeRTOS/Source/portable/IAR/ARM_CA9/portASM.s b/FreeRTOS/Source/portable/IAR/ARM_CA9/portASM.s index 806ec0970..0a13b3f8f 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CA9/portASM.s +++ b/FreeRTOS/Source/portable/IAR/ARM_CA9/portASM.s @@ -130,7 +130,8 @@ FreeRTOS_IRQ_Handler ; Call the interrupt handler PUSH {r0-r3, lr} - BL vApplicationIRQHandler + LDR r1, =vApplicationIRQHandler + BLX r1 POP {r0-r3, lr} ADD sp, sp, r2 @@ -184,7 +185,8 @@ switch_before_exit ; vTaskSwitchContext() if vTaskSwitchContext() uses LDRD or STRD ; instructions, or 8 byte aligned stack allocated data. LR does not need ; saving as a new LR will be loaded by portRESTORE_CONTEXT anyway. - BL vTaskSwitchContext + LDR r0, =vTaskSwitchContext + BLX r0 ; Restore the context of, and branch to, the task selected to execute next. portRESTORE_CONTEXT diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c index 04f22a4b0..f67aba743 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c @@ -110,6 +110,10 @@ #error configMAX_API_CALL_INTERRUPT_PRIORITY must be greater than ( configUNIQUE_INTERRUPT_PRIORITIES / 2 ) #endif +#ifndef configCLEAR_TICK_INTERRUPT + #define configCLEAR_TICK_INTERRUPT() +#endif + /* The number of bits to shift for an interrupt priority is dependent on the number of bits implemented by the interrupt controller. */ #if configUNIQUE_INTERRUPT_PRIORITIES == 16 @@ -167,7 +171,6 @@ point is zero. */ /* Constants required to setup the initial task context. */ #define portINITIAL_SPSR ( ( StackType_t ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ #define portTHUMB_MODE_BIT ( ( StackType_t ) 0x20 ) -#define portINTERRUPT_ENABLE_BIT ( 0x80UL ) #define portTHUMB_MODE_ADDRESS ( 0x01UL ) /* Masks all bits in the APSR other than the mode bits. */ @@ -393,6 +396,7 @@ void FreeRTOS_Tick_Handler( void ) /* Ensure all interrupt priorities are active again. */ portCLEAR_INTERRUPT_MASK(); + configCLEAR_TICK_INTERRUPT(); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CA9/portASM.s b/FreeRTOS/Source/portable/RVDS/ARM_CA9/portASM.s index e3058d088..0dff19e0b 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CA9/portASM.s +++ b/FreeRTOS/Source/portable/RVDS/ARM_CA9/portASM.s @@ -126,7 +126,8 @@ FreeRTOS_IRQ_Handler ; Call the interrupt handler PUSH {r0-r3, lr} - BL vApplicationIRQHandler + LDR r1, =vApplicationIRQHandler + BLX r1 POP {r0-r3, lr} ADD sp, sp, r2 @@ -180,7 +181,8 @@ switch_before_exit ; vTaskSwitchContext() if vTaskSwitchContext() uses LDRD or STRD ; instructions, or 8 byte aligned stack allocated data. LR does not need ; saving as a new LR will be loaded by portRESTORE_CONTEXT anyway. - BL vTaskSwitchContext + LDR r0, =vTaskSwitchContext + BLX r0 ; Restore the context of, and branch to, the task selected to execute next. portRESTORE_CONTEXT diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.inc b/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.inc index 34df9b5e8..c91e5a6c5 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.inc +++ b/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.inc @@ -120,7 +120,7 @@ IRQ_MODE EQU 0x12 CMP R1, #0 ; Restore the floating point context, if any - LDMFDNE SP!, {R0} + POPNE {R0} VPOPNE {D16-D31} VPOPNE {D0-D15} VMSRNE FPSCR, R0 diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c index 91df4ec30..51747b5e6 100644 --- a/FreeRTOS/Source/tasks.c +++ b/FreeRTOS/Source/tasks.c @@ -1678,7 +1678,9 @@ UBaseType_t uxSavedInterruptStatus; portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); - xReturn = xTickCount; + { + xReturn = xTickCount; + } portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); return xReturn; -- 2.39.5