This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Initialization routines take too long?


On Fri, Nov 10, 2000 at 01:19:25PM -0700, Gary Thomas wrote:

> >> I think it's more likely a problem with what happens when the
> >> ARM IRQ is finally enabled.  It appears that the system crashes
> >> if there is a pending interrupt when that happens.
> > 
> > Strange, that would mean you can't disable and reenable the IRQ without
> > problem...
> 
> As far as I know, this is not a problem with any of our internal ports.

I thought probably not.  ;)

> This is not to say that a problem does not exist, but we've never seen such.
> 
> However, note that the normal case is for interrupts to remain disabled,
> sometimes for long periods, until the scheduler is started from the main
> thread.  Is this how your application works [Grant]?

That depends on the meaning of "interrupts remain disabled".

The IRQ mask bit in the ARM CPU register CPSR remains set (IRQ
disabled) until Cyg_Scheduler::start() is called.  

However, individual interrupts are unmasked (enabled in the
interrupt controller) during initialization.  This means that
there may be an IRQ pending when Cyg_Scheduler::start() is
called.

If that is the case, the first IRQ is serviced before 
HAL_THREAD_LOAD_CONTEXT( &next->stack_ptr ) is called at the
bottom of Cyg_Scheduler::start().

I don't know enough about eCos internals to determine if that's
a problem or not.  

The only thing I can think of is that current_thread is set to
a value inconsistent with the actual CPU context at that point,
and that's causing a problem somewhere in the timer interrupt
code.

All of my tasks do seem to get started, but things crash in
random ways.  If I speed up my init routines (doesn't matter
which one) or delay that first timer interrupt, things are
fine.

-- 
Grant Edwards
grante@visi.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]