The PlatformIO extension can be installed and used via VSCode, these notes cover using PIO CLI utility.
My Ender-5 Pro is connected to a RPi running Octoprint - since the serial connection is already in-place, I like to do firmware upgrades via that same connection. Make sure Octoprint's serial connect to the printer is in the Disconnect state in order to utilize the connection for the upgrade.
NOTE: These steps should be run as an unprivileged user (unless noted otherwise)
In the home directory of your unprivileged user, create a new Python venv to install PlatformIO
python3 -m venv ./platformio && \
cd ./platformio
Activate the env
source bin/activate
Upgrade pip and install PlatformIO (then exit the venv)
pip install --upgrade pip && \
pip install -U platformio && \
deactivate
Create a symbolic link to the PIO installation so it can be used system-wide -AND- without being activated in the venv (you'll need to use sudo to create this link)
sudo ln -s /home/compiler/platformio/bin/platformio /usr/bin/platformio
Add the user you'll run the compiler with to the dialout group to ensure they can access the serial connection to the printer
sudo usermod -a -G dialout ross
Retrieve the Marlin source code and Configuration files from their respective GitHub repositories
cd ~/ && \
git clone https://github.com/MarlinFirmware/Marlin.git && \
git clone https://github.com/MarlinFirmware/Configurations.git
Move into the Configurations directory and checkout the Marlin version you want.
cd ~/Configurations && \
git checkout 2.1.2.5
Move into the Marlin directory (this is the Marlin source code repo) and checkout the Marlin version you want.
cd ~/Marlin && \
git checkout 2.1.2.5
The remainder of the steps are performed from within ~/Marlin/.
Copy the correct Ender-5 Pro version configuration files from the Configurations repo directory into the nested Marlin directory (~/Marlin/Marlin/)
cp -r ../Configurations/config/examples/Creality/Ender-5\ Pro/CrealityV422/* Marlin/
Modify the platformio.ini file to indicate the board the firmware needs to be built for
default_envs = STM32F103RE_creality
Build Marlin and upload the compiled firmware to the printer
platformio run -t upload