Problem with Eclipse/Jantje Plugin vs Arduino IDE using Arduino DUE

Having bought a DUE to experiment with AND being a tremendous fan of the Jantje Plugin under ECLIPSE, I started to try the Blink program on the DUE. However I did run into an interesting problem: Arduino IDE 1.5.2 Blink program compiles and links fine and is installed with ease.

Eclipse Blink compiles fine but runs into an error

'Starting combiner'
"D:/Arduino/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-g++" -Os -Wl,--gc-sections -mcpu=cortex-m3 "-T/D:/Arduino/hardware/arduino/sam/variants/arduino_due_x/linker_scripts/gcc/flash.ld" "-Wl,-Map,D:/workspace/testDue/Release/testDue.map" -o "D:/workspace/testDue/Release/testDue.elf" "-LD:/workspace/testDue/Release" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "D:/workspace/testDue/Release/arduino/syscalls_sam3.c.o"    ./testDue.cpp.o   D:/workspace/testDue/Release/arduino.ar   "/D:/Arduino/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a" "D:/workspace/testDue/Release/arduino.ar" -Wl,--end-group
arm-none-eabi-g++: /D:/Arduino/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a: Invalid argument
make: *** [testDue.elf] Error 1

This seems a bit funny as to my understanding both use the same compiler environment. Jantje am I correct in assuming this? No doubt I did something wrong here :grin: But I would like to know where I f..ck..d up :grin:

Wel I found the cause: This

/D:/Arduino/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a

Should be

D:/Arduino/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a

The first slash should be left out. When I changed the environment variable it works fine. Now to find out why this was put in in the first place.

Dug some deeper. It seems there is a little bug in Jantje's plugin. If I fill in constants (i.e. the correct location) in the platform.txt the environment variable is still created wrong (A.BUILD.VARIANT.PATH = "/D:/Arduino...etc). This first slash is incorrect. Should not be there. But since I am ignoring this parameter in the SAM platform.txt file it will at least compile fine without having to change the environment variable every time. Now the clue is to find where this variable is built up. Seems to be in the Helper file. I'll dig deeper.

mmm interesting, I wonder if it will also apply to Linux and OSX configurations? If I get a chance tomorrow, I'll like hook one up and see what happens.


Paul

Could be it works fine for non-wondows systems as in Unix it would be a full pathname. It would certainly help to find a solution :)

The code you are looking for is

    IEnvironmentVariable var = new EnvironmentVariable(ENV_KEY_build_variant_path, pathMan.getURIValue(
        ArduinoConst.PATH_VARIABLE_NAME_ARDUINO_PINS).getPath()
        + "/${" + ArduinoConst.ENV_KEY_build_variant + "}");
    contribEnv.addVariable(var, confDesc);

From what I see it looks like the arduino pin path is not properly set. As this is part of the "post processing" (so after the platform.txt and boards.txt have been processed) this can not be overwritten by these files.

I just created a new due sketch and compiled on linux and windows xp. Worked in both environments.
I assume there is a problem with the “linked resource” arduino pin path in your environment.

Best regards
Jantje

Just checked but it looks correct D:\Arduino\hardware\arduino\sam\variants

nicoverduin: Just checked but it looks correct D:\Arduino\hardware\arduino\sam\variants

wierd. Easiest to track down the problem would be to debug. I have searched again and the only location I can find where this environment variable is set is in the method setTheEnvironmentVariablesPostProcessing in arduinohelpers.java. Easiest would be to debug the code. I'm sure you can do so. Is there anything special to the d drive? Such as cloud drive or linked drive ... Best regards Jantje

Hi Jantje I agree and I am planning to do so when I find the time :drooling_face: At least it is not a show stopper as there are 2 workarounds: - hardcode in platforms.txt - modify the parameter in the environment variables once the project is generated. However as I am apparently the only one.... I probably made messed up my environment (too many different arduino versions on my laptop or something). Unless the world is falling apart I'll dig into it and let you know. Another educational problem :grin: :Dlike those!!!

Whatever it is, it happens on all my platforms (Arduino, Tiny and sam). So for some unclear reason the Variant path starts with a / instead of a Drive letter. But since I only use the variants with the SAM processors all go well by coincidence.

I made some prints of the variables:

Path Variable Name Arduino Pins
ENV_KEY_build_variant_path=A.BUILD.VARIANT.PATH
PATH_VARIABLE_NAME_ARDUINO_PINS=ArduinoPinPath
Pathman PATH_VARIABLE_NAME_ARDUINO_PINS=/D:/Arduino/hardware/arduino/sam/variants
ENV_KEY_build_variant=A.BUILD.VARIANT
Path Variable =A.BUILD.VARIANT.PATH=/D:/Arduino/hardware/arduino/sam/variants/${A.BUILD.VARIANT} ; [REPL]

Notice that Pathman is already wrong. and it is built with this statement:

    private static void setTheEnvironmentVariablesPostProcessing(IContributedEnvironment contribEnv, ICConfigurationDescription confDesc) {
    IPathVariableManager pathMan = confDesc.getProjectDescription().getProject().getPathVariableManager();

** IPathVariableManager pathMan = confDesc.getProjectDescription().getProject().getPathVariableManager();**

This is where it goes wrong.

just for my understanding Can you give me a printscreen of the project properties->resource->linked resource->path variables ? Best regards Jantje

I have added the project properties from an Arduino Uno project and a SAM project as well as the wrong environment variable for both projects. It happens (in my case for all my projects). SAM was the first for me to use the Variant. That is why I never saw it.. SAM project

Arduino project

I really can't make sense of this. Eclipse is known for "once a workspace is bad it is hard to fix" could you try if you have the same problem in a new workspace? And is your D drive in any way special? version control; cloud drive .... Best regards jantje

Nope it is a standard D drive. Nothing special. But I will have a look at it later. No time now. Connecting an ethernet Card and a nrf24L01 on an Arduino. Using softSPI for the nrf seems to work :)