Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Multiple IRQ routines in GCC

Multiple IRQ routines in GCC

2006-05-01 by vineet jain

Hello,
  I need some help in writing IRQ routines in GCC, it works the way I wrote for KEIL GCC but doesn't with the Eclipse one.

Stubs are placed in the sample code for Eclipse IDE:
Excerpt from the code:

void IRQ_Routine (void)   __attribute__ ((interrupt("IRQ")));

and then way below:

void IRQ_Routine (void) {  
    while (1) ;    
}

I need to write two routines as IRQ for RTC and UART0
How do I write them.

These are the prototypes I am using for both and way below are the definitions:

void Uart0_IRQ (void) __attribute__ ((interrupt("IRQ")));
void RTC_IRQ   (void) __attribute__ ((interrupt("IRQ")));
.
.
.
.
void Uart0_IRQ (void) 
{  VICVectAddr = 0x00000000;
}

void RTC_IRQ (void)
{unsigned int value;
 if (ILR & 0x00000001)
   { value = (CTIME0 & SEC_Mask) >> SEC_Bits;
     TO_ASCII(value);    //      send the ascii value to serial port....UART0
     ILR = 0x00000001;
   }
 VICVectAddr = 0x00000000;
}

Please suggest.

Thanks in advance,
Vineet.



		
---------------------------------
Get amazing travel prices for air and hotel in one click on Yahoo! FareChase 

[Non-text portions of this message have been removed]

Re: Multiple IRQ routines in GCC

2006-05-01 by unity0724

Question:  Could it be the IDEs (Keil/Eclipse) are issuing
different compiler switches??  I can't think of anything else.

If you still cannot get the help from here, may be send a 
post to WinARM Forum:
http://en.mikrocontroller.net/forum/17

There is also some 2xUART ISR code examples in the WinARM package.
I do not know if that can be of anything useful to you.
http://www.siwawi.arubi.uni-
kl.de/avr_projects/arm_projects/index.html

Regards 

--- In lpc2000@yahoogroups.com, vineet jain <vineetrvce@...> wrote:
>
> Hello,
>   I need some help in writing IRQ routines in GCC, it works the 
way I wrote for KEIL GCC but doesn't with the Eclipse one.
> 
> Stubs are placed in the sample code for Eclipse IDE:
> Excerpt from the code:
> 
> void IRQ_Routine (void)   __attribute__ ((interrupt("IRQ")));
> 
> and then way below:
> 
> void IRQ_Routine (void) {  
>     while (1) ;    
> }
> 
> I need to write two routines as IRQ for RTC and UART0
> How do I write them.
> 
> These are the prototypes I am using for both and way below are the 
definitions:
> 
> void Uart0_IRQ (void) __attribute__ ((interrupt("IRQ")));
> void RTC_IRQ   (void) __attribute__ ((interrupt("IRQ")));
> .
> .
> .
> .
> void Uart0_IRQ (void) 
> {  VICVectAddr = 0x00000000;
> }
> 
> void RTC_IRQ (void)
> {unsigned int value;
>  if (ILR & 0x00000001)
>    { value = (CTIME0 & SEC_Mask) >> SEC_Bits;
>      TO_ASCII(value);    //      send the ascii value to serial 
port....UART0
>      ILR = 0x00000001;
>    }
>  VICVectAddr = 0x00000000;
> }
> 
> Please suggest.
> 
> Thanks in advance,
> Vineet.
> 
> 
> 
> 		
> ---------------------------------
> Get amazing travel prices for air and hotel in one click on Yahoo! 
FareChase 
Show quoted textHide quoted text
> 
> [Non-text portions of this message have been removed]
>

Re: [lpc2000] Re: Multiple IRQ routines in GCC

2006-05-01 by vineet jain

I meant the toolchains these two IDE's use. Ideally the way IRQ interrupts are called should be the same as both use GCC.

Also how do you plan to write IRQ routine for let's say:

an RTC and a UART.

beacuse in the sample code they talk about an IRQ stub ( mentioned in earlier mail ). 

If anyone's using GCC, please send an sample code for activating two IRQ interrupts.

Thanks and regards,
Vineet.
 
