nagarajukarre wrote on Wednesday, October 09, 2013:
Hi,
I have configured my interrupt handler like below.
irq:
get_irq_stack
bl portSAVE_CONTEXT
bl do_irq
bl portRESTORE_CONTEXT
my do_irq function is like below.
void do_irq (void)
{
if ((__read_irq_status) & (1<<IRQ_TIMER))
{
__clear_irq(IRQ_TIMER);
if(rd_b(TIMERS_INTERRUPT_STATUS_REG)&2)
{
OSTimeTick();
}
}
void OSTimeTick( void ) attribute((naked));
void OSTimeTick( void )
{
/* Increment the tick counter. */
if( xTaskIncrementTick() != pdFALSE );
{
/* The new tick value might unblock a task. Ensure the highest task that is ready to execute is the task that will execute when the tick ISR
exits. */
vTaskSwitchContext();
}
}
I have configured the timer interrupt to generate at every 5ms and i called this in my vTaskStartScheduler() function just before calling the
if( xPortStartScheduler() != pdFALSE ) with the function name
prvSetupTimerInterrupt();
Initially my processor is in SVC mode and interrupts are enabled and IRQ interrupt is firing and entering into the IRQ mode and IRQ interrupts are disabled.We dont get any further interrupts that means no further do_irq gets called.
Then entering into portSAVE_CONTEXT and hanging at the below stmfd instruction.
@ Push all the system mode registers onto the task stack.
stmfd LR, {R0-LR}^
NOP
SUB LR, LR, #60
In my main routine i have created the two tasks of both having the same priority and both the tasks are created successfully and i have started the scheduler.
my code looks like below
portBASE_TYPE xPortStartScheduler( void )
{
/* Start the first task. */
serial_putc('K');
vPortStartFirstTask();
serial_putc('N');
/* Should not get here! */
return 0;
}
my vPortStartFirstTask(); calls the bl portRESTORE_CONTEXT.
First time my task2 gets scheduling and only that task running contineously but the task1 never get a chance to schedule and it is not running.
But some times at the end of instruction portRESTORE_CONTEXT bl which is jumping to the OSTimeTick function but my tasks are not gets scheduled and which is hanging at the portSAVE_CONTEXT as i mentioned above.
Please could you provide me the tips to overcome my hang issue and to scheduler to schedule my two tasks symultaneously.
Thanks