joel.sherrill at OARcorp.com
Mon Aug 28 17:47:13 UTC 2000
Ahmet Akkas wrote:
> Could you please tell me why Context Switch routine is called at
> the beginning of the multitasking? The following is the sequence
> of the calls until _Context_Switch() is called. Thanks in advance.
> in ...(board)/startup/main.c
> rtems_initialize_executive_late( bsp_isr_level );
> in .../exec/sapi/src/exinit.c
> in .../exec/score/src/threadstartmultitasking.c
> _Context_Switch( &_Thread_BSP_context, &_Thread_Heir->Registers );
What you are seeing is that the state of the CPU at initialization
is saved into "_Thread_BSP_context" so RTEMS can return to the
BSP's exit code when rtems_shutdown_executive is invoked (see exit()).
Guessing ahead .. you have executed this far and are getting a
falt of some sort inside the 1st context switch. Here are common
+ Since this is the first time you are switching TO a task, it
is the 1st time a context YOU initialized is being loaded.
So you may have initialized the context incorrectly. You
may also have simply restored it incorrectly.
+ You may have enabled interrupts in the restore portion of the
switch. Prior to this call interrupts are off. This is where
interrupts get enabled for the first time. If the board is
generating an unexpected interrupt, then it happens when you
enable interrupts (restore processor status/controls register).
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
More information about the users