gcc - Thumb Assembler Interrupt in custom SRAM section -


i'd have interrupt routine in sram on lpc1768. i'm using gcc toolchain similar yagarto. can following c:

nvic_setvector(timer0_irqn, interrupttest); 

...then in assembly file:

    .text /* .section    .fastcode */     .global     interrupttest     .func       interrupttest     .thumb_func interrupttest:     ldr         r0,=(lpc_tim0 + ir)    /* point timer 0's interrupt register */     mov         r1,#(1 << 0)           /* interrupt pending bit mr0 int */     str         r1,[r0]                /* clear */      bx          lr      .size       interrupttest, . - interrupttest     .endfunc 

now works fine, pointer 'interrupttest' function odd. however, when enable '.section .fastcode' bit, pointer interrupt becomes even instead of odd.

my question is: how correctly make interrupt routine recognized thumb function ?

got it!

inserting '.type interrupttest,%function' makes work.

so final source should be:

    .section    .fastcode,"ax",%progbits     .global     interrupttest     .func       interrupttest     .type       interrupttest,%function     .thumb_func interrupttest:     ldr         r0,=(lpc_tim0 + ir)    /* point timer 0's interrupt register */     mov         r1,#(1 << 0)           /* interrupt pending bit mr0 int */     str         r1,[r0]                /* clear */      bx          lr      .size       interrupttest, . - interrupttest     .endfunc 

important: "ax",%progbits added .section directive, because otherwise section ignored.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -