;/*\r
-; FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+; FreeRTOS V9.0.0rc2 - Copyright (C) 2016 Real Time Engineers Ltd.\r
; All rights reserved\r
;\r
;\r
EXTERN vTaskSwitchContext\r
EXTERN ulPortYieldRequired\r
EXTERN ulPortInterruptNesting\r
+ EXTERN vApplicationIRQHandler\r
\r
PUBLIC FreeRTOS_SWI_Handler\r
PUBLIC FreeRTOS_IRQ_Handler\r
INCLUDE portASM.h\r
\r
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
-; SVC handler is used to start the scheduler and yield a task.\r
+; SVC handler is used to yield a task.\r
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
FreeRTOS_SWI_Handler\r
\r
portSAVE_CONTEXT\r
LDR R0, =vTaskSwitchContext\r
BLX R0\r
+ portRESTORE_CONTEXT\r
\r
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
+; vPortRestoreTaskContext is used to start the scheduler.\r
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
vPortRestoreTaskContext\r
- portRESTORE_CONTEXT\r
\r
+ PRESERVE8\r
+\r
+ ; Switch to system mode\r
+ CPS #SYS_MODE\r
+ portRESTORE_CONTEXT\r
\r
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
; IRQ interrupt handler used when individual priorities cannot be masked\r
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
FreeRTOS_IRQ_Handler\r
\r
+ PRESERVE8\r
+\r
; Return to the interrupted instruction.\r
SUB lr, lr, #4\r
\r
AND r2, r2, #4\r
SUB sp, sp, r2\r
\r
- ; Call the interrupt handler\r
PUSH {r0-r3, lr}\r
- LDR r1, =configINTERRUPT_VECTOR_ADDRESS\r
- LDR r0, [r1]\r
- STR r1, [r1] ; Write to IVR in case protect mode is being used.\r
+\r
+ ; Call the port part specific handler.\r
+ LDR r0, =vApplicationIRQHandler\r
BLX r0\r
POP {r0-r3, lr}\r
ADD sp, sp, r2\r
\r
CPSID i\r
\r
- ; Write to the EOI register\r
+ ; Write to the EOI register.\r
LDR r4, =configEOI_ADDRESS\r
STR r0, [r4]\r
\r
; Restore the old nesting count\r
STR r1, [r3]\r
\r
- ; A context switch is never performed if the nesting count is not 0\r
+ ; A context switch is never performed if the nesting count is not 0.\r
CMP r1, #0\r
BNE exit_without_switch\r
\r
; Restore the context of, and branch to, the task selected to execute next.\r
portRESTORE_CONTEXT\r
\r
-\r
END\r
\r
\r