IDE
STM32CubeIDE

STM32CubeIDE

Download project sources, let’s consider a workspace WORKSPACE


Compiling

stm32cubeide

when opening, choose : workspace : WORKSPACE…

1.png

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

2.png

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

import_project.png

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 :

3.png

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

debug.png

On debug, it can be necessary updating the target firmware

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

upgrade.png

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 ) .

4.png


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 ) :

openocd.zip

Nucleo-F4xx :

openocd -s /share/openocd/scripts -f board/st_nucleo_f4.cfg -f flash_board.cfg -c "myFlash [executable name].elf"

Nucleo-F103 :

openocd -s /share/openocd/scripts -f board/st_nucleo_f103rb.cfg -f flash_board.cfg -c "myFlash [executable name].elf"