unity0724 <unity0724@...> wrote:    Question:  Could it be the IDEs (Keil/Eclipse) are issuing
 different compiler switches??  I can't think of anything else.
 
 If you still cannot get the help from here, may be send a 
 post to WinARM Forum:
 http://en.mikrocontroller.net/forum/17
 
 There is also some 2xUART ISR code examples in the WinARM package.
 I do not know if that can be of anything useful to you.
 http://www.siwawi.arubi.uni-
 kl.de/avr_projects/arm_projects/index.html
 
 Regards 
 
 --- In lpc2000@yahoogroups.com, vineet jain <vineetrvce@...> wrote:
 >
 > Hello,
 >   I need some help in writing IRQ routines in GCC, it works the 
 way I wrote for KEIL GCC but doesn't with the Eclipse one.
 > 
 > Stubs are placed in the sample code for Eclipse IDE:
 > Excerpt from the code:
 > 
 > void IRQ_Routine (void)   __attribute__ ((interrupt("IRQ")));
 > 
 > and then way below:
 > 
 > void IRQ_Routine (void) {  
 >     while (1) ;    
 > }
 > 
 > I need to write two routines as IRQ for RTC and UART0
 > How do I write them.
 > 
 > These are the prototypes I am using for both and way below are the 
 definitions:
 > 
 > void Uart0_IRQ (void) __attribute__ ((interrupt("IRQ")));
 > void RTC_IRQ   (void) __attribute__ ((interrupt("IRQ")));
 > .
 > .
 > .
 > .
 > void Uart0_IRQ (void) 
 > {  VICVectAddr = 0x00000000;
 > }
 > 
 > void RTC_IRQ (void)
 > {unsigned int value;
 >  if (ILR & 0x00000001)
 >    { value = (CTIME0 & SEC_Mask) >> SEC_Bits;
 >      TO_ASCII(value);    //      send the ascii value to serial 
 port....UART0
 >      ILR = 0x00000001;
 >    }
 >  VICVectAddr = 0x00000000;
 > }
 > 
 > Please suggest.
 > 
 > Thanks in advance,
 > Vineet.
 > 
 > 
 > 
 >             
 > ---------------------------------
 > Get amazing travel prices for air and hotel in one click on Yahoo! 
 FareChase 
 > 
 > [Non-text portions of this message have been removed]
 >
 
 
 
 
            

        SPONSORED LINKS   
                                                    Microcontrollers                                       Microprocessor                                       Intel microprocessors                                                                 
      
---------------------------------
   YAHOO! GROUPS LINKS 
 
    
    Visit your group "lpc2000" on the web.
    
    To unsubscribe from this group, send an email to:
 lpc2000-unsubscribe@yahoogroups.com
    
    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
 
    
---------------------------------
 
 
     

		
---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

[Non-text portions of this message have been removed]

Re: Multiple IRQ routines in GCC

2006-05-01 by rtstofer

--- In lpc2000@yahoogroups.com, "unity0724" <unity0724@...> wrote:
>
> Question:  Could it be the IDEs (Keil/Eclipse) are issuing
> different compiler switches??  I can't think of anything else.
> 
> If you still cannot get the help from here, may be send a 
> post to WinARM Forum:
> http://en.mikrocontroller.net/forum/17
> 
> There is also some 2xUART ISR code examples in the WinARM package.
> I do not know if that can be of anything useful to you.
> http://www.siwawi.arubi.uni-
> kl.de/avr_projects/arm_projects/index.html
> 
> Regards 
> 
> --- In lpc2000@yahoogroups.com, vineet jain <vineetrvce@> wrote:
> >
> > Hello,
> >   I need some help in writing IRQ routines in GCC, it works the 
> way I wrote for KEIL GCC but doesn't with the Eclipse one.
> > 
> > Stubs are placed in the sample code for Eclipse IDE:
> > Excerpt from the code:
> > 
> > void IRQ_Routine (void)   __attribute__ ((interrupt("IRQ")));
> > 
> > and then way below:
> > 
> > void IRQ_Routine (void) {  
> >     while (1) ;    
> > }
> > 
> > I need to write two routines as IRQ for RTC and UART0
> > How do I write them.
> > 
> > These are the prototypes I am using for both and way below are the 
> definitions:
> > 
> > void Uart0_IRQ (void) __attribute__ ((interrupt("IRQ")));
> > void RTC_IRQ   (void) __attribute__ ((interrupt("IRQ")));
> > .
> > .
> > .
> > .
> > void Uart0_IRQ (void) 
> > {  VICVectAddr = 0x00000000;
> > }
> > 
> > void RTC_IRQ (void)
> > {unsigned int value;
> >  if (ILR & 0x00000001)
> >    { value = (CTIME0 & SEC_Mask) >> SEC_Bits;
> >      TO_ASCII(value);    //      send the ascii value to serial 
> port....UART0
> >      ILR = 0x00000001;
> >    }
> >  VICVectAddr = 0x00000000;
> > }
> > 
> > Please suggest.
> > 
> > Thanks in advance,
> > Vineet.
> > 
> > 
> > 
> > 		
> > ---------------------------------
> > Get amazing travel prices for air and hotel in one click on Yahoo! 
> FareChase 
> > 
> > [Non-text portions of this message have been removed]
> >
>

