mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-21 22:11:57 -04:00
Continue working on the GIC-less Cortex-A5 port for IAR:
- Add in the assert when a task attempts to exit its implementing function without deleting itself. - Remove obsolete code from the context switch asm code (obsoleted by the fact that there is no mask register). - Attempt to make code more generic by using definitions for additional register addresses.
This commit is contained in:
parent
e9b5deb34a
commit
3a3d061cc5
|
@ -111,6 +111,11 @@ mode. */
|
||||||
*/
|
*/
|
||||||
extern void vPortRestoreTaskContext( void );
|
extern void vPortRestoreTaskContext( void );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Used to catch tasks that attempt to return from their implementing function.
|
||||||
|
*/
|
||||||
|
static void prvTaskExitError( void );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* A variable is used to keep track of the critical section nesting. This
|
/* A variable is used to keep track of the critical section nesting. This
|
||||||
|
@ -137,7 +142,6 @@ uint32_t ulPortInterruptNesting = 0UL;
|
||||||
#warning What about branch distance in asm file.
|
#warning What about branch distance in asm file.
|
||||||
#warning Does not support flop use in ISRs.
|
#warning Does not support flop use in ISRs.
|
||||||
#warning Level interrupts must be cleared in their handling function.
|
#warning Level interrupts must be cleared in their handling function.
|
||||||
#warning Can this be made generic by defining the vector address register externally?
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See header file for description.
|
* See header file for description.
|
||||||
|
@ -165,13 +169,13 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
|
||||||
}
|
}
|
||||||
|
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
#warning What about task exit error function?
|
|
||||||
/* Next the return address, which in this case is the start of the task. */
|
/* Next the return address, which in this case is the start of the task. */
|
||||||
*pxTopOfStack = ( StackType_t ) pxCode;
|
*pxTopOfStack = ( StackType_t ) pxCode;
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
|
|
||||||
/* Next all the registers other than the stack pointer. */
|
/* Next all the registers other than the stack pointer. */
|
||||||
*pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */
|
*pxTopOfStack = ( StackType_t ) prvTaskExitError; /* R14 */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */
|
*pxTopOfStack = ( StackType_t ) 0x12121212; /* R12 */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
|
@ -214,6 +218,20 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvTaskExitError( void )
|
||||||
|
{
|
||||||
|
/* A function that implements a task must not exit or attempt to return to
|
||||||
|
its caller as there is nothing to return to. If a task wants to exit it
|
||||||
|
should instead call vTaskDelete( NULL ).
|
||||||
|
|
||||||
|
Artificially force an assert() to be triggered if configASSERT() is
|
||||||
|
defined, then stop here so application writers can catch the error. */
|
||||||
|
configASSERT( ulPortInterruptNesting == ~0UL );
|
||||||
|
portDISABLE_INTERRUPTS();
|
||||||
|
for( ;; );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
BaseType_t xPortStartScheduler( void )
|
BaseType_t xPortStartScheduler( void )
|
||||||
{
|
{
|
||||||
uint32_t ulAPSR;
|
uint32_t ulAPSR;
|
||||||
|
@ -228,7 +246,6 @@ uint32_t ulAPSR;
|
||||||
{
|
{
|
||||||
/* Start the timer that generates the tick ISR. */
|
/* Start the timer that generates the tick ISR. */
|
||||||
configSETUP_TICK_INTERRUPT();
|
configSETUP_TICK_INTERRUPT();
|
||||||
#warning Install spurious handler
|
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
vPortRestoreTaskContext();
|
vPortRestoreTaskContext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,18 +127,12 @@ portRESTORE_CONTEXT macro
|
||||||
POP {R1}
|
POP {R1}
|
||||||
STR R1, [R0]
|
STR R1, [R0]
|
||||||
|
|
||||||
; Ensure the priority mask is correct for the critical nesting depth
|
|
||||||
;_RB_ LDR R2, =portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS
|
|
||||||
CMP R1, #0
|
|
||||||
MOVEQ R4, #255
|
|
||||||
;_RB_ LDRNE R4, =( configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT )
|
|
||||||
STR R4, [r2]
|
|
||||||
|
|
||||||
; Restore all system mode registers other than the SP (which is already
|
; Restore all system mode registers other than the SP (which is already
|
||||||
; being used)
|
; being used)
|
||||||
POP {R0-R12, R14}
|
POP {R0-R12, R14}
|
||||||
|
|
||||||
; Return to the task code, loading CPSR on the way.
|
; Return to the task code, loading CPSR on the way. CPSR has the interrupt
|
||||||
|
; enable bit set appropriately for the task about to execute.
|
||||||
RFEIA sp!
|
RFEIA sp!
|
||||||
|
|
||||||
endm
|
endm
|
||||||
|
|
|
@ -67,10 +67,6 @@ SYS_MODE EQU 0x1f
|
||||||
SVC_MODE EQU 0x13
|
SVC_MODE EQU 0x13
|
||||||
IRQ_MODE EQU 0x12
|
IRQ_MODE EQU 0x12
|
||||||
|
|
||||||
; AIC register definitions.
|
|
||||||
AIC_IVR EQU 0xFFFFF010UL
|
|
||||||
AIC_EOICR EQU 0xFFFFF038UL
|
|
||||||
|
|
||||||
SECTION .text:CODE:ROOT(2)
|
SECTION .text:CODE:ROOT(2)
|
||||||
ARM
|
ARM
|
||||||
|
|
||||||
|
@ -93,7 +89,7 @@ vPortRestoreTaskContext
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; AIC interrupt handler
|
; IRQ interrupt handler used when individual priorities cannot be masked
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
FreeRTOS_IRQ_Handler
|
FreeRTOS_IRQ_Handler
|
||||||
|
|
||||||
|
@ -127,7 +123,7 @@ FreeRTOS_IRQ_Handler
|
||||||
|
|
||||||
; Call the interrupt handler
|
; Call the interrupt handler
|
||||||
PUSH {r0-r3, lr}
|
PUSH {r0-r3, lr}
|
||||||
LDR r1, =AIC_IVR
|
LDR r1, =configINTERRUPT_VECTOR_ADDRESS
|
||||||
LDR r0, [r1]
|
LDR r0, [r1]
|
||||||
STR r1, [r1] ; Write to IVR in case protect mode is being used.
|
STR r1, [r1] ; Write to IVR in case protect mode is being used.
|
||||||
BLX r0
|
BLX r0
|
||||||
|
@ -137,7 +133,7 @@ FreeRTOS_IRQ_Handler
|
||||||
CPSID i
|
CPSID i
|
||||||
|
|
||||||
; Write to the EOI register
|
; Write to the EOI register
|
||||||
LDR r4, =AIC_EOICR
|
LDR r4, =configEOI_ADDRESS
|
||||||
STR r0, [r4]
|
STR r0, [r4]
|
||||||
|
|
||||||
; Restore the old nesting count
|
; Restore the old nesting count
|
||||||
|
|
Loading…
Reference in a new issue