Undefined irq functions (5213EVB)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Undefined irq functions (5213EVB)

6,643 次查看
Cheshyr
Contributor I
I've been fighting with this for a while, and I'm running out of ideas. I keep receiving the following errors:

---
Link Error : Undefined : "mcf5xxx_irq_enable"
Referenced from "main" in main.c

Link Error : Undefined : "mcf5xxx_set_handler"
Referenced from "main" in main.c

Link failed.
---

I first started by setting up the PWM, and I've got that working. Then, to test intterupt capability, I wanted to capture the PWM high-times on the GPT port. I've failed to get the interrupts to enable properly. Is there something I'm missing? Below is the code, trimmed to show the important stuff.

---
#include "common.h"
#include

__interrupt__ void gpt_ch0_irq(void)
{
old0 = new0;
new0 = MCF_GPT_GPTC0;
PWM0Data = new0 - old0;
}

__interrupt__ void gpt_ch1_irq(void)
{
old1= new1;
new1 = MCF_GPT_GPTC1;
PWM1Data = new1 - old1;
}

void main()
{

MCF_GPIO_PTDPAR = 0x0F; // Enable port TD to PWM output
MCF_GPIO_DDRTD = 0x0F; // Set port TD to 'output'
GPTInit(); // Init GPT module
ICMInit(); // Init Interrupt Control Module
PWMInit(); // Init PWM module

mcf5xxx_set_handler(64 + 44, gpt_ch0_irq);
mcf5xxx_set_handler(64 + 45, gpt_ch1_irq);
mcf5xxx_irq_enable(); // Enable Interrupts

while(1){}; // Run
}
---

I've included the rest of my code in the attached zip. It's not the cleanest code, but it's been hacked at for the last month, so...

Thanks.

Message Edited by Cheshyr on 04-10-200602:50 PM

Message Edited by Cheshyr on 04-10-200602:50 PM

标签 (1)
0 项奖励
回复
5 回复数

1,058 次查看
mnorman
NXP Employee
NXP Employee
It looks like mcf5xxx.c isn't being included in the project.  If you are using CodeWarrior, make sure that this file is in your current target (bullet in the column with an arrow pointing to a target at the top).
 
The example projects from the software examples on the web do make use of these functions.  Are you able to compile and link those examples?
 
-mn
0 项奖励
回复

1,058 次查看
Cheshyr
Contributor I
hmm.  I buiilt the 5213EVb example, and it worked fine.  Recognized everything.  I copied in my own code, and now my code is working.  Must have been something with the stationary I built the project from initially.  It's happened a couple of times though.  Perhaps the wizard does something that building it straight from the stationary does not?
 
Either way, thanks.
0 项奖励
回复

1,058 次查看
CrasyCat
Specialist III
Hello
 
In fact you need to add an implementation of the functions mcf5xxx_irq_enable & mcf5xxx_set_handler to your application.  The file mcf5xxx.c contains an example of implementation for these functions.
 
CrasyCat
0 项奖励
回复

1,058 次查看
Cheshyr
Contributor I
Well, you'll notice I include common.h, which includes mcf5xxx.h.  Also, mcf5xxx.c is already listed in my project under support files.  Do these files not suffice; I need to write my own?
 
Thanks.  :smileyhappy:
0 项奖励
回复

1,058 次查看
airswit
Contributor III
I am having similar problems. The thing that may be hanging you up is the fact that you usually have to set a bit in order to clear the interrupt flag, while in the ISR (more specifically: set the C0F/C1F bit, respectively...check out page 12-14 in the RM). Also, I had to setup the IMRL registers (I am trying to use the PIT, but not working correctly yet). The problem I have is that it will interrupt once, but then no more..check out my thread on PIT. but ya, start with what I have said, hopefully you will have more success then me!
0 项奖励
回复