getting set up to hack firmware



  • Hello, we have the Duet Wifi and DueX5 and plan to use it to control a large custom 3d printer.
    We plan to control 6 motors off of the Duet3d as well as an additional 5 from the DueX5.
    We also plan to use the extra 2 stepper channels found on the CONN_LCD..
    But we would still like to use 1 or 2 more.. 🙂

    so we are interested in hacking the firmware to add 1 or 2 more independent stepper channels.
    I have seen that this has been accomplished by @kazolar in the forums.

    so far I have been able to build the RepRapFirmware 2.02 from source in eclipse on a pc using the master branches of the following:

    CoreNG, FreeRTOS, RRFLibraries and RepRapFirmware
    I also have DuetWifiSocketServer, CoreESP8266 and LwipESP8266 projects loaded in eclipse

    I can get this set to compile without error.

    now to proceed towards repurposing pins and adding additional channels of motor control. From reading through posts in the forum.. I believe I need to use v2-dev branches of CoreNG and RepRapFirmware..

    so far I have tried v2-dev branches of CoreNG and RepRapFirmware
    compilation yields hundreds of errors like this one

    '__are_same' was not declared in this scope RepRapFirmware
    line 383, external location: c:\program files (x86)\gnu tools arm embedded\7 2018-q2-update\arm-none-eabi\include\c++\7.3.1\bits\stl_algobase.h C/C++ Problem

    all of the visible errors concern the same file stl_algobase.h
    am I working with the right branches? if so.. How do I fix this?

    from @kazolar 's posts I was planing on modifying the Pins_DuetNG.h file for starters.. however the DuetNG folder containing it is crossed out in the RepRapFirmware src folder..

    any help would be appreciated.

    thanks!


  • administrators

    • Current development is on the dev branch of RepRapFirmware, not the v2-dev branch any more
    • Use the master branch of CoreNG for now, although I will switch to the dev branch when I have updated it
    • I have just switched to using the 2018-q4-major release of Gnu Tools ARM Embedded.
    • If the DuetNG folder is crossed out, you probably have the wrong project configuration selected. Build the Duet2_RTOS configuration of RepRapFirmware and the SAM4E8E_RTOS configurations of everything else.


  • thank you for clarifying the branches and configurations..
    So I believe I have all of the correct branches and configurations set in my project..
    I also installed the new release of Gnu Tools ARM Embedded..
    however, when I attempt to compile RepRapFirmware I get errors while building the file: ../src/Movement/Kinematics/HangprinterKinematics.cpp

    here are some of the first error messages..

    'class FixedMatrix<float, 9, 9>' has no member named 'Fill' CoreKinematics.cpp /RepRapFirmware/src/Movement/Kinematics line 50 C/C++ Problem

    'class FixedMatrix<float, 9, 9>' has no member named 'Fill' CoreKinematics.cpp /RepRapFirmware/src/Movement/Kinematics line 129 C/C++ Problem

    could not convert 'normalMatrix.FixedMatrix<double, 9, 10>::GaussJordan(((double*)numFactors), (numFactors + 1))' from 'void' to 'bool' HangprinterKinematics.cpp /RepRapFirmware/src/Movement/Kinematics line 426 C/C++ Problem

    I have attached the console output below..

    Building file: ../src/Movement/Kinematics/HangprinterKinematics.cpp
    Invoking: Cross G++ Compiler
    arm-none-eabi-g++ -D__SAM4E8E__ -DRTOS -DDUET_NG -D_XOPEN_SOURCE -I"C:\Eclipse\Firmware-dev\CoreNG\cores\arduino" -I"C:\Eclipse\Firmware-dev\CoreNG\libraries\Flash" -I"C:\Eclipse\Firmware-dev\CoreNG\libraries\SharedSpi" -I"C:\Eclipse\Firmware-dev\CoreNG\libraries\Storage" -I"C:\Eclipse\Firmware-dev\CoreNG\libraries\Wire" -I"C:\Eclipse\Firmware-dev\CoreNG\asf" -I"C:\Eclipse\Firmware-dev\CoreNG\asf\common\utils" -I"C:\Eclipse\Firmware-dev\CoreNG\asf\common\services\clock" -I"C:\Eclipse\Firmware-dev\CoreNG\asf\common\services\ioport" -I"C:\Eclipse\Firmware-dev\CoreNG\asf\sam\drivers" -I"C:\Eclipse\Firmware-dev\CoreNG\asf\sam\services\flash_efc" -I"C:\Eclipse\Firmware-dev\CoreNG\asf\sam\utils" -I"C:\Eclipse\Firmware-dev\CoreNG\asf\sam\utils\cmsis\sam4e\include" -I"C:\Eclipse\Firmware-dev\CoreNG\asf\sam\utils\header_files" -I"C:\Eclipse\Firmware-dev\CoreNG\asf\sam\utils\preprocessor" -I"C:\Eclipse\Firmware-dev\CoreNG\asf\thirdparty\CMSIS\Include" -I"C:\Eclipse\Firmware-dev\CoreNG\variants\duetNG" -I"C:\Eclipse\Firmware-dev\RepRapFirmware\src" -I"C:\Eclipse\Firmware-dev\RepRapFirmware\src\DuetNG" -I"C:\Eclipse\Firmware-dev\RepRapFirmware\src\Networking" -I"C:\Eclipse\Firmware-dev\DuetWiFiSocketServer\src\include" -I"C:\Eclipse\Firmware-dev\FreeRTOS\src\include" -I"C:\Eclipse\Firmware-dev\FreeRTOS\src\portable\GCC\ARM_CM4F" -I"C:\Eclipse\Firmware-dev\RRFLibraries\src" -O2 -Wall -c -std=gnu++17 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -fno-threadsafe-statics -fno-rtti -fno-exceptions -nostdlib -Wdouble-promotion -fsingle-precision-constant "-Wa,-ahl=HangprinterKinematics.s" -MMD -MP -MF"src/Movement/Kinematics/HangprinterKinematics.d" -MT"src/Movement/Kinematics/HangprinterKinematics.o" -o "src/Movement/Kinematics/HangprinterKinematics.o" "../src/Movement/Kinematics/HangprinterKinematics.cpp"
    ../src/Movement/Kinematics/CoreKinematics.cpp: In member function 'void CoreKinematics::Recalc()':
    ../src/Movement/Kinematics/CoreKinematics.cpp:36:42: error: invalid conversion from 'size_t' {aka 'unsigned int'} to 'float*' [-fpermissive]
    const bool ok = tempMatrix.GaussJordan(MaxAxes, 2 * MaxAxes);
    ^~~~~~~
    In file included from ../src/Movement/Kinematics/Kinematics.h:12,
    from ../src/Movement/Kinematics/ZLeadscrewKinematics.h:11,
    from ../src/Movement/Kinematics/CoreKinematics.h:11,
    from ../src/Movement/Kinematics/CoreKinematics.cpp:8:
    C:\Eclipse\Firmware-dev\RRFLibraries\src/Math/Matrix.h:87:93: note: initializing argument 1 of 'void FixedMatrix<T, ROWS, COLS>::GaussJordan(T*, size_t) [with T = float; unsigned int ROWS = 9; unsigned int COLS = 18; size_t = unsigned int]'
    template<class T, size_t ROWS, size_t COLS> void FixedMatrix<T, ROWS, COLS>::GaussJordan(T solution, size_t numRows)
    ~^~~~~~
    ../src/Movement/Kinematics/CoreKinematics.cpp:36:62: error: void value not ignored as it ought to be
    const bool ok = tempMatrix.GaussJordan(MaxAxes, 2 * MaxAxes);
    ^
    ../src/Movement/Kinematics/CoreKinematics.cpp:50:18: error: 'class FixedMatrix<float, 9, 9>' has no member named 'Fill'
    forwardMatrix.Fill(0.0);
    ^~~~
    ../src/Movement/Kinematics/CoreKinematics.cpp: In constructor 'CoreKinematics::CoreKinematics(KinematicsType)':
    ../src/Movement/Kinematics/CoreKinematics.cpp:129:16: error: 'class FixedMatrix<float, 9, 9>' has no member named 'Fill'
    inverseMatrix.Fill(0.0);
    ^~~~
    src/Movement/Kinematics/subdir.mk:39: recipe for target 'src/Movement/Kinematics/CoreKinematics.o' failed
    make: *** [src/Movement/Kinematics/CoreKinematics.o] Error 1
    make: *** Waiting for unfinished jobs....
    ../src/Movement/Kinematics/HangprinterKinematics.cpp: In member function 'virtual bool HangprinterKinematics::DoAutoCalibration(size_t, const RandomProbePointSet&, const StringRef&)':
    ../src/Movement/Kinematics/HangprinterKinematics.cpp:426:33: error: invalid conversion from 'size_t' {aka 'unsigned int'} to 'double
    ' [-fpermissive]
    if (!normalMatrix.GaussJordan(numFactors, numFactors + 1))
    ^~~~~~~~~~
    In file included from ../src/Movement/Kinematics/Kinematics.h:12,
    from ../src/Movement/Kinematics/HangprinterKinematics.h:11,
    from ../src/Movement/Kinematics/HangprinterKinematics.cpp:8:
    C:\Eclipse\Firmware-dev\RRFLibraries\src/Math/Matrix.h:87:93: note: initializing argument 1 of 'void FixedMatrix<T, ROWS, COLS>::GaussJordan(T*, size_t) [with T = double; unsigned int ROWS = 9; unsigned int COLS = 10; size_t = unsigned int]'
    template<class T, size_t ROWS, size_t COLS> void FixedMatrix<T, ROWS, COLS>::GaussJordan(T solution, size_t numRows)
    ~^~~~~~
    ../src/Movement/Kinematics/HangprinterKinematics.cpp:426:32: error: could not convert 'normalMatrix.FixedMatrix<double, 9, 10>::GaussJordan(((double
    )numFactors), (numFactors + 1))' from 'void' to 'bool'
    if (!normalMatrix.GaussJordan(numFactors, numFactors + 1))
    ^~~~
    ../src/Movement/Kinematics/HangprinterKinematics.cpp:426:59: error: in argument to unary !
    if (!normalMatrix.GaussJordan(numFactors, numFactors + 1))
    ^
    src/Movement/Kinematics/subdir.mk:39: recipe for target 'src/Movement/Kinematics/HangprinterKinematics.o' failed
    make: *** [src/Movement/Kinematics/HangprinterKinematics.o] Error 1

    14:16:44 Build Failed. 12 errors, 0 warnings. (took 18s.607ms)


  • administrators

    You have incompatible versions or branches of projects RepRapFirmware and RRFLibraries in your Eclipse workspace.



  • so I was able to build the latest beta pre-lease 2.03beta2 using the updated recipe from the build instructions:

    • package: branch: configuration

    • RepRapFirmware: main: Duet2_RTOS
    • CoreNG: main: SAM4E8E_RTOS
    • FreeRTOS: main: SAM4E
    • RRFLibraries: main: SAM4E_RTOS
    • DuetWiFiSocketServer: dev: Release

    I think I may still have the wrong configuration set for RepRapFirmware as I'm using the Duet2 Wifi and the DuetNG folder containing the file Pins_DuetNG.h is still greyed out..

    Pins_DuetNG.h was the file kazolar mentions modifying in the forums to add additional motor control channels.. under my current build I have access to Pins_Duet.h should I start with this file instead?

    Is Duet2_RTOS the correct configuration of RepRapFirmware for my Duet2 Wifi board? It builds without error and when I uploaded it to the board, the web interface reports back "RepRapFirmware for Duet 2 WiFi/Ethernet" for the firmware name. The possible configurations for RepRapFirmware are below:

    Alligator
    Duet085
    Duet085_RTOS
    Duet2_RTOS
    Duet3_V03
    Duet3_V05
    DuetM_RTOS
    PCCB_08
    PCCB_08X5
    PCCB_10
    RADDS_RTOS
    SAME70XPLD

    Thank you for taking a look at this.


  • administrators

    Duet2_RTOS is the correct configuration for the Duet WiFi/Ethernet, but you should use the dev branch of every project except FreeRTOS.



  • So I have modified my build as you suggested and now have the following:

    RepRapFirmware: dev: Duet2_RTOS
    CoreNG: dev: SAM4E8E_RTOS
    FreeRTOS: main: SAM4E
    RRFLibraries: dev: SAM4E_RTOS
    DuetWiFiSocketServer: dev: Release

    when I build I get errors.. see the build log attached.
    0_1553634404249_build log.txt

    thanks.


  • administrators

    Update your RepRapFirmware project source files from the latest commit. A few days ago I accepted a PR from another user, but it turned out to be incompatible with other commits I had made recently. So the commit that implemented that PR doesn't build.



  • So I got that to build without errors.. thanks!

    however the RepRapFirmware\src\DuetNG folder and the file Pins_DuetNG.h are still greyed out..

    Pins_DuetNG.h was the file kazolar mentions modifying in the forums to add additional motor control channels..

    under my current build I have access to RepRapFirmware\src\Duet\Pins_Duet.h should I start with this file instead?

    Thanks for your help


  • administrators

    You have selected the wrong configuration of the RepRapFirmware to build. Select the Duet2 configuration. Then the DuetNG folder will not be greyed out.



  • After a break, I'm back to work on the firmware..
    Here's an image of my project folder from eclipse
    0_1556667389371_DuetNG-issue.jpg


  • administrators

    The Duet_NG folder that is greyed out is the important one. I sometimes find that Eclipse greys out the wrong folder. Changing the configuration to a different one and then back again usually fixes it. However, when the wrong folder is greyed out, the build still works.

    The version of Eclipse that I currently use is 2019-03.


Log in to reply