Problems with starting new BSP

Fernando RUIZ CASAS (E-mail) fernando.ruiz at ctv.es
Tue Jul 10 18:00:10 UTC 2001


Hi.

> -----Mensaje original-----
> De: corsepiu [mailto:corsepiu]En nombre de Ralf Corsepius
> Enviado el: martes, 10 de julio de 2001 15:53
> Para: Radzislaw Galler
> CC: Joel Sherrill; Radzislaw Galler; rtems-users at oarcorp.com;
> jmills at tga.com
> Asunto: Re: Problems with starting new BSP
> 
> 
> Radzislaw Galler wrote:
> > 
> > On Tuesday 03 July 2001 12:11, Joel Sherrill wrote:
> > > When you say "reenabling interrupts", do you mean all 
> potential interrupt
> > > sources?  My gut instinct says that you have an 
> uninitialized interrupt
> > > source that is happening.  Do you have a spurious 
> interrupt handler in
> > > your BSP to report an unexpected interrupt?
> > >
> > > I don't know if there is a generic sh spurious interrupt 
> handler like
> > > there is for some other CPUs.  I think the m68k has a 
> nice example of
> > > one.
> The gensh*-interrupt handling works a little different from what is
> used for other CPUs.
> 
> We assume a preset vector-table in ROM to copied into RAM at startup
> and another vector table (RTEMS's vector table) to be merged into
> this.
> 
> 
> > After I twiddled a bit with interrupts trying to catch the 
> spurious ones the
> > system started to work, but I don't know what helped, 
> because when I tried to
> > get back to the previous state (using old files) the system 
> also worked.
> > 
> > It could be that I lost couple of days seeking a 
> nonexistent bug which only
> > needed to touch sources and recompile the libraries  :)
> > 
> > Anyway right now I'm quite suspicious about #pragma 
> interrupt directive
> > (although it works now).
> What do you mean? Does #pragma interrupt work or does your
> application works?
> 
> For a very long time #pragma interrupt was broken for the sh (cf.
> isp7032.h), and AFAIK still is (If having more than 1 #pragma
> interrupt inside a source-file only the first ISR was treated as an
> ISR, all subsequent ones were treated as functions=.

Now. 
I can implement several interrupts with 
#pragma interrupt
in the same source file (My sci.c) compiling with the sh-rtems-gcc BUT
without RTEMS.

---------EXAMPLE------------

#include "ioh.h"
#include "var.h"
#include "sci.h"
#include "frw.h"
#include "tim.h"
/*------------------------------------------*/
#pragma interrupt
void rut_SCI0_ERI0(void) {
 char SSR;
 SSR=SSR0;
 while (SSR & (SCI_ORER|SCI_FER|SCI_PER)) {
  if (SSR & SCI_ORER) SSR0&=~(SCI_ORER);
  if (SSR & SCI_FER ) SSR0&=~(SCI_FER );
  if (SSR & SCI_PER ) SSR0&=~(SCI_PER );
  SSR=SSR0;
 };
}
/*------------------------------------------*/
#pragma interrupt
void rut_SCI0_RXD0(void) {
 if (SSR0&SCI_RDRF) {
  sci0.r.buf[sci0.r.in]=RDR0;
  sci0.r.in++;
  sci0.r.cnt++;
  sci0.r.in&=(sizeof(sci0.r.buf)-1);
  SSR0&=(~SCI_RDRF);
 };
}
/*------------------------------------------*/
#pragma interrupt
void rut_SCI0_TXD0(void) {
 SCR0=SCR0&~SCI_TIE;	       
 if (sci0.t.cnt) {
  TDR0=sci0.t.buf[sci0.t.out];	    
  sci0.t.out++;
  sci0.t.cnt--;
  sci0.t.out&=(sizeof(sci0.t.buf)-1);
  SSR0=SSR0&~SCI_TDRE;		/* limpia TDRE para nueva intr */
 };
 if (sci0.t.cnt) SCR0|=SCI_TIE; /* avisa_TDR_vacio(1); */
}
/*------------------------------------------*/
#pragma interrupt
void rut_SCI0_TEI0(void) {
 SCR0&=~SCI_TEIE;    /* avisa_TSR_vacio(0);*/
}
/*------------------------------------------*/
...
------------- END OF EXAMPLE ---------------

And WORKS VERY WELL.

> 
> However, IIRC, since gcc-2.95.2 __attribute__(( interrupt ))
> (syntax?) is reported to work.
> 
> Ralf
> 



More information about the users mailing list