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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
615 Views
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!

Tags (5)
0 Kudos
1 Solution
480 Views
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.

View solution in original post

0 Kudos
3 Replies
481 Views
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 Kudos
480 Views
soledad
NXP Employee
NXP Employee

Hi,

Thanks for sharing your solution!

Regards

Sol

0 Kudos
480 Views
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 Kudos