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
MOD54415 GPIO Trouble
-
- Posts: 192
- Joined: Mon Dec 17, 2012 6:24 am
MOD54415 GPIO Trouble
- Attachments
-
GPIO Test.cpp
- (3.88 KiB) Downloaded 501 times
Re: MOD54415 GPIO Trouble
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:
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.
Code: Select all
extern "C"
{
void UserMain(void);
}
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
-
- Posts: 192
- Joined: Mon Dec 17, 2012 6:24 am
Re: MOD54415 GPIO Trouble
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
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'.
If you're using the command line you could have your makefile and just run 'make load'.
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: MOD54415 GPIO Trouble
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.
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
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?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...
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
Forrest Stanley
Project Engineer
NetBurner, Inc
NetBurner Learn Articles: http://www.netburner.com/learn
Project Engineer
NetBurner, Inc
NetBurner Learn Articles: http://www.netburner.com/learn
-
- Posts: 192
- Joined: Mon Dec 17, 2012 6:24 am
Re: MOD54415 GPIO Trouble
Thanks a bundle!! It works!! I owe you guys some beer!!!