Installing Marlin (CLI)
Before reading this article, you should have already read Installing Marlin with PlatformIO.
This article documents:
- Invoking PlatformIO from the command line
- Invoking Auto Build from the command line
This article is for advanced users only. Familiarity with the OS’s terminal/shell commands is assumed.
Python 2.7 is required for both Auto Build and PlatformIO. It is automatically installed when PlatformIO is installed. If your terminal/shell defaults to Python 3.x then the terminal/shell environment will have to be modified.
Install PlatformIO Core
Follow these instructions to install PlatformIO Core and its dependencies.
NOTE: If a PlatformIO plugin/extension has previously been installed then PlatformIO Core is already installed. You may still need to follow the Install PlatformIO Core Shell Commands section in the above link.
Find the environment for your board
This step is the same as in Installing Marlin with PlatformIO.
The PlatformIO environment needed for a motherboard is in the comments for the board in the pins.h file. In Marlin 2.0 it’s located in a subdirectory Marlin/src/pins/pins.h.
Example:
In Configuration.h
the board is defined by the line #define MOTHERBOARD BOARD_RAMPS_14_EFB
Search the pins.h file for RAMPS_14_EFB until you come to the following:
#elif MB(RAMPS_14_EEB)
#include "pins_RAMPS.h" // ATmega1280, ATmega2560 env:mega1280 env:mega2560
The first part of the comment lists the CPU(s) used in the board.
The env:xxxx section(s) are the PlatformIO environment(s) that are used for this board.
In this case mega2560 is the one used 99.9% of the time.
Run PlatformIO from the command line
-
Open a terminal/shell window.
-
Set the current working directory (CWD) to the folder that has the Marlin directory and the platformio.ini file in it.
-
Issue one of these commands (replace target_env with the environment selected above):
FUNCTION COMMAND PIO Build platformio run -e target_env PIO Clean platformio run --target clean -e target_env PIO Upload platformio run --target upload -e target_env PIO Traceback platformio run --target upload -e target_env PIO Program platformio run --target program -e target_env PIO Test platformio test upload -e target_env PIO Remote platformio remote run --target upload -e target_env PIO Debug platformio debug -e target_env
Run Auto Build from the command line
The Get the correct environment for the selected board step is not needed. Auto Build will automatically do this.
-
Open a terminal/shell window.
-
Set the current working directory (CWD) to the folder that has the Marlin directory and the platformio.ini file in it.
-
Issue one of these commands
FUNCTION COMMAND PIO Build python buildroot/share/atom/auto_build.py build PIO Clean python buildroot/share/atom/auto_build.py clean PIO Upload python buildroot/share/atom/auto_build.py upload PIO Traceback python buildroot/share/atom/auto_build.py traceback PIO Program python buildroot/share/atom/auto_build.py program PIO Test python buildroot/share/atom/auto_build.py test PIO Remote python buildroot/share/atom/auto_build.py remote PIO Debug python buildroot/share/atom/auto_build.py debug