-
Notifications
You must be signed in to change notification settings - Fork 10
PlatformIO Installation
In order to be able to flash a PlatformIO project, you will need to install PlatformIO-Core
. PlatformIO-Core
is a lightweight command line tool to work with PlatformIO projects. It is the only way to flash Marlin on more modern 32bits boards.
Starting with version 1.0.0
of the plugin, there is now a way to automatically install PlatformIO from the plugin settings.
This is the recommended way of installing PlatformIO for the plugin.
To this, simply go in the Settings (little wrench icon a the top of OctpPrint). Then go into the Marlin Flasher settings, select PlatformIO and then click the "Download and install" button.
Wait until the installation complete. Once it's installed, you can closed the popup with the installation log. The path to PlatformIO had been automatically set, you can now save the settings.
If you are on linux (which includes OctoPi), you may need additionnal steps for PlatformIO to work. See the Extra steps for linux section at the end of this page.
PlatformIO is now installed and ready to use.
If you want to have more control on how PlatformIO will be installed, you can install it manually. This is not the recommended way of installing PlatformIO.
I'd recommend to install PlatformIO-Core in its own python 3 virtualenv, this is not required. I usually install such software in the /opt
directory. Just don't install it in the same virtualenv as OctoPrint uses, they have some conflicting dependecies.
sudo su
apt update
apt install python3 python3-pip python3-virtualenv
cd /opt
virtualenv -p python3 pio
cd pio
. ./bin/activate
pip3 install platformio
Once this is done, PlatformIO should be installed, in order to know where you can simply type
which pio
You need to know this in order to configure the plugin.
And in order to exit the virtualenv you installed it in :
deactivate
As for linux, I'd recommend you to install it in it's own python virtualenv. Just don't install it in the same virtualenv as OctoPrint.
#As Administrator using cmd.exe
py -3 -m pip install virtualenv
cd C:\Where\You\Want\To\Install\It
py -3 -m virtualenv -p python3 pio
cd pio
.\Scripts\activate
pip3 install platformio
Once this is done, PlatformIO should be installed, in order to know where you can simply type
where pio
You need to know this in order to configure the plugin.
And in order to exit the virtualenv you installed it in :
deactivate
If you are running Linux (including OctoPi) you will need to perform additional steps in order for PlatformIO to work properly.
On Linux, you will need to add some custom udev rules for PlatformIO and permissions for your user.
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
sudo systemctl restart udev
sudo usermod -a -G dialout $USER
sudo usermod -a -G plugdev $USER
Once it's done you may have to restart the machine.
Some boards need to use the mbed
upload protocol, ie: BigTreeTech SKR 1.3. Which basically means your board appears as a removable drive.
On Windows hosts this will work perfectly fine out of the box as the board will be automatically mounted and assigned a partition letter.
On Linux (including Raspberry Pi's), things can be a little bit more complex, as the removable disks are not mounted automatically without some configuration.
The way I found to be the easiest to set up is to install and enable udevil
and allow the user to mount/unmount pluggable devices.
sudo adduser pi plugdev
sudo apt update
sudo apt install udevil
sudo systemctl enable devmon@pi
sudo systemctl start devmon@pi
On a Raspberry Pi running OctoPi, you can use these commands as they are. Otherwise, be sure to type in the name of the user that runs OctoPrint instead of pi
Unit file [email protected] does not exist.
Due to a bug in the package [email protected]
, the service file is not created at the right place. To fix this, you can do :
sudo cp /usr/lib/arm-linux-gnueabihf/systemd/system/devmon\@.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable devmon@pi
sudo systemctl start devmon@pi