fiq interrupt code not compiling
Discussion in "ARM Development" started by vishu489 Jun 15, 2012.
Fri Jun 15 2012, 05:18 pm
hi ajay
below i'm providing my code for external interrupt EINT1 served as fiq . but every time i add keyword _irq compiler gives me error(i'm using keil uvision4(MDK-ARM development tool)
code
output
Rebuild target 'Target 1'
assembling Startup.s...
compiling interrupt.c...
interrupt.c(38): error: #147-D: declaration is incompatible with "void FIQ_Handler(void)__irq" (declared at line 5)
interrupt.c(38): error: #130: expected a "{"
Target not created
i'm also providing changes which i made to start file
sorry for long code , but please help me
below i'm providing my code for external interrupt EINT1 served as fiq . but every time i add keyword _irq compiler gives me error(i'm using keil uvision4(MDK-ARM development tool)
code
include<LPC21XX.h> // void delay_ms(unsigned int time); void init_interrupt(void); void FIQ_Handler(void)__irq; void delay_ms(unsigned int time) { int i,j; for(i=0;i<time;i++) { for(j=0;j<500;j++) { } } } void init_interrupt(void) { PINSEL0=0X20000000; // ENABLING EINT1 FEATURE OF P0.14 VICIntSelect=0X00008000; // SELECTING EINT1 INTERRUPT AS FIQ INTERRUPT VICIntEnable=0X00008000; // ENABLE EINT1 INTERRUPT } int main(void) { IODIR1=0X00FF0000; // USE PIN AS O/P PIN IOCLR1=0X00FF0000; //INITIALLY SET PIN LOW init_interrupt(); while(1); // wait for interrupt } void FIQ_Handler(void)_irq { IOSET1=0X00FF0000; // set led pins EXTINT=0X00000002; // CLEAR EINT1 FLAG }
output
Rebuild target 'Target 1'
assembling Startup.s...
compiling interrupt.c...
interrupt.c(38): error: #147-D: declaration is incompatible with "void FIQ_Handler(void)__irq" (declared at line 5)
interrupt.c(38): error: #130: expected a "{"
Target not created
i'm also providing changes which i made to start file
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_Addr LDR PC, [PC, #-0x0FF0] ; Vector from VicVectAddr LDR PC, FIQ_Addr IMPORT FIQ_Handler Reset_Addr DCD Reset_Handler Undef_Addr DCD Undef_Handler SWI_Addr DCD SWI_Handler PAbt_Addr DCD PAbt_Handler DAbt_Addr DCD DAbt_Handler DCD 0 ; Reserved Address IRQ_Addr DCD IRQ_Handler FIQ_Addr DCD FIQ_Handler Undef_Handler B Undef_Handler SWI_Handler B SWI_Handler PAbt_Handler B PAbt_Handler DAbt_Handler B DAbt_Handler IRQ_Handler B IRQ_Handler ;FIQ_Handler B FIQ_Handler
sorry for long code , but please help me
[ Edited Sat Jun 16 2012, 12:09 am ]
Sat Jun 16 2012, 12:11 am
ok first think to understand is.. FIQ is not IRQ so you cannot use __irq for FIQ handler. and FIQ is just like normal ISR like you've used in small controllers, where as IRQ goes through VIC before it actually starts executing the ISR. thats one of the basic difference in FIQ and IRQ.
So all you have to do is branch to FIQ_Handler C function from FIQ vector in assembly code. thats its...
So all you have to do is branch to FIQ_Handler C function from FIQ vector in assembly code. thats its...
Sat Jun 16 2012, 10:29 am
ajay thanks for your reply but i didn't get it ,will u plz explain it with help of example and if your having any sample code then it will be more helpfull for me
Mon Jun 18 2012, 02:23 am
I am really sorry I do not have any sample code. But its pretty straight as I said. Try to remove __irq from FIQ handler function and try compiling again and see if it works.
Powered by e107 Forum System