Page Personnelle de Vincent Kerhoas
Vincent Kerhoas
Professeur Agrégé
Page Personnelle de Vincent Kerhoas

STM32CubeIDE

Download project sources, let’s consider a workspace WORKSPACE


Compiling

In a terminal :

$ stm32cubeide

when opening, choose : workspace : WORKSPACE…

you’ll see the project tree in Project Explorer window.

if the project tree doesn’t appear correctly,
in project explorer window, choose import project –> Existing Projects into Workspace

Then select the project directory, that’s to say WORKSPACE/Project_dir

Building the project : Project –> build All ( CTRL+B )


Debugging

If there is no errors in the code, this should create a .elf

Debugging the project : Turn to Debug panel :

then press the bug button and choose …Debug

if no debug config is present, choose Run –> Debug Config

Then, in ‘STM32 Cortex M C/C++ Application’ check Project Name and *.elf file location

On debug, it can be necessary updating the target firmware

If STlinkUpgrade program appears, select Open in update Mode, then Upgrade.

The program (*.elf) should be loaded in the target.

You’ll have to run it with F8 shortcut.

Then you can add breakpoints ( double click in the margin ) and observe datas ( I recommand ‘watch expression’ window ( window -> show view -> Expressions ) .


Flashing the microcontroller

If you want the target boot with you code while turning on or reset, you need to flash the rom memory with your program (*.elf).
Verify first no debug session is running, then considering template.elf is our binary for our target, write in a terminal ( you need to be in the template.elf directory ) :


Download openocd

Nucleo-F4xx :

Nucleo-F103 :