[ECOS] Interrupt state at program startup

Patrick Doyle wpd@delcomsys.com
Fri Mar 14 23:19:00 GMT 2003


OK, I see that now.... as I said, interrupt support is not fully debugged
yet.  I think what I just uncovered is a "why wasn't _that_ interrupt masked
at startup the way it should have been" bug.  But now I see that this is
expected, and explicitly coded for, behavior.

Thanks.

--wpd


> -----Original Message-----
> From: Mark Salter [mailto:msalter@redhat.com]
> Sent: Friday, March 14, 2003 3:34 PM
> To: wpd@delcomsys.com
> Cc: ecos-discuss@sources.redhat.com
> Subject: Re: [ECOS] Interrupt state at program startup
>
>
> >>>>> Patrick Doyle writes:
>
> > I am tracking down a problem right now that appears to be related to the
> > recent changes to RedBoot to allow programs to return to the
> RedBoot prompt.
>
> > Specifically, the problem that I see right now is that, with
> the changes to
> > 'do_go' where a new thread context is initialized and then
> switched to in
> > order to start the new application, interrupts are enabled in the new
> > thread.  (This is on my innovator - ARM9 port).  Once interrupts are
> > enabled, and since I don't have interrupt support fully
> debugged, I spend
> > the rest of my time attempting to service interrupts I am not ready to
> > service yet.
>
> > I am going to investigate this further, but I thought I would
> toss out a few
> > questions: What should the interrupt state be when an application is
> > launched from RedBoot?  If, as I would expect, the interrupt
> state should be
> > that interrupts are disabled, do folks have suggestions as to
> how I might go
> > about fixing the new, improved, lemony scented, 'do_go' command
> to ensure
> > that this is the case?
>
> > I can explain this slightly more coherently, if anybody would like :-)
> > --wpd
>
> The problem is that I use HAL_THREAD_INIT_CONTEXT() to set up a
> short-lived
> context to go_trampoline. go_trampoline turns off interrupts so the actual
> target is jumped to with interrupts off as was the previous
> behavior. There
> is a small window where interrupts are on, however.
>
> You should have no problem if all interrupt sources are turned off at the
> device level. Normally, for any RedBoot port, the only interrupt source
> that should be enabled at the device level is the comm channel. You may
> get a spurious IRQ for the comm channel during the go command, but the
> interrupt support in place shouldn't have a problem with it. If you have
> a partial port where interrupts don't work, just make sure none are
> enabled at the device level. If you want to be a little more heavy handed,
> you can prevent HAL_THREAD_INIT_CONTEXT() from enabling interrupts by
> applying the following patch. Note that you'd only want this patch for
> RedBoot and not eCos, generally.
>
> --Mark
>
>
> Index: hal_arch.h
> ===================================================================
> RCS file: /home/cvs/ecc/ecc/hal/arm/arch/current/include/hal_arch.h,v
> retrieving revision 1.50
> diff -u -p -5 -c -r1.50 hal_arch.h
> cvs server: conflicting specifications of output style
> *** hal_arch.h	2002/09/12 12:19:41	1.50
> --- hal_arch.h	2003/03/14 20:32:37
> *************** externC int hal_msbindex(int);
> *** 155,165 ****
>           (_regs_)->d[_i_] = (_id_)|_i_;
>             \
>       (_regs_)->d[00] = (CYG_WORD)(_thread_); /* R0 = arg1 =
> thread ptr */    \
>       (_regs_)->sp = (CYG_WORD)(_sp_);        /* SP = top of
> stack      */    \
>       (_regs_)->lr = (CYG_WORD)(_entry_);     /* LR = entry point
>       */    \
>       (_regs_)->pc = (CYG_WORD)(_entry_);     /* PC = [initial]
> entry point */\
> !     (_regs_)->cpsr = (CPSR_THREAD_INITIAL); /* PSR = Interrupt
> enabled */   \
>       _sparg_ = (CYG_ADDRESS)_regs_;
>             \
>       CYG_MACRO_END
>
>
> //----------------------------------------------------------------
> ----------
>   // Context switch macros.
> --- 155,165 ----
>           (_regs_)->d[_i_] = (_id_)|_i_;
>             \
>       (_regs_)->d[00] = (CYG_WORD)(_thread_); /* R0 = arg1 =
> thread ptr */    \
>       (_regs_)->sp = (CYG_WORD)(_sp_);        /* SP = top of
> stack      */    \
>       (_regs_)->lr = (CYG_WORD)(_entry_);     /* LR = entry point
>       */    \
>       (_regs_)->pc = (CYG_WORD)(_entry_);     /* PC = [initial]
> entry point */\
> !     (_regs_)->cpsr = (CPSR_INITIAL);        /* PSR = Interrupt
> enabled */   \
>       _sparg_ = (CYG_ADDRESS)_regs_;
>             \
>       CYG_MACRO_END
>
>
> //----------------------------------------------------------------
> ----------
>   // Context switch macros.
>
>
>


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list