PlatformIO Core 6.0 🚀
A professional collaborative platform for declarative, safety-critical and test-driven embedded development
We are happy to announce the major release of PlatformIO Core with unified Package Management CLI and a new generation of PlatformIO Unit Testing solution that brings advanced instruments and new opportunities for test-driven embedded development.
Table of Contents
What is new
In this section, we are going to highlight the most important changes and features introduced in PlatformIO Core 6.0. Please visit PlatformIO Core 6.0 Release Notes for more detailed information.
Package Management
The PlatformIO Core 6.0 brings a powerful solution to manage libraries, platforms and tools using the unified Package Management CLI:
- pio pkg install - install the project dependencies or custom packages
- pio pkg list - list installed packages
- pio pkg outdated - check for project outdated packages
- pio pkg search - search for packages
- pio pkg show - show package information
- pio pkg uninstall uninstall the project dependencies or custom packages
- pio pkg update - update the project dependencies or custom packages.
There are no more global packages that could lead to potential issues. The new package management solution allows developers to use a modern declarative approach for safety-critical embedded development. Using the Semantic Version Requirements guarantees the full project reproducibility on any supported host machine for decades.
The new Package Management CLI operates in accordance with the active (working) project. The pio pkg install command will install all required project dependencies. The pio pkg list command allows listing not only dependent libraries but also development platforms and their packages.
The notable addition is the pio pkg outdated command. It allows developers to check for outdated project packages and list version information for all dependencies. There are three color legends to help developers easily identify which updates are backward-incompatible.
Run package command
PlatformIO Registry contains a rich set of popular toolchains and other useful tools. The pio pkg exec command allows developers to run an arbitrary command from the specified package. If the package requirement is specified using the pio pkg exec --package
option, PlatformIO will ensure that the package is installed before running any command.
Practical use cases include running debugging servers, uploaders or special tools from a toolchain. A few examples of how to leverage the new pio pkg exec command:
# Ensure JLink tool is installed and start GDB server
> pio pkg exec --package=tool-jlink -- JLinkGDBServer -singlerun -if JTAG -select USB -jtagconf -1,-1 -device EFR32BG22CxxxF512 -port 2331
# Run Espressif SoC serial bootloader utility and erase a flash from the target device
> pio pkg exec -- esptool.py erase_flash
# Disassembly AVR ELF file
> pio pkg exec -- avr-objdump -d -m avr2 .pio/build/uno/firmware.elf
Virtual symbolic links
The most requested feature from the library maintainers was the ability to link the existing package with the project without hard copying (duplicating). As a workaround, developers used a Unix-native symlink solution and hence it was not possible to declare a symlinked dependency in the “platformio.ini” (Project Configuration File).
The PlatformIO 6.0 introduces cross-platform virtual symbolic links without any dependencies on the host OS. PlatformIO symlink://
resources do not require any specific OS permissions. They are portable between different host machines.
See Package Specifications for the “Local Folder”.
Unit Testing
It’s been six years since we added support for unit testing and Unity was the only available testing framework. We didn’t expect that the PlatformIO Unit Testing solution will gain broad popularity, especially when it comes to using it on native (host) machines.
So, the time has come to refresh our view on PlatformIO Unit Testing with taking into account your feedback and feature requests.
Test-driven development
The PlatformIO Core 6.0 introduces an absolutely new workflow for test-driven development in the embedded systems industry. Thanks to the rich set of supported Unit Testing Frameworks and the ability to organize tests in groups using the Test Hierarchy, developers can create hybrid projects and benefit from multiple testing frameworks depending on the project requirements simultaneously. See a simple example of the hybrid configuration:
[env:native]
platform = native
test_framework = googletest
test_filter =
common/*
native/*
[env:embedded]
platform = ...
framework = ...
test_framework = unity
test_filter =
common/*
embedded/*
Use more advanced C++ testing frameworks with Mocking support such as GoogleTest in pair with the Native development platform to run desktop tests on the host machine and a lightweight framework, such as Unity, for running tests on the target embedded device with constrained resources.
Hardware-less development
It’s hard to imagine today a next-gen project development workflow that does not benefit from Continuous Integration systems. PlatformIO already provides multiple solutions to improve code quality including Static Code Analysis. In addition to the testing frameworks that allow developers to mock objects and simulate the behavior of real objects, the PlatformIO Core 6.0 adds support for the Simulators.
The combination of simulation tools and testing frameworks allow developers to simulate hardware systems and run unit tests in virtual environments. Simulators can significantly accelerate project development, especially when used in pair with Continuous Integration.
Integration of any simulator tool to the PlatformIO Unit Testing is very simple and does not require any extra software or code writing. Please take a look at the example below how easy it is to integrate the Renode simulation framework:
[env:hifive1-revb]
platform = sifive
framework = zephyr
board = hifive1-revb
platform_packages =
platformio/tool-renode
test_testing_command =
${platformio.packages_dir}/tool-renode/renode
--disable-xwt
-e include @scripts/single-node/sifive_fe310.resc
-e showAnalyzer uart1
-e sysbus LoadELF @${platformio.build_dir}/${this.__env__}/firmware.elf
-e start
Migration
PlatformIO Core 6.0 is fully backward compatible with PlatformIO 5.0 projects.
See migration guide from 5.x to 6.0 for the further details.
Upgrade
- PlatformIO IDE: Left Sidebar > PlatformIO (icon) > Quick Access > Upgrade PlatformIO Core
- Terminal: Please run
pio upgrade
command in terminal.
Stay in touch with us
Stay tuned to this blog or follow us on LinkedIn and Twitter @PlatformIO_Org to keep up to date with the latest news, articles and tips!