Using platformio to flash firmware from RPi

Discussion in 'Guides, Mods, and Upgrades' started by nemith, Mar 11, 2016.

  1. nemith

    nemith Member

    Joined:
    Mar 9, 2016
    Messages:
    16
    Likes Received:
    14
    Platformio is a command line utility that can build and flash arduino source code. It works well with Marlin and the BigBox. In fact I don't even use the Arduino IDE at all. I use VIM (any text editor will work) to edit the Configuration.h and platformio to compile and upload it.

    Find out more about platformio here: http://platformio.org/

    Log into your RPi via ssh and issue the following commands

    # Install dependencies
    sudo apt-get install libmpc-dev libelf1 libftdi1
    # Install platformio
    sudo pip install platformio


    Next checkout a fresh copy of the BigBox Marlin firmware, get the one for your printer (Dual or Pro). I use git instead of downloading the zip as I keep my changes in git as well. It doesn't matter how you get it (wget + unzip or git directly)

    git clone https://github.com/joshuarowley42/BigBox-Pro-Marlin

    Now we need to setup platformio. Create a file called platformio.ini in the BigBox-Pro-Marlin directory and put the following into it. (You can also download it directly here https://raw.githubusercontent.com/nemith/Marlin-BigBoxPro/master/platformio.ini)

    [platformio]
    src_dir = Marlin
    lib_dir = lib

    [env:bigbox]
    platform = atmelavr
    framework = arduino
    board = megaatmega2560

    upload_port=/dev/ttyACM0

    lib_install=7


    Now you can just run the follow command to build the firmware:

    pio run

    And to upload the firmware

    pio run -t upload

    The first time you run pio it may ask you to install the avr tools and other dependencies. This should also automaticall download the u8glib libraries for you as well! No need to pull out the laptop and fish around for the USB cable!


    Note: If you learn git it will become very easily to suck in new updates from e3d on top of your modifications. https://try.github.io/levels/1/challenges/1
     
  2. UlrichKliegis

    UlrichKliegis Well-Known Member

    Joined:
    Sep 5, 2015
    Messages:
    187
    Likes Received:
    47
    Very good, thanks!
     
  3. Greg Holloway

    Greg Holloway Administrator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    565
    Likes Received:
    397
  4. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,405
    Likes Received:
    731
    Nice thanks for the guide. I tried the same a few days ago but didn't succeed. At the moment is just push the firmware with plain avrdude to the box. Have a share on the RPi to put the Inage to and a script pushing that file to the box. Runs well too and you do not have to compile on the RPi...
     
  5. nemith

    nemith Member

    Joined:
    Mar 9, 2016
    Messages:
    16
    Likes Received:
    14
    Yeah. I am using pio for compiling on my pc as well. Being lazy checking out my repo from github recompiling on the RPi was the simplest. I want to just have avrdude on the RPi and setup some ssh automation to "push" the firmnware from my PC, but for now installing full pio on both systems is the fastest.


    Yeah. Writing a plugin to just do a flash wouldn't be that hard. If i get bored I may give it a shot.
     
  6. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,405
    Likes Received:
    731
  7. Paul De Smet

    Paul De Smet Member

    Joined:
    Mar 28, 2016
    Messages:
    12
    Likes Received:
    0
     
  8. Paul De Smet

    Paul De Smet Member

    Joined:
    Mar 28, 2016
    Messages:
    12
    Likes Received:
    0
    I used your instructions, but at the last command pio run -t upload i got an error :

    System wide configuration file is "home/pi/.avrduderc"
    User configuration file does not exist or is not a regular file, skipping
     
  9. nemith

    nemith Member

    Joined:
    Mar 9, 2016
    Messages:
    16
    Likes Received:
    14
    That is more of a warning. Shouldn't matter.
     

Share This Page