Tools installation and first test 45min
Target description
Teach how to install the main tools for programming the STM32:
- STM32CubeMX, a tool to set and graphically program all STM32 boards and products
- STM32CubeIDE, the free IDE to develop the STM32 software
- STM32CubeProg, a tool to load/spy software in the STM32 memory
- An MCU software package with embedded examples, based on the selected device, e.g. STM32CubeL4, STM32CubeWBA, etc.
Having completed this tutorial, you should be able to open the STM32 professional ecosystem.
You should also manage to bring applications from the ecosystem onto the NUCLEO board.
Finally, you will be able to run the blinking LED example in debug mode.
Prerequisites
- Computer with Windows 7 (or higher)
- Java installed
- web access
Hardware
- A Nucleo board or a Development kit, e.g.:
- NUCLEO-L476RG[1] board (64-pin)
- NUCLEO-WBA52CG[2] board (48-pin)
- USB Type-A to Mini-B cable
1. Install STM32CubeMX
10min
STM32CubeMX is the tool to graphically program the STM32.
- Download STM32CubeMX[3]
- Register on www.st.com web site if necessary.
- Unzip the downloaded file and launch the SetupSTM32CubeMX-xxx corresponding to your OS.
STM32CubeMX is now installed on your computer.
2. Install an IDE
10min
Download and install your preferred IDE. Options supported by STM32CubeMX are: STM32CubeIDE[4], Keil uVision[5], IAR EW[6], Microsoft VSCode[7] with the STM32 extension[8].
Follow the instructions on the product's webpage.
Below are the instructions for STM32CubeIDE.
STM32CubeIDE is the Integrated Development Environment to develop STM32 software.
- Download STM32CubeIDE
- Register on www.st.com web site if necessary.
- Unzip the downloaded file and launch the STM32CubeIDE-xxx corresponding to your OS.
STM32CubeIDE is now installed on your computer, enjoy!
3. Install STM32CubeProg
5min
STM32CubeProgrammer is a tool load/spy software in STM32.
- Download STM32CubeProg[9]
- Unzip the downloaded file and launch the SetupSTM32CubeProgrammer-xxx.exe corresponding to your OS, and follow the instructions.
STM32 USB driver and STM32CubeProg are now installed on your computer.
4. Download firmware package for your device
- Open STM32CubeMX
- Click Manage embedded software packages in Help
- Check the last release version of the correct package, e.g. STM32CubeL4, STM32CubeWBA, etc.
- Click Install (it may take a long time)
- Now the chosen libraries and examples are installed at the following location C:\Users\myname\STM32Cube\Repository\STM32Cube_FW_XX_Vx.xx.x (where XX is the MCU series, e.g. L4, WBA, etc.).
5. Launch the IDE and run my first program
10min
Launch your preferred IDE and follow the necessary steps to debug a program on the MCU.
Below are the steps for STM32CubeIDE. Directory path to the example project applies to other IDEs as well.
Use the debug mode
- Launch STM32CubeIDE
- If STM32CubeIDE asks, select the default workspace
- In File STM32CubeIDE menu, click on Open Projects from File System
- In the window, click Directory and select C:\Users\myname\STM32Cube\Repository\STM32Cube_FW_XX_Vx.xx.x\Projects\YYYY\Examples_LL\GPIO\GPIO_InfiniteLedToggling (where XX is the MCU series, e.g. L4, WBA, etc. and YYYY is the board name)
- Select the project file inside folder
- '\STM32CubeIDE for more recent projects
- \SW4STM32\YYYY (where YYYY is the board name) for older projects
- In case of an older project, accept the popup, asking for conversion.
Now your project is under STM32CubeIDE
- Default STM32CubeIDE settings are adequate for this tutorial
- Click on Debug icon to launch and debug the project
- Please ensure to click on “Shared ST-Link” option on Debug configurations and Debugger tab
- Click Resume icon to continue the program execution
Now you are able to:
- find STM32 libraries
- open a project (example)
- load a project in STM32CubeIDE
- execute a project in debug mode
- make a LED blink
Now you have on your computer:
- libraries for your selected MCU
- examples for your selected MCU
- STM32CubeProg (to communicate with the MCU)
- STM32CubeMX (to graphically generate your project)
- STM32CubeIDE (to code)
6. References