By doing the below changes i am able to run the multiple tasks.
I have created the three tasks in my main programme and started the scheduler.
In my each task entry i am enabling my IRQ interrupts and before exiting task disbaling the irq interrupts.
Why i enabled the interrupts:
I observed that once entering into the task interrupts are disabling and i am not getting the IRQ interrupts and contineously only that task is running.
Once i enabled the interrupts i am getting the interrupt and next task getting the cpu time slice and it is running. But these tasks are running in ARM IRQ mode.
Are your clearing the timer interrupt anywhere? When a timer generates an interrupt it is normal for the interrupt handler to clear the interrupt in the peripheral. It is often additionally necessary to clear the interrupt in the interrupt controller too. How that is done is chip specific, and not FreeRTOS related, but it sounds like you might be missing that step somewhere.
Yes i am clearing the my timer interrupt in my interrupt handler.
Once interrupt comes i am checking that this is timer interrupt, if it is timer interrupt then i am clearing the timer interrupt in my simple interrupt controller.
I’m afraid without having the project and hardware in front of me I don’t know what the missing step is. OSTimeTick() should now just be a standard C function (not naked).
In case od ARM will jump into the generic handler called do_irq() inside this handlwe will check for which peripheral has raised the interrupt then will call the OSTimeTick().
Please could you suggest me now i have to made OSTimeTick() as naked or do_irq() naked?
As already said - if you are using a single interrupt entry point that is saving the task context, then determining the interrupt source, then calling the appropriate C function to handle the interrupt source…the C function that is called should be a standard C function - not a naked function.
All the stack manipulation and context saving and restoring is performed in just on place - the IRQ entry point. After that everything is just C code managed by the compiler.
I observed the code for Cortex-M3 and i found the below observations.
void xPortSysTickHandler( void ) and
void xPortPendSVHandler( void ) inside this handler we are getting the current TCB and saving all the processor registers and calling
bl vTaskSwitchContext and restoring the context.
Whenever the timer gets expired xPortSysTickHandler() function will be called and timer tick count gets incremented.
Please could you clarify me the below.When the below handlers are going to be called and where we are registering thse handlers.
vPortSVCHandler() and void xPortPendSVHandler( void )