MQX-based code does not execute if task is in a different source file

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

MQX-based code does not execute if task is in a different source file

跳至解决方案
1,550 次查看
dave408
Senior Contributor II

I have a feeling this is going to be an embarrassing post for me and my question has a really obvious answer.

I have the httpserv demo debugging just fine.  I added a task to app_mqx and was still able to run it in the debugger.  However, if I move this task to another source file (e.g. task.c), the code builds, but it doesn't run.  When the code is working and I debug, I'll see the Segger window with the four progress bars appear while the code is downloading.  After the function is moved to test.c, the window never pops up and therefore nothing executes.


I'm totally confused as to why this would happen.  Can anyone shed some light on this for me?  I'm pretty sure it's not a build problem, as the command line args to gcc look totally correct to me.

Thank you!

标记 (5)
0 项奖励
回复
1 解答
1,415 次查看
dave408
Senior Contributor II

It turned out that the solution was to make all of the function definitions extern.  I do not understand how the code could compile and link just fine without extern, yet not run.  I have other MQX projects with tasks in different .c files, but they aren't marked extern either *and* they work.

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,416 次查看
dave408
Senior Contributor II

It turned out that the solution was to make all of the function definitions extern.  I do not understand how the code could compile and link just fine without extern, yet not run.  I have other MQX projects with tasks in different .c files, but they aren't marked extern either *and* they work.

0 项奖励
回复
1,415 次查看
soledad
NXP Employee
NXP Employee

Hi,

Thanks for sharing your solution!

Regards

Sol

0 项奖励
回复
1,415 次查看
dave408
Senior Contributor II

Can you provide an explanation as to why some projects need it, and some don't?  It's very strange.

0 项奖励
回复