How to define IRQ handler in CPP files {#GUID-42A6657F-7EE5-4E03-A271-6C730BEDB906}
With MCUXpresso SDK, users could define their own IRQ handler in application level to override the default IRQ handler. For example, to override the default PIT_IRQHandler
define in startup_DEVICE.s
, application code like app.c can be implement like:
c
void PIT_IRQHandler(void)
{
// Your code
}
When application file is CPP file, like app.cpp, then extern "C"
should be used to ensure the function prototype alignment.
cpp
extern "C" {
void PIT_IRQHandler(void);
}
void PIT_IRQHandler(void)
{
// Your code
}