]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/portable/GCC/ARM_CRx_No_GIC/portASM.S
Simplify and improve GIC-less Cortex-R4 port.
[freertos] / FreeRTOS / Source / portable / GCC / ARM_CRx_No_GIC / portASM.S
index 9f91560a2a9a8c033e311ce676fa7feb934a2262..d33c25c050c206def3c8395e94af69b21a09b3e6 100644 (file)
@@ -75,8 +75,6 @@
        .global vPortRestoreTaskContext\r
 \r
 \r
-\r
-\r
 .macro portSAVE_CONTEXT\r
 \r
        /* Save the LR and SPSR onto the system mode stack before switching to\r
@@ -190,22 +188,23 @@ FreeRTOS_IRQ_Handler:
        PUSH    {lr}\r
 \r
        /* Change to supervisor mode to allow reentry. */\r
+       CPS             #0x13\r
 \r
        /* Push used registers. */\r
-       PUSH    {r0-r4, r12}\r
+       PUSH    {r0-r3, r12}\r
 \r
        /* Increment nesting count.  r3 holds the address of ulPortInterruptNesting\r
        for future use.  r1 holds the original ulPortInterruptNesting value for\r
        future use. */\r
        LDR             r3, ulPortInterruptNestingConst\r
        LDR             r1, [r3]\r
-       ADD             r4, r1, #1\r
-       STR             r4, [r3]\r
+       ADD             r0, r1, #1\r
+       STR             r0, [r3]\r
 \r
        /* Ensure bit 2 of the stack pointer is clear.  r2 holds the bit 2 value for\r
        future use. */\r
-       MOV             r2, sp\r
-       AND             r2, r2, #4\r
+       MOV             r0, sp\r
+       AND             r2, r0, #4\r
        SUB             sp, sp, r2\r
 \r
        /* Call the interrupt handler. */\r
@@ -220,9 +219,9 @@ FreeRTOS_IRQ_Handler:
        ISB\r
 \r
        /* Write to the EOI register. */\r
-       LDR     r4, ulICCEOIRConst\r
-       LDR             r4, [r4]\r
-       STR             r0, [r4]\r
+       LDR     r0, ulICCEOIRConst\r
+       LDR             r2, [r0]\r
+       STR             r0, [r2]\r
 \r
        /* Restore the old nesting count. */\r
        STR             r1, [r3]\r
@@ -234,7 +233,7 @@ FreeRTOS_IRQ_Handler:
        /* Did the interrupt request a context switch?  r1 holds the address of\r
        ulPortYieldRequired and r0 the value of ulPortYieldRequired for future\r
        use. */\r
-       LDR             r1, =ulPortYieldRequired\r
+       LDR             r1, ulPortYieldRequiredConst\r
        LDR             r0, [r1]\r
        CMP             r0, #0\r
        BNE             switch_before_exit\r
@@ -242,7 +241,7 @@ FreeRTOS_IRQ_Handler:
 exit_without_switch:\r
        /* No context switch.  Restore used registers, LR_irq and SPSR before\r
        returning. */\r
-       POP             {r0-r4, r12}\r
+       POP             {r0-r3, r12}\r
        CPS             #IRQ_MODE\r
        POP             {LR}\r
        MSR             SPSR_cxsf, LR\r
@@ -257,7 +256,7 @@ switch_before_exit:
 \r
        /* Restore used registers, LR-irq and SPSR before saving the context\r
        to the task stack. */\r
-       POP             {r0-r4, r12}\r
+       POP             {r0-r3, r12}\r
        CPS             #IRQ_MODE\r
        POP             {LR}\r
        MSR             SPSR_cxsf, LR\r
@@ -282,6 +281,7 @@ ulPortTaskHasFPUContextConst: .word ulPortTaskHasFPUContext
 vTaskSwitchContextConst: .word vTaskSwitchContext\r
 vApplicationIRQHandlerConst: .word vApplicationIRQHandler\r
 ulPortInterruptNestingConst: .word ulPortInterruptNesting\r
+ulPortYieldRequiredConst: .word ulPortYieldRequired\r
 \r
 .end\r
 \r