[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

context switching during delays




> "Hennenfent, Nick {AVL~Roswell}" wrote:
> 
> Joel,
> 
> After the hello world task starts I call rtems_task_wake_after(1000) so I can
> debug it.
> BTW, I use rtems_task_wake_after() in the bsp_post_driver stuff and it works
> fine.

It shouldn't since interrupts are not on yet and you are not in a task yet.
It is still in the initialization code.  I assume that dispatching is disabled
and you are simply returning.

> It gets to _Thread_Dispatch and then _Thread_Set_State and then when it calls
> 
> _Thread_Calculate_heir, that's when _Thread_Heir gets corrupted (0xa5a5a5a5).

That makes some sense if the initialization code is getting confused by the
task wake after.

> Not sure yet if I am using the macros or the inline functions.

Doesn't matter behavior should be the same.
 
> I suspect the problem is in _Priority_Get_highest but I am still tracing
> through it.
> It returns a value that is used as an array index so...

I recall that _Thread_Idle is created and shoved into _Thread_Executing
during the init sequence.  This makes it valid for operations even though
you are not really in a thread.  The task wake after is likely blocking
the idle thread (BAD) and then returnign because tasking is not enabled
yet.  When it comes time to switch to pick an heir, there isn't one.

Just a guess since you shouldn't have called wake after before tasking was
enabled.

> Thanks,
> Nick
> 
> -----Original Message-----
> From: Joel Sherrill [mailto:joel.sherrill at OARcorp.com]
> Sent: Tuesday, July 24, 2001 7:16 PM
> To: Hennenfent, Nick {AVL~Roswell}
> Cc: rtems-users at OARcorp.com
> Subject: Re: context switching during delays
> 
> Hello world does not configure a clock tick device driver
> and thus has no way to measure the passage of time.
> Once you do the context switch, you will end up
> in the idle task with no way to get out of it.
> 
> --
> Joel Sherrill, Ph.D.             Director of Research & Development
> joel at OARcorp.com                 On-Line Applications Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
> Support Available                (256) 722-9985

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985