Software Development Tools and Platforms

 General audience classification icon  General audience classification icon  General audience classification icon
Software development in the bare metal model requires a development toolchain installed on the developer's computer. The vendor of the MCU usually provides a set of tools. This set frequently includes a dedicated compiler, linker, library management tools, configuration tools, debugger software, etc. These tools are command lines in most cases. Using a GCC [1] C/C++ compiler is also quite common. On top of it, a GUI with a rich UI interface is built to simplify software development. Some vendors provide their own GUIs, such as STMicroelectronics' STM32CubeIDE (image 1). In contrast, others use already available universal code editing solutions and integrate with them, e.g. in the form of plugins or extensions.

Vendors barely develop their own GUI solutions from scratch; instead, they adapt existing open-source ones, e.g. STM32CubeIDE is built on top of the Eclipse IDE [2].

Detailed instructions on the tools necessary to set the development environment, e.g., the STM32 WB chip family, are presented on the STM's YouTube channel [3].

 Eclipse for STM32 developers
Figure 1: STM32CubeIDE: Eclipse for STM32 developers

Because documentation for the command line tools composing SDK is usually available, there are also universal solutions that enable developers to use a single GUI environment for various tasks and microcontrollers, switching among them quickly, such as Visual Studio Code (figure 2). Each platform requires its dedicated toolchain, anyway, and integration with universal code editors such as the aforementioned VS Code may be tricky. Luckily, there are tools to help with the automated installation of all required components, such as PlatformIO [4]), which we describe below.

 Universal development environment
Figure 2: VS Code: a universal development environment

As the Arduino programming framework became a cross-platform standard, vendors provided low-level libraries implementing standard functionalities such as embedded communication protocols (Serial, SPI, I2C, 1Wire) and networking communication. Arduino, a manufacturer of popular development boards, provides an IDE (figure 3: Arduino IDE [5]) that is intended to be an entry-level development environment. It can be extended beyond genuine Arduino boards, e.g. with the Espressif toolchain for ESP8266 and ESP32. This software, however, is very limited in features and is suitable only for simple projects.

 Arduino IDE: an entry-level IDE for beginners
Figure 3: Arduino IDE: an entry-level IDE for beginners
We suggest starting with VS Code and PlatformIO over Arduino IDE, even if you're a beginner.

Developers Middleware and Support Tools

Several additional tools usually come with the development toolchain provided by the hardware vendors. They include programmers (flashers, injecting firmware into the IoT device), configuration tools, power consumption calculators, etc. Installation is not always straightforward, and updating is tricky. Developers who use a variety of platforms (MCUs) struggle with instant updates and browsing the web for tools, samples and libraries. Moreover, handling libraries they use for development is time-consuming and involves instant monitoring of changes, manual copy-paste operations on files, etc. Moreover, it has to be done individually for every project.

PlatformIO

The solution is a developer's middleware that integrates with selected IDE and helps to install, configure and maintain toolchains for hardware, software development libraries, and also contains a set of additional tools (e.g. serial port monitor, JTAG debugger, code repository integration, collaboration tools, remote development, etc.). As mentioned above, one example of a handy middleware for IoT and embedded development is PlatformIO. It is a command-line toolset that provides a whole ecosystem for virtually any hardware platform; it still uses the vendor's proprietary toolchains. It perfectly integrates with Visual Studio Code (among others) via VS Code's extension (plugin) systems. VS Code also works as a GUI for PlatformIO. In the following figures, we present its look and UI when integrated with Visual Studio Code (figures 4, 5 and 6).

 VSCode with PlatformIO: starting page
Figure 4: VSCode with PlatformIO: starting page
 VSCode with PlatformIO: library management
Figure 5: VSCode with PlatformIO: library management
 VSCode with PlatformIO: toolchain management
Figure 6: VSCode with PlatformIO: toolchain management

A PlatformIO-enabled IoT project is a set of files with a platformio.ini file in the root folder and main.cpp in the ./src/ subfolder (as, e.g. in the figure 4, project folder tree is to the left)). The platformio.ini file describes all technical parts of the project: the hardware platform, the method of uploading the firmware (usually via a serial port), software libraries that are included in the code and should be automatically pulled from the libraries repository during compilation and many other options [6]. Sample platformio.ini file is presented in the code below:

[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
upload_port = /dev/ttyUSB0
upload_speed = 9600
monitor_port = /dev/ttyUSB0
lib_deps = 
	arduino-libraries/LiquidCrystal@^1.0.7
	adafruit/Adafruit Unified Sensor@^1.1.7
	adafruit/DHT sensor library@^1.4.4

This code configures the ESP8266 (Espressif) hardware project, with specific developer board D1 Mini and programming done in the “Arduino” framework development model.
Communication with the IoT device is via serial port (here /dev/ttyUSB0 for Linux or, e.g. COM3 for Windows) and uses the same port for monitoring (serial port monitor for tracing messages from the MCU and code).
It uses three libraries registered in the library registry for PlatformIO: LiquidCrystal, Adafruit Unified Sensor and DHT sensor library, with explicit versions. PlatformIO's Library Manager automatically checks for updates and proposes to update libraries to the latest available if a version is not explicitly stated. The Library Registry in the PlatformIO is a repository of the Gitlab project, available online [7]. Libraries are currently held per project instead of shared between projects.
At the start of the PlatformIO GUI and then periodically, it checks for PlatformIO updates and development toolchain updates, proposing to update them when a new version is available.

en/iot-open/introductiontoembeddedprogramming2/developmentplatforms.txt · Last modified: 2024/05/24 09:52 by pczekalski
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0