Development Environment¶
Description¶
A STM32CubeIDE project is provided for each application in order to simplify integration. When installing STM32CubeIDE, the following components are installed:
A full-fledged integrated development environment (IDE) used to go through every step of the development process, from writing source code to running it on a target.
The GNU GCC for Arm embedded toolchain (GCC, GDB and other utilities).
A GDB server (ST-LINK GDB server) which is a piece of software that connects to the MCU through a debug probe (e.g., ST-LINK v3 mini) to program and debug its firmware.
Each application’s STM32CubeIDE project is built following the same guidelines. First, the folders in the project are virtual, which means that they do not necessarily map 1-to-1 to folders on the filesystem and that if a new source file is added on the filesystem, it won’t automatically appear in the project. It needs to be added manually. Still, the structure and naming reassemble very much to what is inside the SDK package. The source files in the virtual folders are linked, which means if they are edited, the modifications will appear in the real files, but if they are deleted from the project, they won’t be deleted from the filesystem.
Then, each project has multiple build configurations, one for each board the application supports. Having different build configurations means different binaries can be created for each board. This is useful to swap the local and destination address for Board1 and 2 for example. Build configurations also list the location of the source (.c) and header (.h) files and defines compiler settings and symbols. To verify these settings, right-click on a project and select properties. Compiler settings are under “C/C++ Build>Settings” and source/header location as well as symbols are under “C/C++ General>Paths and Symbols”. Before changing any of these settings, make sure the right build configuration is selected. The following figure shows Board1 build configuration of the Blinky application.
Note
STM32CubeIDE is made exclusively for STM32 microcontrollers. Other development environments will need to be used for boards with a non-STM32 microcontroller. SPARK core libraries can be used with any Cortex-M based microcontrollers using the GNU GCC for Arm embedded toolchain. Other toolchains are not yet supported.
Creating a new application¶
The most straight forward way to create a project for a new application is to start from an existing one that is similar. Here are the steps to follow if, for example, a project for a new application called My App that is similar to Hello World needs to be created.
Open a file explorer and duplicate the app/hello_world folder and rename it to app/my_app.
Go inside the STM32CubeIDE folder and delete the Hello World build outputs (i.e., Debug-Coordinator/Node) and debug configurations (i.e., Hello World Debug-Coordinator/Node.launch) if present.
Open the .project file with a text editor and change the name of the project which is located between the <name> and </name> tags. near the top of the file. Once done, save the changes and close the .project file.
Rename app/my_app/hello_world.c to app/my_app/my_app.c.
Open STM32CubeIDE and import your newly created project as explained in the Getting Started section.
In the Project Explorer window, unfold the My App project and delete app/hello_world.c and app/wps_cfg.h from it.
Back into the OS file explorer, go inside the app/my_app folder.
Add the my_app.c and wps_cfg.h source files to the STM32CubeIDE project by dragging them into the My App project app folder found in the STM32CubeIDE Project Explorer.
At this point, the My App project is functional and can be built just like to Hello World project. In order to flash and debug the code, Debug configurations need to be created for this specific project as explained in the Getting Started section. The content of my_app.c and wps_cfg.h can now be edited to reflect the My App application requirements. Also, if other source or header files are added to the project, or the compiler settings need to be changed for example, the build configurations may need to be edited.