Embedded Development with Platform IO
Updated: 19 March 2024
Prerequisite that you have Python 3.0 installed
PlatformIO provides a bit of a better workflow and development experience for embedded development. Creating applications can be done using the CLI or the VSCode Extension
Platform IO applications can be created using the PlatformIO VSCode Extension using the PlatformIO: PlatformIO Home
command in VSCode
Once the application has been created you will have a nice way to develop embedded applications
The main thing that PlatformIO provides us in addition to the workflow is the ability to manage dependencies a little bit better as well as split code into a few different files
As far as I care, the dependency management is the main reason to use PlatformIO
Dependency management uses the platformio.ini
file, a simple example of this can be seen below:
1; PlatformIO Project Configuration File2;3; Build options: build flags, source filter4; Upload options: custom upload port, speed and extra flags5; Library options: dependencies, extra library storages6; Advanced options: extra scripting7;8; Please visit documentation for the other options and examples9; https://docs.platformio.org/page/projectconf.html10
11[env:nodemcuv2]12platform = espressif826613board = nodemcuv214framework = arduino15lib_deps =16 adafruit/Adafruit GFX Library@^1.11.917 adafruit/Adafruit SSD1306@^2.5.9
Adding dependencies can be done using the PlatformIO Registry using the relevant command which will create an entry in the platformio.ini
file
You can install this using the PlatformIO CLI
which is also included in the VSCode Extension via the PlatformIO: Open PlatformIO Core CLI
An example command for adding one of the libraries I have in the above example is:
1pio pkg install --library "adafruit/Adafruit GFX Library@^1.11.9"