Settings in startup.s file for multiple interrupts GCC

Guest #1171509
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?
#1171510
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

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.