PlatformIO is a cross-platform CLI tool and IDE extension (primarily for Visual Studio Code) that allows you to build and upload firmware to embedded devices. Unlike other tools such as Arduino, mbed or Zephyr, it is purely a build tool and does not provide it’s own API (framework) that you can call when writing firmware. Instead, it supports a number of frameworks including Arduino, mbed and Zephyr. It is designed to automatically pull down, install and run the toolchains/compilers required to compile your firmware for the target architecture so that you don’t have to manage these yourself.
PlatformIO Core is the command-line tool that contains most of PlatformIO’s core logic (the IDE makes calls to this). PlatformIO IDE is an extension to Visual Studio Code which provides GUI access to the functions provided by PlatformIO Core, as well as the usual text editing and syntax highlighting.
board: A physical PCB containing a microcontroller that code can be built for and programmed.
platform: Examples of platforms include
packages. Default install directory for platforms is
package: A package is a tool of framework that can be used when compiling one or more
platforms. Default install directory for packages is
framework: A firmware “framework” providing an API to call from your application to interface with hardware peripherals and device drivers. Available options include
> pip install -U platformio
Library Dependency Finder (LDF)
For more info on the LDF, see https://docs.platformio.org/en/latest/librarymanager/ldf.html.
Local libraries can be stored in the
How To Create A PlatformIO Project
Create a new project in the current directory:
pio project init --board uno
Build the project:
The PlatformIO Config File
Data not specific to any one environment goes under the
[platformio] section in the
Want to use a private package for a particular project? The good news is that PlatformIO supports SSH-style Git URLs and will use your default SSH key to attempt to
git clone the package. You can specify a URL to a private package repo in
platformio.ini with the following line:
platform_packages = framework-arduino-samd-privatepackage @ firstname.lastname@example.org:my-company-name/my-private-repo.git
A specific branch or tag can be specified by appending a
# and then the name of the branch/tag (note that
# denotes the start of a comment in an
INI file, but this tag name is processed by the parser…it feels a little strange to be doing this):
platform_packages = framework-arduino-samd-privatepackage @ email@example.com:my-company-name/my-private-repo.git#my-tag-or-branch-name
- integrated development environments
- PlatformIO Core
- PlatformIO IDE
- Library Dependency Finder