PlatformIO 遠端開發系統建置
Foreword
This development system enables PlatformIO to build the image on the remote computer and run the flashing process remotely. This is especially useful when you want to work from home or you don’t want to run back and forth between the lab and the greenhouse dozen times a day. In my experiemnt, the ESP32 board was connected to a Raspberry Pi 4 SBC in the greenhouse. This development workflow saved me plenty of time as I was able to manage everthing on my cute laptop.
System Requirements
- OS: Ubuntu Server 20.04
- Internet connectivity: Netplan setup
- Packages status: APT (Updated & Upgraded)
Steps
Install PlatformIO by the official installation guide and login pio
Refer to this Installation docs
Install some dependencies
1 | sudo apt-get install build-essential libssl-dev libffi-dev python3-dev rustc |
Enter the command to build necessary packages
1 | pio remote |
Link some executables to system path
1 | ln -s ~/.platformio/penv/bin/platformio /usr/local/bin/platformio |
Create systemd file to autostart the service
1 | sudo nano /etc/systemd/system/pio-remote.service |
Add the content below
1 | [Unit] |
Now start the pio-remote service using systemd agent
1 | sudo systemctl start pio-remote |
Check the service status
1 | sudo systemctl status pio-remote |
Normally should return "Successfully authorized"
Now enable the systemd service
1 | sudo systemctl enable pio-remote |
Now reboot the system and check the service status.
References
PlatformIO Docs - Remote Development
PlatformIO Docs - PlatformIO Core (CLI)