I have walked through several tutorials several times on using the AVR Plugin and have yet to generate a successful HEX file build. My environment includes Eclipse (Luna) in Fedora(21) and the latest AVR plugin offered and downloaded through the Install New Software feature in Eclipse.
I have followed tutorials exactly and have experimented myself with different build configurations. Basically, my sketch file and libraries build without error. The makefile, .mk and .map files are all created and evident in both Debug and Release folders depending on build configuration selected. However, the .hex file is never created. I have tried setting Additional Tools in Toolchain to Generate HEX file for Flash memory and Print Size. I have also turned ALL of the toolchain options on to no avail.
I have checked that all my paths do NOT have spaces as suggested by other sites as a remedy. Again, the builds are successful...just no HEX file. I have tried compiling the sketch with both .ino and .cpp suffixes. Same results. I can successfully build the libcorename.a file as well and path it accordingly.
I know AVRdude is working for I have configured and tested it successfully with the Load from MCU utility in the Target Hardware properties. It only complains of the missing HEX file when trying to upload to the device.
Arduino IDE (1.6.4) works fine on this platform, and I am pointing to its appropriate bin, core and util files and headers in the Windows Preferences and Project Compiler C/C++ settings in Eclipse to try to utilize the same files.
Is this broken? Or perhaps, there is one little bit of information in all the mass tutorials online that is being assumed when providing instruction. I look forward to learning what the mystery key may be. Perhaps it is a 'make' command argument that is not getting parsed by Eclipse or the AVR plugin properly.
I have been at this for almost two weeks and am willing to surrender to another IDE if necessary. Any help would be greatly appreciated.
Cheers,
A>AM
Diff:
I have attached the makefile. Correct me if I am wrong, but it seems the "clean:" portion of the makefile erases the ${EEPROM_IMAGE} before it has the opportunity to upload it. Is this correct?
The makefile doesn't tell us much. It looks OK to me. You'll have to realise this file itself is just part of the whole set of makefiles (see the include statements).
What would be more interesting is to see what the text in the console window is, after you clicked the hammer (build Release, or build Debug). Can you try to cut-n-paste the text in the Console tab?
Kees:
Thank you for a quick response. Unfortunately, I removed Eclipse last night
and reverted back to the Arduino IDE to get my project moving again.
However, I will reinstall and get back to where I was. I am skilled at that
now, because I have done it SO many times.
What I can offer is that I know it is a problem with the build. When I
viewed the build logs I found that avr-g++ was running into a hiccup. It
would not create the output file(s), because it did not know how to
interpret the .ino or .pde suffixed files common to Arduino sketches.
Keep in mind I made these C++ source file types in the Eclipse
configuration. When I changed the suffix to .cpp or to .c, it wouldn't use
any of the include libraries to satisfy core commands of Arduino.h and such.
Most of the standard commands were "undefined." So what's the point of
including (-I) all the files paths if avr-g++ doesn't use them?
I also found that linker wasn't being used. I tried recreating the command
line and spinning it directly to console myself and ended up with the same
results. Hence, I believe something is broken in code. Give me a couple of
hours to reinstall eclipse and have it install the CDT and AVR Plugin. Then
I will rebuild my projects as described on the Arduino Playground.unless you
have a better, more complete instruction site you can recommend. So far all
of the ones visited seem to have one or more pieces left out when comparing
them to each other. In the end, I will provide you with the build.log files
you requested.
Again, thanks,
A>AM
Last edit: justadam 2015-05-19
Kees:
I reinstalled Eclipse and followed these instructions...yet again:
http://playground.arduino.cc/code/eclipse
Obviously, the core file is built successfully in the arduino_core project.
The "first project" appears to do nothing but demonstrate setting up the configuration for there is nothing built. However, it would seem that if the original arduino_core/src folder and files were truly included it would build the .cpp files into the first project folder...but it does not. Am I wrong in understanding this? Is there a step missing here?
You will see that linker is not working for some reason in the "second project". However, all configurations are set as instructed by the site mentioned. AND, for the SoftwareSerial.cpp build it does not see the Arduino.h file, which is clearly pathed (by inclusion) back to the original "${workspace_loc:/arduino_core/src}" Directories setting in the compilers. This is where the Arduino.h file resides by Linux ln -s method. [The headers obviously worked for the libarudino_core.a build.]
Something is obviously broken somewhere...probably this guy.
Please find the attached Console log files for each project of the instructions.
Cheers,
A>AM
You need to calm down a bit :-)
When replying by email, don't include the whole history, Look at this https://sourceforge.net/p/avr-eclipse/support-requests/31/ and see how hard it becomes to digest.
The next thing I can say it that the tutorial you mention is old and I didn't even know it existed. I only browsed briefly through it, it does things different from what I am doing myself. For now that shouldn't matter too much.
Your arduino_core.build.log shows that the MCU type is set to atmega16 and the clock is 1MHz. But your configuration is named "328P_MHz". So, did you select the correct MCU? OK. Anyway, it built the libarduino_core.a
Second project. It tries to compile several .ino files. But the compiler doesn't know what to do with a .ino file. Somehow it thinks that it is a "linker input file". Maybe you forgot to add the compiler option "-x c++".
Also I don't see -I options, so maybe you forgot to add "include directories".
Let's first get this sorted out. After that I can maybe explain my own setup.
Kees:
Thanks again for your response.
Regarding MCU, I selected appropriate MCU and recompiled with no difference. I selected the ATmel328P and 16MHz when I created the project, but I guess it doesn't take at time of New Project creation. This is perhaps a bug. I guess I would warn to go back and check it in the Project Properties even after selecting same during the project creation.
Regarding the "-x c++" as a compiler option, I though it was a Caps X not small x. That could be part of the issue. I have attached the .png screenshot of where I placed the option. Please let me know if there is a better location in which to place it. I did not see it in the logs as you have indicated. Likewise, I did not see use of the avr-g++ command in the logs as well. That is why I think the project properties are being overridden somewhere. Any thoughts?
I have also attached a screen snapshot of the included folders in the project tree. What do I need to add in configurations or compiler settings to get it to use the project-level included directories?
Your assistance is greatly appreciated.
Cheers,
A>AM
No, it has to be lower case -x.
Strange that I don't see your -X c++ in the compiler logs. Hmm.
But I would place the option in Miscellaneous -> Other flags
I moved the "-x c++" flags to the Miscellaneous you mentioned on both AVR Compiler and AVR C++ Compiler. Compiled results are unchanged. I have attached the log file. It is very apparent that avr-gcc is not pulling all of the parameters from ecplipse. In particular, I still notice that avr-g++ is never used albeit evident in the C/C++ Compiler settings for AVR.
What gives?
Cheers,
A>AM
This really doesn't look good.
I do see avr-g++ -Wall ..., but not the -x c++
Let's try something a bit different. Change the mapping of *.ino. The tutorial says to make it a C++ Source File. Change that to C++ header.
Forget about the -x c++. It's no good.
Add a main.cpp that mimics what Arduino IDE does. You can find a copy of main.cpp in the Arduino distribution. For example
.../arduino-1.5.8/hardware/arduino/avr/cores/arduino/main.cpp
Copy it into your src directory.
Edit the file and after include <Arduino.h> add an include like this
This also avoids compiling all the other .ino files in your directory tree (TwoPortReceive.ino, SoftwareSerialExample.ino). If these are added to the build you'll get multiple setup and loop functions.
Tried what you recommended and "no bueno". I have attached a screen shot that shows that I even included the Arudino.h file in the projects ./src file location and the compiler is still complaining about it. Whattup?
Cheers,
A>AM
This screenshot doesn't help much.
We're not getting any further.
Can you send me (keesb at whatever sourceforge domain) perhaps a tar.gz of this project? Or projects?
I agree. Perhaps you can just point me to instructions for using the AVR Plugin with Eclipse that are new, and that work. I will follow them and then make my determination to continue to pursue its use, or not. I sincerely appreciate your help.
Cheers,
A>AM
Well, hmm, I never read any instructions myself.
As far as I know the best starting point is here
http://avr-eclipse.sourceforge.net/wiki/index.php/Documentation
I don't think the avr plugin was ever designed to develop Arduino style sketches. It turned out to be possible, but it was never a simple thing.
So I think the problem is that you're skipping to learn to how to use the plain AVR plugin. You jump ahead and include the Arduino component. That complicates things.
My setup is different from what the Arduino tutorial is trying to do. Eventually I was able to create a project directory tree that allows me to use both Eclipse and Arduino IDE. Once a project is configured it works alright.
Setting up a new project is not straightforward. Normally I first copy an old project, then tweak the .cproject file because it has identifiers in it which confuses Eclipse.
BTW. The AVR plugin was developed by Thomas Holland several years ago. It was more or less abandoned, then taken over by me. And I just did some minor changes.