Installing Marlin (VSCode)
Before reading this article, you should have already read Installing Marlin with PlatformIO.
PlatformIO with VSCode
PlatformIO turns VSCode into a complete IDE for compiling and developing Marlin.
1. Install VSCode
Pointers to setup instructions for the supported platforms are near the top of Setting up Visual Studio Code.
2. Install the PlatformIO IDE
PlatformIO IDE for VSCode Get PlatformIO IDE
3. Clone Git Project
Switch to new PlatformIO View in Activity Bar (left side bar), then Quick Access > Clone Git Project …
4. Select Repository Branch
The name of the branch you are working in is indicated in the bottom left corner in the blue bar. Click on it to reveal a list of branches you can work in or create your own.
5. Select Environment - or - use Auto Build Marlin
Auto Build Marlin automatically selects the correct environment for your
To manually set the environment for your board:
Open the file
platformio.ini and change
default_envs to the chip that your board uses. Look through this file for your chip’s environment name. For example, the environment name for the LPC1768 chip appears as
[env:LPC1768]. Omit the outer wrapper:
When you click the PlatformIO button, you will see the PROJECT TASKS including Build and Upload. These buttons will build and upload your default environment.
If you’ve installed Auto Build Marlin, you will see Auto Build Options buttons to the right of the PROJECT TASKS bar.
If you don’t want to set
default_envs, select the environment for your board from the PlatformIO Project Tasks list.
Identifying the correct environment for the selected board
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.
The Configuration.h file says
#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:megaatmega1280 env:megaatmega2560'
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 megaatmega2560 is the one used 99.9% of the time.
6. Initiate Build, Clean or Upload task
Initiating a task is done by clicking an icon towards the left side of the blue Status Bar at the very bottom of the window.
Working with the build window is a little bit better than shown in Installing Marlin with PlatformIO.
- It can be re-sized.
- It can be scrolled via the mouse scroll wheel or with the scroll bar.
- Text can be copied by
- highlighting it via the mouse
- moving the mouse insert point over the selected text
- pressing CTRL C on the keyboard or right clicking with the mouse
For platforms that use a
firmware.bin file such as the LPC1768 and LPC1769
- Transfer the automatically generated
firmware.binover to the SD card to be used