Download project sources, let’s consider a workspace WORKSPACE
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 )
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 ) .
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 ) :
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"