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 are not deleted from the filesystem.
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. Use the procedure listed below to create a project for a new application called “My App” which is similar to the Hello World example.
Open a file explorer and duplicate the app/hello_world folder and rename it to app/my_app.
Navigate 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/swc_cfg.h from it.
Back into the OS file explorer, go inside the app/my_app folder.
Add the my_app.c and swc_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 should be functional and can be built just like the Hello World project. The content of my_app.c and swc_cfg.h can now be edited to reflect the My App application requirements. Build configurations will need to be created if other source or header files are added to the project, or the compiler settings need to be changed. Debug configurations will need to be created to flash and debug the code (see Getting Started).