Hi all,
I am having difficulty in understanding "interrupts". I am writing code for a stm32f303 microcontroller using ARMCC in Keil uVision 4 IDE.
After doing a couple of days of reading online and the compiler manual I have created an interrupt function that looks like this:
//////////////////////////////////////////////////////////////////// __irq void TimerInterrupt(void) // located in the source file {
.....statements....
} ///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////// __irq void TimerInterrupt(void); // located in a header file ///////////////////////////////////////////////////////////////////
Now, what I am trying to do overall is to have a interrupt function that will be called when a timer reaches it's overflow and sets an interrupt bit.
Thankyou in advance if anyone has anything to contribute to this.
Sincerely, Jim
Do you mean interrupts in general (applicable to any architecture), interrupts in the Cortex-M4 hardware, or just how to handle interrupts in Keil's tools?
Note that the STM32F303 is a Cortex-M4:
www.st.com/.../252054.jsp
One of the key things about Cortex-Mx is that interrupt service routines (ISRs) aka "handlers" can be written entirely in standard 'C' - with no need for any special compiler options or extensions.
Keil provide plenty of examples, as do ST.
http://www.keil.com/download/list/arm.htm
I am referring to how to create an interrupt function. Something like:
void TimerInterrupt(void) __irq { .... }
This is what I am seeing in the armcc compiler information But when I am compling this I get an error.
routine.h(60): error: #147-D: declaration is incompatible with "void TimerInterrupt(void)" (declared at line 50)
Thank-you for the information. I will read it.
Hello english isn't my mother language and i'm right now very busy,because of that this explanation was translated by google translator, and i made minor correction to it but i think that you can take the general idea. For further info i suggest that study CMSIS interface and who things are done in the ARM Cortex-M.
Interrupt handling in these devices is carried out by CMSIS interface in the file <device>startup_.s are defined as all interrupt vectors supported by the device in question, then <device>_it.h and <device>_it.c respectively are declared and implemented the functions that will serve the interruptions, the identifiers of these functions must match those defined in startup_<device>.s file although any function whose declaration appears in the main and match the name defined in the bootfile can serve the interrupt in question, so that they are in <device>_it.c promotes code organization.
I want to thank everyone for there help in understanding the interrupt problem I had.
I found that the error message I was getting was from have two prototypes in an header file.
Thanks again,
Jim