Installing interrupts with KSDK 2.0?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Installing interrupts with KSDK 2.0?

ソリューションへジャンプ
1,475件の閲覧回数
robertgbaruch
Contributor II

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.

タグ(2)
0 件の賞賛
返信
1 解決策
1,256件の閲覧回数
robertgbaruch
Contributor II

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.

元の投稿で解決策を見る

1 返信
1,257件の閲覧回数
robertgbaruch
Contributor II

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.