EmbDev.net

Forum: ARM programming with GCC/GNU tools Settings in startup.s file for multiple interrupts GCC


von Ravindra (Guest)


Rate this post
useful
not useful
sir ,
I m using MCB2130 board .I hav tested all features of it in Keil ARM
Tools .Now I m interested using GCC compiler .
Question 1)
when I changed in startup.s file like below for my ADC ISR to run it is
working:
************************************************************************ 
*******
# Exception Vectors
#  Mapped to Address 0.
#  Absolute addressing mode must be used.
#  Dummy Handlers are implemented as infinite loops which can be
modified.

Vectors:        LDR     PC, Reset_Addr
                LDR     PC, Undef_Addr
                LDR     PC, SWI_Addr
                LDR     PC, PAbt_Addr
                LDR     PC, DAbt_Addr
                NOP                            /* Reserved Vector */

    LDR     PC, IRQ_Addr1
                LDR     PC, FIQ_Addr

Reset_Addr:     .word   Reset_Handler
Undef_Addr:     .word   Undef_Handler
SWI_Addr:       .word   SWI_Handler
PAbt_Addr:      .word   PAbt_Handler
DAbt_Addr:      .word   DAbt_Handler
                .word   0                      /* Reserved Address */

IRQ_Addr1:      .word   IRQ_Handler1
FIQ_Addr:    .word   FIQ_Handler

Undef_Handler:  B       Undef_Handler
SWI_Handler:    B       SWI_Handler
PAbt_Handler:   B       PAbt_Handler
DAbt_Handler:   B       DAbt_Handler

IRQ_Handler1:    B      ADC0                  /*this is changed with
interrupt routine ADC0*/
FIQ_Handler:    B   FIQ_Handler
************************************************************************ 
*******
I hav changed in IRQ_Handler1 with routine name(ADC0) but it is working
for the declaration like:
void ADC0(void) _attribute_ ((interrupt ("FIQ")));
How is it possible?
Question 2)
Now plz tell me what changes are reqd. for more than one interrupts to
occur simultaneously?

von Andy K. (ddancer)


Rate this post
useful
not useful
Hi,

  I haven't used the uC you do, but I think, that it has some interrupt
controller to allow many interrupt sources (several tens). You should
have only one "real" interrupt handler written with _attribute_
((interrupt ("FIQ"))); (or IRQ) or even an asm in your startup code.
Inside this function uou must check which device in uC caused the
interrupt, and jump to function you supply:

// In your application
void ADC0(void)
{
   //Your adc processing
}


// In startup code:
IRQ_Handler:
     stmfd     sp!, {r0-r4, r12, lr}    /* save registers on IRQ stack
*/

     /* Here you have to check the source of an interrupt. I will be a
number.
        Then jump to function which is responsible for processing.
Address
        can be got from some isr jumb table. */

     ldmfd     sp!, {r0-r4, r12, lr}    /* restore registers from stack
*/
     subs      pc,  lr, #4              /* return from exception
*/

Regards. Andy

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.