Page 1 of 1
MOD54415 GPIO Trouble
Posted: Wed Jan 16, 2013 7:59 am
by jediengineer
Hey all, having a little trouble with a general GPIO program - I just wrote it to address the LEDs on the board, and to flash them in a pattern. I was able to do this by modifying the webfuncs.cpp file in the /MOD54415FactoryApp/ demo folder, and it works. I want to eliminate all the web functions, and just build the project so that when it starts up, the LEDs flash in the same pattern. When I build this, I get a problem that opens up a "main.cpp" file and points to some definition of UserMain. Can someone look this over and point me in the right direction? Thanks!!
Tony
Re: MOD54415 GPIO Trouble
Posted: Wed Jan 16, 2013 8:12 am
by dciliske
So here's your problem: Welcome to the world of C++ compilers. The short of it is that you're missing this chunk of code from the top of your file:
Code: Select all
extern "C"
{
void UserMain(void);
}
This block tells the C++ compiler to not mangle the function definition for UserMain (Wikipedia on name mangling:
http://en.wikipedia.org/wiki/Name_mangling). Without it, the compiler mangles the name, but the main system library (in one of it's .c files) calls UserMain to launch it. However, when compiling a .c file, the C compiler is used, which does not mangle names, and therefore it ends up with an undefined reference.
Re: MOD54415 GPIO Trouble
Posted: Wed Jan 16, 2013 9:41 am
by jediengineer
Thanks! I thought I left that in there, I guess I didn't. Now it builds (when I save it) but says "Nothing to build fro GPIO Test" when I try to run it...
Re: MOD54415 GPIO Trouble
Posted: Wed Jan 16, 2013 10:19 am
by dciliske
Hmm... you're using Eclipse, right? If so, i'll need to get some Eclipse people to weigh in. I'm a CLI (Command Line Interface) person myself, so I'm not overly familiar there.
If you're using the command line you could have your makefile and just run 'make load'.
Re: MOD54415 GPIO Trouble
Posted: Wed Jan 16, 2013 10:41 am
by Ridgeglider
It sounds like the project config is not correct.
1st, try creating, building and running a basic AppWizard project: File/New/Project... NetBurner/NetBurner Project... After clicking thru the various setup boxes, be SURE to check the AutoUpdate, and probably the DHCP boxes in the final screen.
This will create a basic project.
Next, create a run configuration for it, then download and test.
If that works, repeat the same steps File/New/Project ... but dont not select any of the app wiz check boxes. This will create an empty project. You can then copy and paste your .cpp and .h (and possibly an html folder), for example from the C:/nburn/Examples/...
Once again, you will need to create and execute a run configuration. To do this, select the project, right click, select Run As / NB Application.
Be sure to set the platform and IP dialog boxes correctly.
Re: MOD54415 GPIO Trouble
Posted: Wed Jan 16, 2013 11:12 am
by Forrest
jediengineer wrote:Thanks! I thought I left that in there, I guess I didn't. Now it builds (when I save it) but says "Nothing to build fro GPIO Test" when I try to run it...
Are you sure it didnt build? A project only builds once if no resources have changed. Trigger a clean build by selecting Project->Clean and then check your release directory under your project or view the console. Did the project build?
Your next step is to load the application on the device. I assume that you know how to do that, but if not, please let us know
Re: MOD54415 GPIO Trouble
Posted: Wed Jan 16, 2013 11:26 am
by jediengineer
Thanks a bundle!! It works!! I owe you guys some beer!!!