Welcome! Log In Create A New Profile

Advanced

Can I build Marlin with PlatformIO CLI (i.e. without VSCode) ?

Posted by Tornado-Markus 
Can I build Marlin with PlatformIO CLI (i.e. without VSCode) ?
May 20, 2021 10:53AM
Hi, I've just learned here that I need to switch from Arduino IDE (which I am familiar with) to VSCode / PlatformIO (which I'm both new to).

For Linux users, VSCode is hard to set up, e.g. it does not find the PlatformIO IDE extension in the marketplace. But I think there is a solution: As far as I understand, PlatformIO (core) has a CLI (command line interface), and Linux users usually are not afraid of the command line. :-)

I'm not experienced enough in microcontroller programming to contribute source code anyway, so the editing functions of VSCode are not important in my case. For Configuration.h, any text editor will do. :-)

As I wrote above, I'm also new to PlatformIO, and I could not figure out how I start the build process. Can somebody help me ?

Thanks.
Re: Can I build Marlin with PlatformIO CLI (i.e. without VSCode) ?
May 20, 2021 10:04PM
"For Linux users, VSCode is hard to set up, e.g. it does not find the PlatformIO IDE extension in the marketplace. "

This is not correct.

I use PlatformIO in vscode under Ubuntu all the time. As do many many others.

In vscode you click on the build icon, on the bottom task bar

In command line you run "pio run"
Re: Can I build Marlin with PlatformIO CLI (i.e. without VSCode) ?
May 21, 2021 03:37AM
In that case, Ubuntu seems to have a customized or extended version of vscode. The version you get on Arch Linux (and any Arch derivative, e.g. Manjaro) does not find the extension. So I can not click on the build icon.

As I wrote, I'm also new to platformio. And I've tried a few commands like
pio run --target build
with some variations. None of them worked, that's why I've asked here.

If you click on "build" in your working vscode installation, does it say what it runs ? If so, could you please paste these commands here in this thread ? I'm mostly interested in build and (if here is one) clean Edit: and upload.

Edited 1 time(s). Last edit at 05/21/2021 03:47AM by Tornado-Markus.
Re: Can I build Marlin with PlatformIO CLI (i.e. without VSCode) ?
May 21, 2021 11:40PM
it runs "pio run" where pio is in path /home/{username}/.platformio/penv/bin/pio
This must be executed in the Marlin directory with the platfomio.ini file.

It uses the default_envs in platformio.ini to set the build environment.
Re: Can I build Marlin with PlatformIO CLI (i.e. without VSCode) ?
June 16, 2023 09:17AM
Quote
Tornado-Markus
For Linux users, VSCode is hard to set up, e.g. it does not find the PlatformIO IDE extension in the marketplace

Correct, classic Linux suckage. Don't get me wrong, I use Linux 99.9% of the time, but versioning and compatibility often sucks, especially when documentation is poor or missing.
In this case Platform IO is only compatible with a specific version of VSCode, i run version 1.41.1.

To get this to work on Arch/Manjaro you'll need the 'downgrade' and 'electron6-bin' package (available from the AUR). Then run:
sudo downgrade code

choose 1.41.1-1 from the list. If all went well you should be able to see and install PlatformIO from the marketplace.
Re: Can I build Marlin with PlatformIO CLI (i.e. without VSCode) ?
June 21, 2023 09:44PM
The CLI command I use is:
platformio run -e environment_name

Where environment_name comes from the file pins.h

EXAMPLE:

#define MOTHERBOARD BOARD_MKS_SBASE

Search pins.h for MKS_SBASE and get the following hit:
#elif MB(MKS_SBASE)
  #include "lpc1768/pins_MKS_SBASE.h"           // LPC1768                                env:LPC1768

The final command is:
platformio run -e LPC1768
Sorry, only registered users may post in this forum.

Click here to login