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

von Ravindra (Guest)

Rate this post
0 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
# Exception Vectors
#  Mapped to Address 0.
#  Absolute addressing mode must be used.
#  Dummy Handlers are implemented as infinite loops which can be

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
0 useful
not useful

  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:
     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
        Then jump to function which is responsible for processing.
        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


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.