Contents|Index|Previous|Next

Compiling Functions for Interrupt Calls

When compiling code for certain platforms (currently the Hitachi H8/300 and the Tandem ST-2000), you can instruct {No value for "GCC"} that certain functions are meant to be called from hardware interrupts.

To mark a function as callable from interrupt, include the line, #pragma interrupt, somewhere before the beginning of the function’s definition. (For maximum readability, you might place it immediately before the definition of the appropriate function.) #pragma interrupt will affect only the next function defined; if you want to define more than one function with this property, include #pragma interrupt before each of them.

When you define a function with #pragma interrupt, {No value for "GCC"} alters its usual calling convention, to provide the right environment when the function is called from an interrupt. Such functions cannot be called in the usual way from your program.

You must use other facilities to actually associate these functions with particular interrupts; {No value for "GCC"} can only compile them in the appropriate way.