kimokono232 wrote on Sunday, December 29, 2013:
Hello,
I am new to FreeRTOS and I am trying to port it to an ARM9ES platform which is developed using rtl codes. so it’s a actually a simulation.
I have 2 GPIO peripherals when I create different tasks to use them separately. the task with the highest priority starts but gets blocked whereas the task with low priority works fine.
not only this but also, the ticks delay of the first task interferes in the second task. this means that after two ticks I see an incrementation vLEDTASK1 that is not delayed followed by another incrementation.
GPIO 1 and 2 start with value 1
tick 1 --> GPIO1 incremented to value 2
tick 2 --> GPIO1 incremented to value 3(without delay) then 4
while GPIO 2 is blocked after starting the task so it has continuously value 1
I think that the second tick that is supposed to increment GPIO2 increments GPIO1 and then since it’s the same tick that is suppose to increment GPIO1 in increments it a second time. thus 3 then 4.
while debugging I checked that the register R4 (led) and R5(address of GPIO set) are responsible for this. and at the second tick the register R5 contains only the value of GPIO1 set address (called two times) where it should be called one time for GPIO1 set and one time for GPIO2 set.
Any body has a clue on this?
May be there is an option in config that is activated or deactivated that is causing this ? I would like to mention that with only one task everything works fine.
int main( void )
{
IO0DIR = 0x00FF;
IO1DIR = 0x00FF;
xTaskCreate (vLEDTask, ( signed char * ) “LED”, configMINIMAL_STACK_SIZE, NULL,5, NULL ); // Stack is 90
xTaskCreate (vLEDTask1, ( signed char * ) “LED1”, configMINIMAL_STACK_SIZE, NULL,4, NULL );
vTaskStartScheduler();
return 0;
}
/-----------------------------------------------------------/
static void vLEDTask( void ) //GPIO 2
{
int led=0;
while (1)
{
led++;
IO0SET = led & 0xFF;
vTaskDelay(2);
}
}
static void vLEDTask1( void ) //GPIO 1
{
int led=0;
while (1)
{
led++;
IO1SET = led & 0xFF;
vTaskDelay(1);
}
}
configUSE_PREEMPTION is defined as 1
just to make sure I got things rights these are the files I am including:
boot.s main.c tasks.c list.c queue.c heap_1.c port.c portISR.c ( I think they work fine since I could save and restore context correctly) but is there anything missing ? also portmacro.h contains save and restore context.
in portISR.c
vPremptivetick does: add LR,LR,#4, save, switch, restore (address 0x8) SWI
vTickISR does: save, increment tick, switch, restore (address 0x18) IRQ