It looks like you are trying to use the VIC to dispatch the interrupt
to the appropriate handler.  After all, there is only one 'IRQ' entry
point and it can't point to two different routines.

I don't see where the VIC is being set up with the interrupt
addresses.  Further, if you do use the VIC to dispatch, the default
IRQ routine will not be used.

The interrupt handlers entered via VIC should be declared as:

void IntHandler1 (void) __attribute__ ((interrupt));
void IntHandler2 (void) __attribute__ ((interrupt));

Richard

Re: Multiple IRQ routines in GCC

2006-05-01 by rtstofer

--- In lpc2000@yahoogroups.com, vineet jain <vineetrvce@...> wrote:
>
> I meant the toolchains these two IDE's use. Ideally the way IRQ
interrupts are called should be the same as both use GCC.
> 
> Also how do you plan to write IRQ routine for let's say:
> 
> an RTC and a UART.
> 
> beacuse in the sample code they talk about an IRQ stub ( mentioned
in earlier mail ). 
> 
> If anyone's using GCC, please send an sample code for activating two
IRQ interrupts.
> 
> Thanks and regards,
> Vineet.

In my initialization code (substantially snipped):

	// set up I2C
	
	VICVectCntl1 = 0x00000029;	// select a priority spot for a given
interrupt
	VICVectAddr1 = (unsigned long) I2CISR;	// pass the address of the ISR
	VICIntEnable = 0x00000200;	// enable interrupt

	// set up Timer 0

	VICVectCntl3 = 0x00000024;	// set priority 3 for Timer 0
	VICVectAddr3 = (unsigned long) T0ISR;	// pass the address of the ISR
	VICIntEnable = 0x00000010;	// enable interrupt

.....

In my 'interrupt.h' where I deal with the timer interrupt prototype

void T0ISR         (void) __attribute__ ((interrupt       ));
void IRQ_Routine   (void) __attribute__ ((interrupt("IRQ")));
void FIQ_Routine   (void) __attribute__ ((interrupt("FIQ")));
void SWI_Routine   (void) __attribute__ ((interrupt("SWI")));
void UNDEF_Routine (void) __attribute__ ((interrupt("UNDEF")));


In my 'interrupt.c' where the timer interrupt does nothing:

void T0ISR(void)
{
	TIMER0_IR = 0x01;
	VICVectAddr = 0xFF;
}
	
void IRQ_Routine (void) {
	while (1) ;	
}

void FIQ_Routine (void)  {
	while (1) ;	
}

void SWI_Routine (void)  {
	while (1) ;	
}


void UNDEF_Routine (void) {
	while (1) ;	
}

In my i2c.h file where I provide the prototype for I2CISR:

  void I2CISR (void) __attribute__ ((interrupt));


And, finally, there is code in i2c.c that implements the I2C state
machine in the I2CISR interrupt handler.  Not posted here

Richard

Re: [lpc2000] Re: Multiple IRQ routines in GCC (simply)

2006-05-01 by vineet jain

OR to put it simply,
how would one write an interrupt based application to show time on 
Hyperterm using LPC controller.

Both the UART and RTC are interrupt driven.
>> So how to declare the ISR's if they both are meant to be IRQ category interrupts.

Thanks,
Please let me know if the query in not well explained!!!
Vineet.

