From ca1f6ddab67e5d07a81943e3fc6808684a1719e5 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Sun, 29 Aug 2010 17:12:12 +0000 Subject: [PATCH] Update the IAR RX62N port files, which are now functional. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1069 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Source/include/StackMacros.h | 20 ++-- Source/portable/IAR/RX600/port.c | 6 +- Source/portable/IAR/RX600/port_asm.s | 144 +++++++++++++-------------- 3 files changed, 84 insertions(+), 86 deletions(-) diff --git a/Source/include/StackMacros.h b/Source/include/StackMacros.h index 1e807da9a..579ec766d 100644 --- a/Source/include/StackMacros.h +++ b/Source/include/StackMacros.h @@ -33,9 +33,9 @@ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License and the FreeRTOS license exception along with FreeRTOS; if not it - can be viewed here: http://www.freertos.org/a00114.html and also obtained + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained by writing to Richard Barry, contact details for whom are available on the FreeRTOS WEB site. @@ -63,7 +63,7 @@ * the current stack state only - comparing the current top of stack value to * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 * will also cause the last few stack bytes to be checked to ensure the value - * to which the bytes were set when the task was created have not been + * to which the bytes were set when the task was created have not been * overwritten. Note this second test does not guarantee that an overflowed * stack will always be recognised. */ @@ -110,7 +110,7 @@ /* Only the current stack state is to be checked. */ #define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \ { \ - extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ + extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ \ /* Is the currently saved stack pointer within the stack limit? */ \ if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ @@ -126,8 +126,8 @@ #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \ { \ - extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ - static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ + static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ @@ -148,9 +148,9 @@ #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \ { \ - extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ - char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \ - static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ + char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \ + static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ diff --git a/Source/portable/IAR/RX600/port.c b/Source/portable/IAR/RX600/port.c index fedf97e51..6b5701657 100644 --- a/Source/portable/IAR/RX600/port.c +++ b/Source/portable/IAR/RX600/port.c @@ -69,8 +69,8 @@ /* Tasks should start with interrupts enabled and in Supervisor mode, therefore PSW is set with U and I set, and PM and IPL clear. */ -#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) -#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 ) +#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) +#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 ) /*-----------------------------------------------------------*/ @@ -188,7 +188,7 @@ extern void vApplicationSetupTimerInterrupt( void ); } /*-----------------------------------------------------------*/ -#pragma vector = VECT_CMT0_CMI0 +#pragma vector = configTICK_VECTOR __interrupt void vTickISR( void ) { /* Re-enable interrupts. */ diff --git a/Source/portable/IAR/RX600/port_asm.s b/Source/portable/IAR/RX600/port_asm.s index f057dee66..6e8c1787d 100644 --- a/Source/portable/IAR/RX600/port_asm.s +++ b/Source/portable/IAR/RX600/port_asm.s @@ -52,134 +52,132 @@ */ PUBLIC _prvStartFirstTask - PUBLIC _vSoftwareInterruptISR - + PUBLIC ___interrupt_27 + EXTERN _pxCurrentTCB EXTERN _vTaskSwitchContext RSEG CODE:CODE(4) - + _prvStartFirstTask: /* When starting the scheduler there is nothing that needs moving to the interrupt stack because the function is not called from an interrupt. Just ensure the current stack is the user stack. */ - SETPSW U + SETPSW U /* Obtain the location of the stack associated with which ever task pxCurrentTCB is currently pointing to. */ - MOV.L #_pxCurrentTCB, R15 - MOV.L [R15], R15 - MOV.L [R15], R0 + MOV.L #_pxCurrentTCB, R15 + MOV.L [R15], R15 + MOV.L [R15], R0 /* Restore the registers from the stack of the task pointed to by pxCurrentTCB. */ - POP R15 - + POP R15 + /* Accumulator low 32 bits. */ - MVTACLO R15 - POP R15 - + MVTACLO R15 + POP R15 + /* Accumulator high 32 bits. */ - MVTACHI R15 - POP R15 - + MVTACHI R15 + POP R15 + /* Floating point status word. */ - MVTC R15, FPSW - + MVTC R15, FPSW + /* R1 to R15 - R0 is not included as it is the SP. */ - POPM R1-R15 - + POPM R1-R15 + /* This pops the remaining registers. */ - RTE - NOP - NOP + RTE + NOP + NOP /*-----------------------------------------------------------*/ -_vSoftwareInterruptISR: +/* The software interrupt - overwrite the default 'weak' definition. */ +___interrupt_27: /* Re-enable interrupts. */ SETPSW I /* Move the data that was automatically pushed onto the interrupt stack when the interrupt occurred from the interrupt stack to the user stack. - + R15 is saved before it is clobbered. */ - PUSH.L R15 - + PUSH.L R15 + /* Read the user stack pointer. */ - MVFC USP, R15 - + MVFC USP, R15 + /* Move the address down to the data being moved. */ - SUB #12, R15 - MVTC R15, USP - + SUB #12, R15 + MVTC R15, USP + /* Copy the data across, R15, then PC, then PSW. */ - MOV.L [ R0 ], [ R15 ] - MOV.L 4[ R0 ], 4[ R15 ] - MOV.L 8[ R0 ], 8[ R15 ] + MOV.L [ R0 ], [ R15 ] + MOV.L 4[ R0 ], 4[ R15 ] + MOV.L 8[ R0 ], 8[ R15 ] /* Move the interrupt stack pointer to its new correct position. */ - ADD #12, R0 - + ADD #12, R0 + /* All the rest of the registers are saved directly to the user stack. */ - SETPSW U + SETPSW U /* Save the rest of the general registers (R15 has been saved already). */ - PUSHM R1-R14 - + PUSHM R1-R14 + /* Save the FPSW and accumulator. */ - MVFC FPSW, R15 - PUSH.L R15 - MVFACHI R15 - PUSH.L R15 - + MVFC FPSW, R15 + PUSH.L R15 + MVFACHI R15 + PUSH.L R15 + /* Middle word. */ - MVFACMI R15 - + MVFACMI R15 + /* Shifted left as it is restored to the low order word. */ - SHLL #16, R15 - PUSH.L R15 + SHLL #16, R15 + PUSH.L R15 /* Save the stack pointer to the TCB. */ - MOV.L #_pxCurrentTCB, R15 - MOV.L [ R15 ], R15 - MOV.L R0, [ R15 ] - + MOV.L #_pxCurrentTCB, R15 + MOV.L [ R15 ], R15 + MOV.L R0, [ R15 ] + /* Ensure the interrupt mask is set to the syscall priority while the kernel structures are being accessed. */ - MVTIPL #4 + MVTIPL #4 /* Select the next task to run. */ - BSR.A _vTaskSwitchContext + BSR.A _vTaskSwitchContext /* Reset the interrupt mask as no more data structure access is required. */ - MVTIPL #1 + MVTIPL #1 /* Load the stack pointer of the task that is now selected as the Running state task from its TCB. */ - MOV.L #_pxCurrentTCB,R15 - MOV.L [ R15 ], R15 - MOV.L [ R15 ], R0 + MOV.L #_pxCurrentTCB,R15 + MOV.L [ R15 ], R15 + MOV.L [ R15 ], R0 /* Restore the context of the new task. The PSW (Program Status Word) and PC will be popped by the RTE instruction. */ - POP R15 - MVTACLO R15 - POP R15 - MVTACHI R15 - POP R15 - MVTC R15, FPSW - POPM R1-R15 - RTE - NOP - NOP - - /*:: i(configMAX_SYSCALL_INTERRUPT_PRIORITY), i(configKERNEL_INTERRUPT_PRIORITY)*/ -/*-----------------------------------------------------------*/ - + POP R15 + MVTACLO R15 + POP R15 + MVTACHI R15 + POP R15 + MVTC R15, FPSW + POPM R1-R15 + RTE + NOP + NOP +/*-----------------------------------------------------------*/ END - + -- 2.39.5