Setting up Eclipse to Develop Firmware



  • Hi everyone! I will need to edit the firmware to develop some things for my 3D printer. I am having trouble setting it up in Eclipse.

    I followed the instructions (for Mac) here: https://github.com/dc42/RepRapFirmware/blob/dev/BuildInstructions.md

    For step 6, I've verified that the arm-none-eabi-g++ and arm-none-eabi-gcc files are inside the bin folder with the expected path. When I finish step 8 of the process, Eclipse says there are 4 problems:

    Program "arm-none-eabi-g++" not found in PATH ….... [Resource: CoreNG]
    Program "arm-none-eabi-g++" not found in PATH …...... [Resource: RepRapFirmware]
    Program "arm-none-eabi-gcc" not found in PATH ….... [Resource: CoreNG]
    Program "arm-none-eabi-gcc" not found in PATH …...... [Resource: RepRapFirmware]

    Can someone help me debug this? I've restarted and gone through the instructions multiple times and this was the best I could get it.

    I also realized that for step 6, 7, and 8, I can choose a configuration in a drop down menu. Should I select "DuetWiFi" for RepRapFirmware, or should I choose "All Configurations?" For CoreNG, should I choose "All configurations" or SAM3X8E or SAM4E8E? I'm using DuetWifi.



  • Other information:

    Trying to edit firmware 1.19.
    DuetWifi PCB was bought in July, not sure what version number it is exactly… processor is ATSAM4E8E.



  • I just tried to do it in Windows following the instructions for Windows and its not working properly at a much earlier step. So I will just focus on Mac for now.

    Hopefully someone can help!


  • administrators

    @jml:

    Hi everyone! I will need to edit the firmware to develop some things for my 3D printer. I am having trouble setting it up in Eclipse.

    I followed the instructions (for Mac) here: https://github.com/dc42/RepRapFirmware/blob/dev/BuildInstructions.md

    For step 6, I've verified that the arm-none-eabi-g++ and arm-none-eabi-gcc files are inside the bin folder with the expected path. When I finish step 8 of the process, Eclipse says there are 4 problems:

    Program "arm-none-eabi-g++" not found in PATH ….... [Resource: CoreNG]
    Program "arm-none-eabi-g++" not found in PATH …...... [Resource: RepRapFirmware]
    Program "arm-none-eabi-gcc" not found in PATH ….... [Resource: CoreNG]
    Program "arm-none-eabi-gcc" not found in PATH …...... [Resource: RepRapFirmware]

    Can someone help me debug this? I've restarted and gone through the instructions multiple times and this was the best I could get it.

    I also realized that for step 6, 7, and 8, I can choose a configuration in a drop down menu. Should I select "DuetWiFi" for RepRapFirmware, or should I choose "All Configurations?" For CoreNG, should I choose "All configurations" or SAM3X8E or SAM4E8E? I'm using DuetWifi.

    Step 7: In the project Properties, go to C/C++ Build -> Settings -> Cross Settings. Change the Path in there to point to the directory that contains the bin folder with arm-none-eabi-gcc in it. I suggest you select All Configurations when doing this.

    The correct CoreNG configuration for Duet WiFi is SAM4E8E.



  • Thanks! I could have sworn I did that before.

    Choosing "All configurations" fixed it, but also, something strange was also required to make it work. After setting the path, I was clicking "Apply and Close" with no results, but then I tried clicking "Apply" then "Apply and Close" and that made it work! Very strange.



  • But now I try to build it, and I get this error:

    11:32:19 **** Build of configuration SAM4E8E for project CoreNG ****
    make all
    Building file: ../variants/duetNG/exceptions.c
    In file included from ../variants/duetNG/exceptions.c:57:0:
    ../variants/duetNG/exceptions.h:50:19: fatal error: sam4e.h: No such file or directory Invoking: Cross GCC Compiler
    #include "sam4e.h"
    ^

    compilation terminated.
    arm-none-eabi-gcc -D__SAM4E8E__ -DUDD_ENABLE -DUDD_NO_SLEEP_MGR -I"/Users/John/eclipse-workspace/CoreNG/cores/arduino" -I/Users/John/eclipse-workspace/DuetWiFiSocketServer/src/include -I"/Users/John/eclipse-workspace/CoreNG/asf" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/utils" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/utils/header_files" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/utils/preprocessor" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/utils/cmsis/sam3x/include" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/dmac" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/efc" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/hsmci" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/pio" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/pmc" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/spi" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/usart" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/utils" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/clock" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/ioport" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/sleepmgr" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/usb" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/usb/udc" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/usb/class/cdc" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/usb/class/cdc/device" -I"/Users/John/eclipse-workspace/CoreNG/asf/thirdparty/CMSIS/Include" -I"/Users/John/eclipse-workspace/CoreNG/variants/duet" -O2 -Wall -c -std=gnu99 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -nostdlib -Wdouble-promotion -fsingle-precision-constant -MMD -MP -MF"variants/duetNG/exceptions.d" -MT"variants/duetNG/exceptions.o" -o "variants/duetNG/exceptions.o" "../variants/duetNG/exceptions.c"
    make: *** [variants/duetNG/exceptions.o] Error 1

    11:32:20 Build Finished (took 133ms)



  • I do see the sam4e.h file in this directory:

    /Users/John/eclipse-workspace/CoreNG/asf/sam/utils/cmsis/sam4e/include/sam4e.h



  • I right-clicked CoreNG, clicked Properties, and added the following path to both Cross GCC Compiler and Cross G++ Compiler Includes "Include paths (-I)":
    /Users/John/eclipse-workspace/CoreNG/asf/sam/utils/cmsis/sam4e/include/

    Also, I am enclosing it in quotes because thats how the other ones are.

    That got rid of the sam4e.h error. But the new error is:

    11:56:24 **** Build of configuration SAM4E8E for project CoreNG ****
    make all
    Building file: ../variants/duetNG/exceptions.c
    Invoking: Cross GCC Compiler
    arm-none-eabi-gcc -D__SAM4E8E__ -DUDD_ENABLE -DUDD_NO_SLEEP_MGR -I"/Users/John/eclipse-workspace/DuetWiFiSocketServer/src/include" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/utils/cmsis/sam4e/include" -I"/Users/John/eclipse-workspace/CoreNG/cores/arduino" -I"/Users/John/eclipse-workspace/CoreNG/asf" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/utils" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/utils/header_files" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/utils/preprocessor" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/utils/cmsis/sam3x/include" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/dmac" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/efc" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/hsmci" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/pio" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/pmc" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/spi" -I"/Users/John/eclipse-workspace/CoreNG/asf/sam/drivers/usart" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/utils" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/clock" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/ioport" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/sleepmgr" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/usb" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/usb/udc" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/usb/class/cdc" -I"/Users/John/eclipse-workspace/CoreNG/asf/common/services/usb/class/cdc/device" -I"/Users/John/eclipse-workspace/CoreNG/asf/thirdparty/CMSIS/Include" -I"/Users/John/eclipse-workspace/CoreNG/variants/duet" -O2 -Wall -c -std=gnu99 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -nostdlib -Wdouble-promotion -fsingle-precision-constant -MMD -MP -MF"variants/duetNG/exceptions.d" -MT"variants/duetNG/exceptions.o" -o "variants/duetNG/exceptions.o" "../variants/duetNG/exceptions.c"
    In file included from /Users/John/eclipse-workspace/CoreNG/asf/sam/utils/cmsis/sam4e/include/sam4e.h:48:0,
    from ../variants/duetNG/exceptions.h:50,
    from ../variants/duetNG/exceptions.c:57:
    /Users/John/eclipse-workspace/CoreNG/asf/sam/utils/cmsis/sam4e/include/sam4e8e.h:272:26: fatal error: system_sam4e.h: No such file or directory
    #include "system_sam4e.h"
    ^
    compilation terminated.
    make: *** [variants/duetNG/exceptions.o] Error 1

    11:56:24 Build Finished (took 141ms)

    Once again, I see that the file does exist here:
    /Users/John/eclipse-workspace/CoreNG/variants/duetNG

    So what is going on?



  • So I saw that in the CoreNG Cross G++ and GCC compiles, this was in the Includes (I-) lists:
    "${workspace_loc:/${ProjName}/variants/duet}"

    So I added:
    "${workspace_loc:/${ProjName}/variants/duetNG}"

    That got rid of the error. New error is:

    Building file: ../variants/duetNG/variant.cpp
    Invoking: Cross G++ Compiler
    arm-none-eabi-g++ -D__SAM4E8E__ -DUDD_ENABLE -DUDD_NO_SLEEP_MGR -I"/Users/John/eclipse-workspace/DuetWiFiSocketServer/src/include" -I"/User… [… redacted because very long...] …ant.o" "../variants/duetNG/variant.cpp"
    In file included from /Users/John/eclipse-workspace/CoreNG/cores/arduino/Core.h:203:0,
    from ../variants/duetNG/variant.h:40,
    from ../variants/duetNG/variant.cpp:19:
    /Users/John/eclipse-workspace/CoreNG/variants/duet/variant.h:23:2: error: #error Wrong variant.h file included!
    #error Wrong variant.h file included!
    ^

    Which is followed by many more errors such as this:

    Users/John/eclipse-workspace/CoreNG/variants/duet/variant.h:34:0: warning: "VARIANT_MCK" redefined [enabled by default]
    #define VARIANT_MCK 84000000
    ^
    In file included from ../variants/duetNG/variant.cpp:19:0:
    ../variants/duetNG/variant.h:34:0: note: this is the location of the previous definition
    #define VARIANT_MCK 120000000
    ^
    In file included from ../variants/duetNG/variant.cpp:19:0:
    ../variants/duetNG/variant.h:63:0: warning: "APINS_COUNT" redefined [enabled by default]
    #define APINS_COUNT (103u)
    ^
    In file included from /Users/John/eclipse-workspace/CoreNG/cores/arduino/Core.h:203:0,
    from ../variants/duetNG/variant.h:40,
    from ../variants/duetNG/variant.cpp:19:
    /Users/John/eclipse-workspace/CoreNG/variants/duet/variant.h:63:0: note: this is the location of the previous definition
    #define APINS_COUNT (79u)

    So I would rather not fidget around with it further or else I'll just make it worse.

    Hopefully someone can help!


  • administrators

    It appears that somehow your .cproject file has been corrupted, because it was including the wrong variants folder, and the folders for other variants are not being excluded.



  • Hi dc42, maybe that is the case. Not sure. But I ended up fixing the CoreNG problem. But please tell me if I did something that I definitely should not have:

    Ok, I removed "${workspace_loc:/${ProjName}/variants/duet}" and replaced it with "${workspace_loc:/${ProjName}/variants/duetNG}"

    Then CoreNG would finally build without errors!

    The same errors would occur with building RepRapFirmware, so I did the same things and that got rid of the same errors. New errors:

    12:28:23 **** Build of configuration DuetWiFi for project RepRapFirmware ****
    make all
    Building file: ../src/Tools/Filament.cpp
    Invoking: Cross G++ Compiler
    arm-none-eabi-g++ -D__SAM4E8E__ -DCORE_NG -DDUET_NG -DDUET_WIFI -D_XOPEN_SOURCE -I"/Users/John/ecli …[redacted because very long]… ../src/Tools/Filament.cpp:12:0:
    /Users/John/eclipse-workspace/RepRapFirmware/src/Platform.h:54:20: fatal error: DueXn.h: No such file or directory

    include "DueXn.h"

    ^
    compilation terminated.
    make: *** [src/Tools/Filament.o] Error 1

    12:28:23 Build Finished (took 185ms)

    So I did this change in the RepRapFrimware Cross GCC/G++ Compiler Includes (-I) lists:
    "${workspace_loc:/${ProjName}/src/Duet}" changed to "${workspace_loc:/${ProjName}/src/DuetNG}"

    Then it got very far in the build process. Many warnings about implicit conversion from float to double in the CoreXY Kinematics part.

    Then got an error with Network.h not in path. So I added to the (-I) lists:
    …RepRapFirmware/src/DuetNG/DuetWiFi because I found Network.h there.

    Will keep using the same fix for each error that will come up. dc42, can you tell me if I am heading down the wrong path? Should I not use DuetNG files in the path?



  • After doing what I said above, the latest error is in building the target ELF file:

    Building target: DuetWiFiFirmware.elf
    Invoking: Cross G++ Linker
    arm-none-eabi-gcc -L"/Users/John/eclipse-workspace/CoreNG/SAM4E8E" -Os -Wl,–gc-sections -Wl,--fatal-warnings -mcpu=cortex-m4 -mf ... [ … redacted because very long ... ] … mer.o -lCoreNG -Wl,--end-group -lm -gcc
    arm-none-eabi-gcc: error: : No such file or directory
    make: *** [DuetWiFiFirmware.elf] Error 1



  • The full error is here:

    Building target: DuetWiFiFirmware.elf
    Invoking: Cross G++ Linker
    arm-none-eabi-gcc -L"/Users/john/eclipse-workspace/CoreNG/SAM4E8E" -Os -Wl,–gc-sections -Wl,--fatal-warnings -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -T/Users/john/eclipse-workspace/CoreNG/variants/duetNG/linker_scripts/gcc/flash.ld -Wl,-Map,/Users/john/eclipse-workspace/RepRapFirmware/DuetWiFi/DuetWiFiFirmware.map -o "DuetWiFiFirmware.elf" -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 "" ./src/Tools/Filament.o ./src/Tools/Tool.o ./src/Storage/CRC32.o ./src/Storage/FileStore.o ./src/Storage/MassStorage.o ./src/Movement/Kinematics/CartesianKinematics.o ./src/Movement/Kinematics/CoreBaseKinematics.o ./src/Movement/Kinematics/CoreXYKinematics.o ./src/Movement/Kinematics/CoreXYUKinematics.o ./src/Movement/Kinematics/CoreXZKinematics.o ./src/Movement/Kinematics/Kinematics.o ./src/Movement/Kinematics/LinearDeltaKinematics.o ./src/Movement/Kinematics/PolarKinematics.o ./src/Movement/Kinematics/ScaraKinematics.o ./src/Movement/Kinematics/ZLeadscrewKinematics.o ./src/Movement/BedProbing/Grid.o ./src/Movement/BedProbing/RandomProbePointSet.o ./src/Movement/DDA.o ./src/Movement/DriveMovement.o ./src/Movement/Move.o ./src/Libraries/sha1/sha1.o ./src/Libraries/Math/Isqrt.o ./src/Libraries/General/IP4String.o ./src/Libraries/General/StringRef.o ./src/Libraries/Fatfs/ccsbcs.o ./src/Libraries/Fatfs/diskio.o ./src/Libraries/Fatfs/fattime_rtc.o ./src/Libraries/Fatfs/ff.o ./src/Heating/Sensors/CpuTemperatureSensor.o ./src/Heating/Sensors/CurrentLoopTemperatureSensor.o ./src/Heating/Sensors/DhtSensor.o ./src/Heating/Sensors/RtdSensor31865.o ./src/Heating/Sensors/SpiTemperatureSensor.o ./src/Heating/Sensors/TemperatureSensor.o ./src/Heating/Sensors/Thermistor.o ./src/Heating/Sensors/ThermocoupleSensor31855.o ./src/Heating/Sensors/ThermocoupleSensor31856.o ./src/Heating/Sensors/TmcDriverTemperatureSensor.o ./src/Heating/FOPDT.o ./src/Heating/Heat.o ./src/Heating/Pid.o ./src/Heating/TemperatureError.o ./src/GCodes/GCodeBuffer.o ./src/GCodes/GCodeInput.o ./src/GCodes/GCodeMachineState.o ./src/GCodes/GCodeQueue.o ./src/GCodes/GCodes.o ./src/GCodes/GCodes2.o ./src/GCodes/RestorePoint.o ./src/FilamentSensors/Duet3DFilamentSensor.o ./src/FilamentSensors/FilamentSensor.o ./src/FilamentSensors/SimpleFilamentSensor.o ./src/DuetNG/DuetWiFi/Network.o ./src/DuetNG/DuetWiFi/Socket.o ./src/DuetNG/DuetWiFi/WifiFirmwareUploader.o ./src/DuetNG/DueXn.o ./src/DuetNG/FirmwareUpdater.o ./src/DuetNG/FtpResponder.o ./src/DuetNG/HttpResponder.o ./src/DuetNG/NetworkBuffer.o ./src/DuetNG/NetworkResponder.o ./src/DuetNG/SX1509.o ./src/DuetNG/TMC2660.o ./src/DuetNG/TelnetResponder.o ./src/Fan.o ./src/IoPort.o ./src/Logger.o ./src/OutputMemory.o ./src/Platform.o ./src/PortControl.o ./src/PrintMonitor.o ./src/RepRap.o ./src/RepRapFirmware.o ./src/Roland.o ./src/Scanner.o ./src/SoftTimer.o ./src/ZProbeProgrammer.o -lCoreNG -Wl,--end-group -lm -gcc
    arm-none-eabi-gcc: error: : No such file or directory make: *** [DuetWiFiFirmware.elf] Error 1

    I am not sure what file or directory it thinks is missing.


  • administrators

    Evidently your Path in the C/C++ Build -> Settings -> Cross Settings still doesn't match the actual path to gcc on your computer. On my computer that path is set to:

    C:\Program Files (x86)\GNU Tools ARM Embedded\6 2017-q2-update

    and folder "C:\Program Files (x86)\GNU Tools ARM Embedded\6 2017-q2-update\bin" contains file arm-none-eabi-gcc.exe.



  • I checked the Path by right clicking RepRapFirmware, clicking properties, and going to C/C++ Build -> Settings -> Cross Settings

    It was set to: /Users/John/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin

    The instructions say it should be this:
    /Users/<your user="" name="">/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin

    So looks correct.

    When I go to that actual path, I see many arm-none-eabi- files and included in them are these:
    arm-none-eabi-gcc
    arm-none-eabi-g++
    arm-none-eabi-gcc-4.8.3
    and many more.

    There is no file extension. Mac says they are Unix Executables.

    What on Earth is going on?</your>



  • In C/C++ Build > Settings, if I put the wrong path intentionally, this error comes immediately:
    make all
    /bin/sh: arm-none-eabi-g++: command not found

    When I have the correct path, it successfully built cpp files, then the error comes after 19 seconds when it wants to "Build target: DuetWiFiFirmware.elf"

    Just wish it would work!


  • administrators

    The only difference I can see is that I left out the final "\bin" in the path I configured. Maybe Eclipse adds that itself?

    I have another set of gcc files on my general PATH, and I've noticed that if I use the wrong path in Cross Settings, it picks up the compiler from those files (which is the wrong version compiler, so it doesn't work). Maybe in the linker step it is picking up gcc from that path too?

    You could try putting the full path in the Command box in the Cross G++ Linker options, instead of just "gcc".



  • For the "arm-none-eabi-gcc: error: : No such file or directory" error, is it not finding arm-none-eabi-gcc?

    Or is it not finding a file that is in the giant list of ".o" files?

    Is "/Users/John/eclipse-workspace/RepRapFirmware/DuetWiFi/DuetWiFiFirmware.map" supposed to be an actual file, because I couldn't find it anywhere?



  • Ok, I will try what you said above.



  • Leaving out the "/bin" part resulted in no changes in the error.

    For your other suggestion (putting full path instead of just gcc), I replaced gcc with arm-none-eabi-gcc (in the command box of the "Cross G++ Linker"). I got this error:

    Building target: DuetWiFiFirmware.elf
    Invoking: Cross G++ Linker
    arm-none-eabi-arm-none-eabi-gcc -L"/Users/John/eclipse-worksp … [ … ] … robeProgrammer.o -lCoreNG -Wl,--end-group -lm -gcc
    /bin/sh: arm-none-eabi-arm-none-eabi-gcc: command not found make: *** [DuetWiFiFirmware.elf] Error 127

    So it didn't work, so I'll change it back to just gcc.


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.