rtstofer <rstofer@...> wrote:    --- In lpc2000@yahoogroups.com, vineet jain <vineetrvce@...> wrote:
 >
 > I meant the toolchains these two IDE's use. Ideally the way IRQ
 interrupts are called should be the same as both use GCC.
 > 
 > Also how do you plan to write IRQ routine for let's say:
 > 
 > an RTC and a UART.
 > 
 > beacuse in the sample code they talk about an IRQ stub ( mentioned
 in earlier mail ). 
 > 
 > If anyone's using GCC, please send an sample code for activating two
 IRQ interrupts.
 > 
 > Thanks and regards,
 > Vineet.
 
 In my initialization code (substantially snipped):
 
       // set up I2C
       
       VICVectCntl1 = 0x00000029;      // select a priority spot for a given
 interrupt
       VICVectAddr1 = (unsigned long) I2CISR;      // pass the address of the ISR
       VICIntEnable = 0x00000200;      // enable interrupt
 
       // set up Timer 0
 
       VICVectCntl3 = 0x00000024;      // set priority 3 for Timer 0
       VICVectAddr3 = (unsigned long) T0ISR;      // pass the address of the ISR
       VICIntEnable = 0x00000010;      // enable interrupt
 
 .....
 
 In my 'interrupt.h' where I deal with the timer interrupt prototype
 
 void T0ISR         (void) __attribute__ ((interrupt       ));
 void IRQ_Routine   (void) __attribute__ ((interrupt("IRQ")));
 void FIQ_Routine   (void) __attribute__ ((interrupt("FIQ")));
 void SWI_Routine   (void) __attribute__ ((interrupt("SWI")));
 void UNDEF_Routine (void) __attribute__ ((interrupt("UNDEF")));
 
 
 In my 'interrupt.c' where the timer interrupt does nothing:
 
 void T0ISR(void)
 {
       TIMER0_IR = 0x01;
       VICVectAddr = 0xFF;
 }
       
 void IRQ_Routine (void) {
       while (1) ;      
 }
 
 void FIQ_Routine (void)  {
       while (1) ;      
 }
 
 void SWI_Routine (void)  {
       while (1) ;      
 }
 
 
 void UNDEF_Routine (void) {
       while (1) ;      
 }
 
 In my i2c.h file where I provide the prototype for I2CISR:
 
   void I2CISR (void) __attribute__ ((interrupt));
 
 
 And, finally, there is code in i2c.c that implements the I2C state
 machine in the I2CISR interrupt handler.  Not posted here
 
 Richard
 
 
 
 
 
            

        SPONSORED LINKS   
                                                    Microcontrollers                                       Microprocessor                                       Intel microprocessors                                                                 
      
---------------------------------
   YAHOO! GROUPS LINKS 
 
    
    Visit your group "lpc2000" on the web.
    
    To unsubscribe from this group, send an email to:
 lpc2000-unsubscribe@yahoogroups.com
    
    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
 
    
---------------------------------
 
 
     

		
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2ยข/min with Yahoo! Messenger with Voice.

[Non-text portions of this message have been removed]

Re: Multiple IRQ routines in GCC (simply)

2006-05-01 by rtstofer

--- In lpc2000@yahoogroups.com, vineet jain <vineetrvce@...> wrote:
>
> OR to put it simply,
> how would one write an interrupt based application to show time on 
> Hyperterm using LPC controller.
> 
> Both the UART and RTC are interrupt driven.
> >> So how to declare the ISR's if they both are meant to be IRQ
category interrupts.

As I indicated earlier, you can't define them both to be IRQ and then
have individual routines - there's only one IRQ vector.  I suppose you
could write code in the IRQ handler to handle both interrupts but why
bother?  The VIC was invented to solve this type of problem.

Maybe you could define one as FIQ and the other as IRQ but that is a
very limiting concept.

I don't have an example that meets your requirements.  But, how hard
can it be?  You need to define an interrupt handler for the timer and
put the address and priority into the VIC.  You need to define an
interrupt handler for the UART (enabling FIFO) and put the address and
priority in the VIC.

Of course you also have to prevent timer interrupts from changing the
time while you are in the process of accessing the data.

I haven't tried the UART via VIC and there are apparently some issues
re: the UART and interrupts.  I read about them here but have not
investiaged them for myself.

Richard

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.