Hi all,
I am trying to port FreeRTOS on Samsung S3C2440 (ARM9) processor (FriendlyArm’s Mini2440 board) using ADS 1.2 IDE
I am able to start the scheduler but no task switching takes place.
If I configure AppTickHook enabled from FreeRTOSConfig.h, then it is the only task being executed.
If AppTickHook is disabled then only the demo task is executed…it does not suspend (using vTaskSuspend() api) nor does it get delayed (using VTaskDelay() api).
I am using RVDS/ARM7_LPC21xx port files as reference
This is my assembly code for the SWI handler(in startup file), vPortYield and vPortYieldProcessor(both in portASM.s) which i think is the problem:
in startup.s:
MACRO
$HandlerLabel HANDLER $HandleLabel
$HandlerLabel
sub sp,sp,#4 ;decrement sp(to store jump address)
stmfd sp!,{r0} ;PUSH the work register to stack(lr does''t push because it return to original address)
ldr r0,=$HandleLabel ;load the address of HandleXXX to r0
ldr r0,[r0] ;load the contents(service routine start address) of HandleXXX
str r0,[sp,#4] ;store the contents(ISR) of HandleXXX to stack
ldmfd sp!,{r0,pc} ;POP the work register and pc(jump to ISR)
MEND
....
b HandlerSWI
....
HandlerSWI HANDLER HandleSWI
....
; Setup SWI handler
ldr r0,=HandleSWI
ldr r1,=vPortYieldProcessor
str r1,[r0]
....
In portASM.s:
....
vPortYield
PRESERVE8
SWI 0
....
vPortYieldProcessor
PRESERVE8
; Within an IRQ ISR the link register has an offset from the true return
; address, but an SWI ISR does not. Add the offset manually so the same
; ISR return code can be used in both cases.
ADD LR, LR, #4
; Perform the context switch.
portSAVE_CONTEXT ; Save current task context
LDR R0, =vTaskSwitchContext ; Get the address of the context switch function
MOV LR, PC ; Store the return address
BX R0 ; Call the contedxt switch function
portRESTORE_CONTEXT ; restore the context of the selected task
Thanks in advance for any help!!!