Arduino blog

Arduino blog

Arduino thinkering

This blog is about things I come by related to Arduino which I feel are inspiring/important/funny enough to write about.

arduino boards.txt and platform.txt and trouble shooting

eclipse pluginPosted by Jan Fri, November 20, 2015 14:25:10
Intro
Today I got this mail from a user of the plugin and I would like to use it to explain how the plugin works based on this trouble shooting instance.

the mail
Hi Jantje,

I just installed the Arduino 1.6.6 and updated the AVR to 1.6.9 and the SAM packages for Uno and Due. The Graph sample builds fine for both of them using the IDE.

But I'm having a problem with Eclipse. The call to the archiver (avr-ar) is not being passed the file output file, just empty quotes (""). The AVR 1.6.8 files work fine. The makefile has the quotes in it:

arduino.ar: $(AR_OBJ)
@echo 'Starting archiver'
"/home/rmerriam/Apps/arduino-1.6.6/hardware/tools/avr/bin/avr-ar" rcs "" $(AR_OBJ)
@echo 'Finished building: $@'
@echo ' '


The makefile for the SAM is the same:

arduino.ar: $(AR_OBJ)
@echo 'Starting archiver'
"/home/rmerriam/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-ar" rcs "" $(AR_OBJ)
@echo 'Finished building: $@'
@echo ' '


I tried to track this back to the files you generate at the workspace root and other possible locations without any success.

The answer
Hi user

If you used the latest nightly you should have gotten a message that Arduino IDE 1.6.6 is not supported.
There is a regression in Arduino IDE 1.6.6. which is not so bad on linux but pretty bad on windows.
Though I'm not sure the regressions I'm aware of also match your case I do advice not to use Arduino IDE 1.6.6 (and later) for now.

If I had your environment at my fingertips I'd probably find out quickly what is wrong. Trying to recreate your environment here is a big unknown.
So best for me is that you (or "any plugin user") would understand what arduino ide and the plugin do to make the compile commands. I have already written a blog to explain the basics on the plugin. You can find it here http://blog.baeyens.it/#post22. And here is the spec from arduino on the platform and boards.txt files https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification

Here is my braindump (not cleaned up so you get an idea on how I got where I got)
My first guess is that there is something unexpected in the "platform.txt" which makes the plugin to do something "wrong".
In this particular case I would check the link recipe in the platform.txt file. Look for how the files get introduced.
...... (light goes on)
I would remember that the plugin links in all the files at once (where the arduino ide does them file by file). Finding the files is done by cdt based on a keyword. Because I can not force arduino to use a specific name for the keyword the plugin has to introduce the keyword itself. The keyword is hardcoded in the plugin.xml.
https://github.com/jantje/arduino-eclipse-plugin/blob/master/it.baeyens.arduino.core/plugin.xml#L600

This is visible in your project properties->C/C++ Build->settings->tool settings(tab)->Arduino archiver->command line pattern. It should be exactly the same as in the plugin.xml
${A.RECIPE.AR.PATTERN.1} ${FLAGS} ${INPUTS} ${A.RECIPE.AR.PATTERN.2} ${A.RECIPE.AR.PATTERN.3}

Then I would check the makefile.
The keys ${A.RECIPE.AR.PATTERN.1} ${FLAGS} ${INPUTS} ${A.RECIPE.AR.PATTERN.2} ${A.RECIPE.AR.PATTERN.3} should be extended and $(AR_OBJ) should be added.
Extended mean "recursively replaced with the environment variables" as found in project properties->C/C++ Build->Environment.
.../(light goes on)
why is $(AR_OBJ) not extended? I mean $(AR_OBJ) means replace with all object files that should go to the archiver. It simply has not been replaced.
Secondly the archive file is not there. In my case ${A.RECIPE.AR.PATTERN.1} looks like:
"${A.COMPILER.PATH}${A.COMPILER.AR.CMD}" ${A.COMPILER.AR.FLAGS} ${A.COMPILER.AR.EXTRA_FLAGS} "${A.BUILD.PATH}/${A.ARCHIVE_FILE}"
Looking at the command you see in your console and you posted above
"/home/rmerriam/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-ar" rcs ""
"${A.COMPILER.PATH}${A.COMPILER.AR.CMD}" ="/home/rmerriam/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-ar"
${A.COMPILER.AR.FLAGS} ${A.COMPILER.AR.EXTRA_FLAGS} =rcs
"${A.BUILD.PATH}/${A.ARCHIVE_FILE}"="/"
NOTE THE SLACH!!
I guess the / makes "the double quote part of the string" (instead of "end of string") which makes $(AR_OBJ) part of the string which makes it is not replaced by the input files. BINGO smiley

So I think we can safely conclude that the root cause of problem is that
"${A.BUILD.PATH}"=""
"${A.ARCHIVE_FILE}"=""

For those who have not read the blog mentioned before
${A.BUILD.PATH} in an environment variable means replace with the content of the environment variable A.BUILD.PATH
My naming convention for environment variables states
A.XXX is environment variable provided by arduino or to make the environment variables of arduino work.
on my system
"${A.BUILD.PATH}"="${ProjDirPath}/${ConfigName}"
Which is provided by the plugin. Why it is not provided on your system ... I don't know.
"${A.ARCHIVE_FILE}"="arduino.ar"
Which is provided by the plugin. Why it is not provided on your system ... I don't know.

lets have a look on how we can know where A.BUILD.PATH should be set
All string (should) be defined in ArduinoConst.java. We find A.BUILD.PATH here
https://github.com/jantje/arduino-eclipse-plugin/blob/master/it.baeyens.arduino.common/src/it/baeyens/arduino/common/ArduinoConst.java#L98
The eclipse call hierarchy tells us this variable is only used in the method setTheEnvironmentVariablesSetTheDefaults
https://github.com/jantje/arduino-eclipse-plugin/blob/master/it.baeyens.arduino.core/src/it/baeyens/arduino/tools/ArduinoHelpers.java#L577
The method name setTheEnvironmentVariablesSetTheDefaults speaks for itself. As you can see in the code the variable is always set.
If it is missing something went wrong. To fix it it should be sufficient to go to project properties->arduino and select apply. If this is not sufficient there is something wrong in your environment (like arduino ide 1.6.6???, defining BUILD.PATH and ARCHIVE_FILE as empty strings overwriting the defaults?)

I hope this case explain better how the plugin works in regards to the platform.txt and boards.txt file and how one can do in depth trouble shooting.


Best regards

Jan

PS I prefer that you create github issues because other people may find the same issues and it is easier for me to keep track of all possible issues.




  • Comments(2)//blog.baeyens.it/#post24