This post is part of a series:
Getting an Arduino based project (or other embedded platform) to compile and upload can be a pain. Making sure all the libraries are installed in the correct locations and of the correct versions can be tricky and time-consuming.
I’m sure many developers will agree that the tools we use for embedded development are generally not as good as those used for web application development.
The Arduino team have done a good job with their IDE to try and make the embedded development tool-chain setup as easy as possible. However, I still find library management a cause of frustration. Especially since I move between computers and OSes frequently.
Recently I have been using PlatformIO and am rather impressed with the ease of setup, speed of compilation, uploading (auto port detection), and most importantly an excellent library manager.
PlatformIO is an open-source ecosystem for IoT development.
Cross-platform build system, IDE integration and continuous testing. Arduino, Espressif, ARM and mbed compatible.
This post got quite long, therefore, It’s been split into three posts:
- PlatfomIO overview & compiling + uploading locally and on a Raspberry Pi
- Continuous testing and auto release binary generation using PlatformIO & TravisCI
- Continuous Deployment (OTA to ESP8266)
Here are some things that have impressed me about PlatformIO (pio) after using it for a couple of weeks:
- Fully open-source with active and friendly dev community.
- Easy to install - Pure python based installed using pip
- Tool-chains are auto installed on first compile / upload e.g.
- If trying to upload to Arduino avrdude will automatically be installed
- If trying to compile an ESP8266 project the ESP toolchain will be installed
- Cross-platform (Linux, Windows and mac all work the same), this will make support much easier
- Supports all the main embedded platforms
- atmelavr (Arduino), espressif (ESP8266), ststm32 (ARM etc.)
- Command line and IDE
- At work I use pio via Atom IDE on Ubuntu
- At home, I use a Chromebook with Caret IDE and interact with pio via command-line
- When developing directly on an emonPi / RaspberryPi pio command-line works great - Yes, that’s right pio works on a RaspberryPi to compile and upload code directly!
- Excellent library manager
- Libraries can be searched and reviewed using command-line or web 2.0 manager
- Required libraries can be specified in the
platformio.ini
file and if not present install is prompted upon compilation
- Specific library version (as defined in
library.json
(emonLib example)) or git commit SHA
- Fast compilation & pain-free uploading
- PlatformIO’s compiler is the fastest in the business
- USB / Serial ports auto detected
- Since the emonPi has been added as a custom board PlatformIO can even upload direct to emonPi via RaspberryPi GPIO and trigger GPIO AVR reset, not more hacked avrdude.
- Easy integration with continuous testing & deployment
- Integration with TravisCI to enable compilation, code testing and binary (.hex / .bin) release generation in the cloud.
- emonPi and emonTx git repos are now enabled for continous-testing and auto binary generation on release tag…this is a step change in embedded development.
Read on →