2018-05-08 07:18 PM
I created a very basic LED toggle project for my nucleo-103rb board using CubeMX that targeted Makefile. I opened the software, selected the chip, set PA5 as GPIO Output and clicked generate code. I did not change any options. [well I did choose to only inlcude used libraries]. After generating the code, I edited the makefile to remove the well known, duplicate source files. I also added the path to my tool chain (gcc-arm-none-eabi-7-2017-q4-major from GNU Arm Embedded). I added 3 lines in the while(1) loop:
int i;
for (i = 1; i <= 262143; i++){}; HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);Overall, these are very minimal changes to the project generated from CubeMX. I connected to my nucleo-103rb board with openocd/gdb and loaded the elf file. The led indeed starts blinking, but then my debug session goes dead! Disconnecting the power and reconnecting to my PC does not restore my ability to connect to the debugger. To return debugger access, I have to load another application via the mbed OS node drive. Then I am able to connect again via openocd/gdb.
Attached are both the CubeMX project along with my own, hacked together project. I am able to load and debug my own project with openocd/gdb, but the project generated by CubeMX seemingly disables debug access.
openocd.exe -f interface/stlink.cfg -f target/stm32f1x_stlink.cfg
arm-none-eabi-gdb main.elf
target remote 127.0.0.1:3333
monitor reset halt
load
What do I need to do to be able to connect to my board and debug an app generated by CubeMX?
#cubemx #stlink-openocdSolved! Go to Solution.
2018-05-16 08:49 AM
Hi
Harris.Christian
,The Debug of STM32F1 is different from the other products as it is disabled by default.
Please enable the debug from SYS in the peripheral tree and all should be OK
2018-05-08 10:26 PM
To return debugger access, I have to load another application via the mbed OS node drive.
This 'mbed OS node drive' is a second-stage bootloader application, posing as mass storage device, where you can drop applications in.
Then I am able to connect again via openocd/gdb.
I am not sure how the interaction with the debugger works.
And I usually don't care, because the first thing I do with such board is to remove those opaque loaders.
Perhaps some one else here has experience with it, or try the mbed website/forum.
2018-05-15 03:45 AM
Hi
Harris.Christian
,Are you using the last MX version (4.x)?
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2018-05-16 08:49 AM
Hi
Harris.Christian
,The Debug of STM32F1 is different from the other products as it is disabled by default.
Please enable the debug from SYS in the peripheral tree and all should be OK