This is sort of resurrecting the thread I started a while back. In that thread, I was having a problem with installing an interrupt routine. The way I solved it was to add -Xlinker --defsym=__ram_vector_table__=1 to the linker options, and then use InstallIRQHandler to explicitly install the IRQ handler.
Now, the other solution was to simply define the IRQ handler and it would override the weak one defined elsewhere.
However, I've dusted off that example, and it does not work! It's very nearly a copy of the PIT example included with the SDK.
volatile bool pitIsrFlag = false;
void PIT0_IRQHandler(void)
{
/* Clear interrupt flag.*/
PIT_ClearStatusFlags(PIT, kPIT_Chnl_0, kPIT_TimerFlag);
pitIsrFlag = true;
}
First, when running the code and the timer goes off, I get stuck in IntDefaultHandler. This shows that the IRQ handler was definitely not installed properly. I've checked the map file, and it shows two instances of PIT0_IRQHandler, one from my main file, and one from startup_mk64f12.o.
Solved! Go to Solution.
Solution found! According to Startup Code and Interrupt Handlers, the handler must be inside an extern "C" block if you're compiling under C++. Otherwise the name gets mangled and will not match the weak symbol.
Solution found! According to Startup Code and Interrupt Handlers, the handler must be inside an extern "C" block if you're compiling under C++. Otherwise the name gets mangled and will not match the weak symbol.