2

IoT for web developers: From zero to firmware

 1 year ago
source link: https://devm.io/iot/iot-firmware-platformio
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Using PlatformIO in the development environment

IoT for Web Developers: From Zero to Firmware

17. Nov 2022


Andreas Schmidt walks us through the first steps of using PlatformIO, an open source ecosystem for development on the Internet of Things, from zero to running firmware.

Software and firmware development for embedded devices – and in our case, constrained devices with low performance – can be very complex. We can especially see this in C/C++ where developers are confronted with challenges at the bottom of the development stack. Cross compilers and linkers, libraries, include paths and build/flash tools need to be selected and installed, often depending on the underlying hardware. A cross-toolchain for an Arduino with Atmel AVR processor is not the same as the one for ARM Cortex M. Wouldn’t it be great to have a tool that takes care of this?

PlatformIO does exactly this work for the developer; It currently knows 24 development platforms for embedded (e.g. Atmel AVR, Espressif8266,…), 15 embedded frameworks (e.g. Arduino, ARM mbed,…), over 470 boards (“Arduino UNO”, “NodeMCU ESP8266”,…) and thousands of libraries and example. That should make for an easy start!

INTEGRATED INTO THE DEVELOPMENT ENVIRONMENT

PlatformIO (PIO) can be installed and operated in different flavors. On the one hand, PIO Core allows you to do everything from the command line. This is useful for developers who feel comfortable on the shell level. It is also very handy for use with cloud IDEs.

PIO comes with integrations for various IDEs, and the rest of the series uses Visual Studio Code from Microsoft. It is very popular in the developer community due to its open architecture regarding extensions. A click on the icon for extensions in the left menu line and entering “platformio” in the search field leads with the first hit to the official PIO-VS code extension, after a click on “Install”, it is available.

Fig. 1

Fig. 1: Installation of PIO plugins within VSCodet

The core of PlatformIO is based on Python 2.7, which is part of the standard repertoire under MacOS and Linux. Windows users may need to reinstall Python, but this is automated by the PIO installer and well documented on the PlatformIO website. Furthermore, the installation of C-compilers like clang under MacOS may be necessary.

After starting VSCode you will be welcomed with the PIO Home Screen, at least as long as you have selected the checkmark “Show at startup” (Figure 2).

Fig. 2

Fig. 2: All Functions within PlatformIO Homescreen

The home screen combines all the functionalities offered by PlatformIO Backend: Manage your account data (optional), search for boards, libraries, platforms, search for connected devices and manage projects.

BOARDS & FRAMEWORKS

For our training workshops as well as for the following examples of this series, we will use the board “NodeMCU 1.0” with an ESP8266 processor. The ESP8266 is a very cheap WiFi-SoC from Chinese company Espressif Systems, which support the espressif-own embedded framework. It also has a port of the Arduino framework, so most of the “sketches” known from Arduino also work with this board. Communication is possible with its built-in WiFi connectivity, IoT solutions with MQTT, CoAP or HTTP.

Fig. 3

Fig. 3: Finding one’s own board

After entering the board name you can quickly find your own board. The table shows the supported platforms, frameworks and some technical data of the board. Each board has a board ID, which is visible on the “+” icon after opening the entry. This board ID becomes...


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK