cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE enter in debug mode, but not flash the program.

vitorengcruz
Associate II

Hi everyone,

I'm having some trouble entering in debug mode in the Nucleo-L496ZG.

It seems like the compiler and link works fine, as the output window shows:

arm-none-eabi-size  CLP_STM32L4.elf 

  text   data   bss   dec   hex filename

 39427   488  15964  55879   da47 xxxxxxxxxxxx.elf

Finished building: default.size.stdout

On the other hand when I click in the debug button, something strange happen:

STMicroelectronics ST-LINK GDB server. Version 5.2.3

Copyright (c) 2019, STMicroelectronics. All rights reserved.

Starting server with the following options:

    Persistent Mode      : Disabled

    Logging Level       : 1

    Listen Port Number     : 61234

    Status Refresh Delay    : 15s

    Verbose Mode        : Disabled

    SWD Debug         : Enabled

Waiting for debugger connection...

Debugger connected

And apparently it freezes, the ST-LINK LED in the board awkward turn "off" (green is very weakly on) and the play button of debug toolbar in the IDE is disabled, like it's trying to run to the main routine. No code is flashed, I checked by read the memory from it using ST Visual Programmer, I also erased before try again. Try another IDE (AC6 Workbench) with is very similar IDE and it works fine, flashing and debugging.

I also try to run debbug in the CubeIDE with my program made in AC6 in the flash. But now the debug stop in a new tab, informing that there is no debug info to show were the program hit the breakpoint. I stop debugging and the chip kept the behavior of my program compiled in the AC6 (CubeIDE main is empty, fresh from the CubeMX interface).

The video from the ST website seems to be very straight forward, hit the debbug button, check the Serial Wire Viewer Enabled, type the target core clock and start debbug no problem.

There are other configuration that need to be done before flash? I can't find anything to enable/disable this feature.

Thanks for the help!

2 REPLIES 2
Anton Martinsen
Associate II

Hello,

I have encountered a similar problem. My program did not freeze but the debugger lost connection as soon as it had connected.

It worked fine as long as I did not link my libraries, do you link any external libraries?

Once I had discovered this I tried to match the settings in the IDE to how the libraries were compiled.

I noticed that the optimization flag for the compiler did not work if the IDE used -O0, any other flag worked for me.

If you have libraries, does the IDE use -O0 as optimization flag? If so, try and use other optimization flags.

Hope to hear if this helps!

Best regards

vitorengcruz
Associate II

Hi Anton,

I had to uninstall and install the IDE to get the debug in new project works. I guess this is the solution for this problem.

The Eclipse seems to easily corrupt itself pretty often. I had a problem in the AC6 IDE (Eclipse based too) that it decided to corrupt the board menu content and insert a null statement in something not accessible and this cause a null pointer error in java that broke the compilation process, saying there is no board selected for compile the program. That's why I tried STM32 IDE and, to my surprise, here we are with Eclipse again!

I'm now afraid to start my projects with this program and similar problems continuing to happen again and again.

I'll try your suggestions if this program stop corrupt itself.

Best regards.