Compiling Marlin on OctoPi for BB

Discussion in 'BigBox General Chat' started by Stian Indal Haugseth, Jun 10, 2016.

  1. Stian Indal Haugseth

    Stian Indal Haugseth Well-Known Member

    Joined:
    Sep 11, 2015
    Messages:
    589
    Likes Received:
    100
    Hi,

    I started messing about trying to set up OctoPi so I can compile the latest Marlin forked from @Alex9779. Would be nice to have my own E steps and custom config.

    What compiler are you folks using? Anyone doing this on Raspberry Pi?

    I just got some Arduino packages installed but I had to go to bed. On http://playground.arduino.cc/Linux/Raspbian it's stated the arduino package is an older one and might not support all new boards. And the full Arduino download for ARM is experimental but I think I might go for it anyways. Like a newer compiler as it might have some improvements.

    I will update here whatever findings I have.
     
  2. Stian Indal Haugseth

    Stian Indal Haugseth Well-Known Member

    Joined:
    Sep 11, 2015
    Messages:
    589
    Likes Received:
    100
  3. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
    I was thinking of doing this on the RPi but at least on the RPi2 it took literally ages to finish...
    On my programming desktop (OS X Mac mini) I compile with Arduino IDE, have seem script because I edit the code not with Arduino IDE.
    My build server runs Debian and for compiling it downloads Arduino Linux version to compile...
     
  4. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
    Just for reference, here is my script I run in Jenkins to prepare and compile:
    Code:
    mkdir bin
    mkdir build
    
    wget http://downloads-02.arduino.cc/arduino-1.6.4-linux64.tar.xz
    tar Jxf arduino-1.6.4-linux64.tar.xz
    
    git clone https://github.com/kiyoshigawa/LiquidCrystal_I2C.git
    rm -rf arduino-1.6.4/libraries/LiquidCrystal_I2C
    mv -f LiquidCrystal_I2C/LiquidCrystal_I2C arduino-1.6.4/libraries/LiquidCrystal_I2C
    rm -rf LiquidCrystal_I2C
    
    git clone https://github.com/lincomatic/LiquidTWI2.git
    rm -rf arduino-1.6.4/libraries/LiquidTWI2
    mv -f LiquidTWI2 arduino-1.6.4/libraries/LiquidTWI2
    rm -rf LiquidTWI2
    
    mv LinuxAddons/bin/* bin/
    cp -r ArduinoAddons/Arduino_1.6.x/hardware/* arduino-1.6.4/hardware
    cp -r arduino-1.6.4/hardware/marlin/avr/libraries/* arduino-1.6.4/libraries/
    cp -r ArduinoAddons/Arduino_1.6.x/libraries/* arduino-1.6.4/libraries/
    
    daemonize -E BUILD_ID=dontKillMe /usr/bin/Xvfb :1 -screen 0 1024x768x16
    DISPLAY=:1.0 ./arduino-1.6.4/arduino --verify --board marlin:avr:mega Marlin/Marlin.ino \
    --pref build.path=./build
    mv build/Marlin.cpp.hex build/Marlin.${JOB_NAME##*/}.hex
    
    For the RCBugFix branch I had to change this to this:
    Code:
    mkdir bin
    mkdir build
    
    wget http://downloads-02.arduino.cc/arduino-1.6.4-linux64.tar.xz
    tar Jxf arduino-1.6.4-linux64.tar.xz
    
    git clone https://github.com/kiyoshigawa/LiquidCrystal_I2C.git
    rm -rf arduino-1.6.4/libraries/LiquidCrystal_I2C
    mv -f LiquidCrystal_I2C/LiquidCrystal_I2C arduino-1.6.4/libraries/LiquidCrystal_I2C
    rm -rf LiquidCrystal_I2C
    
    git clone https://github.com/lincomatic/LiquidTWI2.git
    rm -rf arduino-1.6.4/libraries/LiquidTWI2
    mv -f LiquidTWI2 arduino-1.6.4/libraries/LiquidTWI2
    rm -rf LiquidTWI2
    
    daemonize -E BUILD_ID=dontKillMe /usr/bin/Xvfb :1 -screen 0 1024x768x16
    DISPLAY=:1.0
    export DISPLAY=:1.0
    
    ./arduino-1.6.4/arduino --install-library "U8glib"
    ./arduino-1.6.4/arduino --verify --board arduino:avr:mega:cpu=atmega2560 Marlin/Marlin.ino \
    --pref build.path=./buildroot
    
    mv buildroot/Marlin.cpp.hex buildroot/Marlin.${JOB_NAME##*/}.hex
    
    I think I can remove the cloning of the libs in the second, this is handle by the Arduino package manager there...
     
  5. Tom De Bie

    Tom De Bie Well-Known Member

    Joined:
    May 7, 2016
    Messages:
    191
    Likes Received:
    35
    Arduino IDE works nice on Raspberry. I just don't know if you can upload to a RUMBA board. It's a Arduino Mega chip, so it should work...
     
  6. Stian Indal Haugseth

    Stian Indal Haugseth Well-Known Member

    Joined:
    Sep 11, 2015
    Messages:
    589
    Likes Received:
    100
    Yes but Mac mini and your debian probably has x86 architecture. But you say you have compiled on RPI2. RPI3 should be faster and speed is no big deal unless it spends hours.
     
  7. Stian Indal Haugseth

    Stian Indal Haugseth Well-Known Member

    Joined:
    Sep 11, 2015
    Messages:
    589
    Likes Received:
    100
    Awesome! Thanks.

    Good to hear :)

    I use the OctoPrint plugin to upload and it should be possible to do command line as well. I should even be able to get the Arduino GUI working by X11 forwarding to my Mac.
     
  8. Stian Indal Haugseth

    Stian Indal Haugseth Well-Known Member

    Joined:
    Sep 11, 2015
    Messages:
    589
    Likes Received:
    100
    @Alex9779 any reason you are not using Arduino 1.6.9?
     
  9. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
  10. Stian Indal Haugseth

    Stian Indal Haugseth Well-Known Member

    Joined:
    Sep 11, 2015
    Messages:
    589
    Likes Received:
    100
    Getting late and I get the following failure when compiling. I'm using exactly your setup @Alex9779. I have just replaced with arduino 1.6.9 for ARM.

    Code:
    $ DISPLAY=:1.0 ./arduino-1.6.9/arduino --verify --board marlin:avr:mega Marlin/Marlin.ino --pref build.path=./build
    Picked up JAVA_TOOL_OPTIONS:
    Loading configuration...
    
    (process:3762): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.
    Xlib:  extension "RANDR" missing on display ":1.0".
    Fontconfig warning: ignoring UTF-8: not a valid region tag
    Initializing packages...
    Preparing boards...
    Verifying...
    WARNING: Category '' in library Wire is not valid. Setting to 'Uncategorized'
    WARNING: Category '' in library Wire is not valid. Setting to 'Uncategorized'
    Warning: platform.txt from core 'Marlin AVR Boards' contains deprecated recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}", automatically converted to recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}". Consider upgrading this core.
    exec: "generate_version_header_for_marlin": executable file not found in $PATH
    Error compiling for board Arduino Mega or Mega 2560.
     
  11. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
    Oh yes I think that was the reason why :)
     
  12. Stian Indal Haugseth

    Stian Indal Haugseth Well-Known Member

    Joined:
    Sep 11, 2015
    Messages:
    589
    Likes Received:
    100
    Thought so o_O

    There is no older ARM version pre compiled :(

    Think I'll just do it on my Mac
     
  13. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
    Actually I copied some of the stuff the Marlins Devs do in the Travis. This was based on 1.6.4. So I first set it up on Jekins with 1.6.4.
    For the RCBugFix I changed something with the libraries, I can't remember why.
    I tried updating to latest sometime but had the same problems you had so I switched back to 1.6.4...
     
  14. Stian Indal Haugseth

    Stian Indal Haugseth Well-Known Member

    Joined:
    Sep 11, 2015
    Messages:
    589
    Likes Received:
    100
    @Bluemalu

    I saw the bug post that you are compiling Marlin with Arduino 1.6.9. You wouldn't have any info on your setup? Libs and stuff?
     
  15. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
    @Stian Indal Haugseth did you try with the default Arduino Mega 2560 board selected? I am using the special Marlin board because it contains the scripts for the automatic versioning...
     
  16. Stian Indal Haugseth

    Stian Indal Haugseth Well-Known Member

    Joined:
    Sep 11, 2015
    Messages:
    589
    Likes Received:
    100
    I got it compiled with default Mega board.

    I only get the following files. I believe I should use Marlin.ino.hex.

    $ ls -l Marlin/build/ -h
    total 2.5M
    -rw-r--r-- 1 pi pi 13 Jun 11 07:40 Marlin.ino.eep
    -rwxr-xr-x 1 pi pi 1.7M Jun 11 07:40 Marlin.ino.elf
    -rw-r--r-- 1 pi pi 354K Jun 11 07:40 Marlin.ino.hex
    -rw-r--r-- 1 pi pi 366K Jun 11 07:40 Marlin.ino.with_bootloader.hex
     
  17. Bluemalu

    Bluemalu Well-Known Member

    Joined:
    Mar 17, 2014
    Messages:
    97
    Likes Received:
    7
    Nothing special I'm afraid, only library I had to add was the lcd one, u8glib. The source code was from (Big Box 1.0 Dual with MBL)

    https://github.com/Alex9779/Marlin/tree/BigBox/Dual/Alex9779/RC

    However, this code has an issue with tool changes at present (11/06/16).

    Loaded up, hit compile, no errors. Uploaded .hex code through Octoprint firmware upgrade plug in.
     
  18. Bluemalu

    Bluemalu Well-Known Member

    Joined:
    Mar 17, 2014
    Messages:
    97
    Likes Received:
    7
    Marlin.ino.hex, NOT the one with the bootloader.
     
  19. Stian Indal Haugseth

    Stian Indal Haugseth Well-Known Member

    Joined:
    Sep 11, 2015
    Messages:
    589
    Likes Received:
    100
    Thanks!

    Which board have you chosen? The Arduino or Merlin Mega?
     
  20. Bluemalu

    Bluemalu Well-Known Member

    Joined:
    Mar 17, 2014
    Messages:
    97
    Likes Received:
    7
    Arduino Mega2560 board, I'll need to go out to my man cave to confirm.
     

Share This Page