This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Interrupts for Arm-elf-gcc


Hi Shaun,

Thanks for the reply. Just one or two questions with your code.

For ARM, the first few lines of code are your Interrupt vectors which look something
like this

b 	start    	SVC	0x00
b	UDINSTHandler	UND	0x04
b	SWIHandler	SVC	0x08
b 	PABORTHandler	ABORT	0x0C
b	DABORTHandler	ABORT	0x10
b	RESERVED\n"                 
b	IRQHandler	IRQ	0x18
b	FIQHandler	FIQ	0x1C

When an interrupt occurs, e.g. an IRQ, the core jumps to 0x18, switches to ARM
if in thumb mode, and enters IRQ mode, which gives us access to the IRQ bank
of registers. As the location is only one word in size we require a branch to
another location, our IRQHandler. This code then executes our interrupt. 
   The problem I have is that I don't want to always have to go in and manually
write IRQHandler to jump to the function in C. What I would like to do, as it
seems interrupts haven't being implemented in C is to something along these
lines:

IRQHandler:
       #ifdef IRQ_Interrupt
	       bl IRQ_Interrupt
       #endif

What I hope this will do is the if a function written in C is present, that
it will include this code ( bl IRQ_Interrupt ) in my IRQHandler. But when I
do not write the function IRQ_Interrupt, it will not.
    The above code works for when the function is written in C but when I remove
it I get the following error:

interrupts.o: In function `IRQHandler':
interrupts.o(.text+0x38): undefined reference to `IRQ_Interrupt'
collect2: ld returned 1 exit status

Any help is appreciated,

Thanks,
Dave


--
http://www.iol.ie

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]