Loading...
 

STM32MP1 support available in SW4STM32

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world.
And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4; you can download a short video showcasing this on the ac6-tools website (registration required).

System Workbench for STM32


Debugging, Step-over (F6) is sometimes slow as if gdb can't gracefully step over in-lined functions

I’m debugging a program on an STM32F4Discovery board. The program loads and runs ok and breakpoints work ok. Sometimes when I Step Over (F6) a function the step is fast. Other times, a Step Over takes more than a minute. I can reproduce this issue with a blank project generated with CubeMX. CubeMX generates a main.c file with a main() with calls to:

  • HAL_Init();
  • SystemClock_Config();
  • MX_GPIO_Init();

Stepping over the first two function calls is ‘instantaneous’. Stepping over MX_GPIO_Init, on the other hand, takes a little over a minute, and during that time the STM32 Debugging Console windows shows a series of several “Info : halted: PC: 0x0800xxxx” statements that look like this:

Info : halted: PC: 0x08000e0c
Info : halted: PC: 0x08000eb0
Info : halted: PC: 0x08000eb2
Info : halted: PC: 0x08000eb4
Info : halted: PC: 0x08000eb8
Info : halted: PC: 0x08000ebc
Info : halted: PC: 0x08000ebe
Info : halted: PC: 0x08000ec0
Info : halted: PC: 0x08000ec4
Info : halted: PC: 0x08000ec6
Info : halted: PC: 0x08000ec8
Info : halted: PC: 0x08000eca
Info : halted: PC: 0x08000ece
Info : halted: PC: 0x08000ed0
Info : halted: PC: 0x08000ed2
Info : halted: PC: 0x08000ed6
Info : halted: PC: 0x08000ed8
Info : halted: PC: 0x08000eda
Info : halted: PC: 0x08000edc
Info : halted: PC: 0x08000ee0
Info : halted: PC: 0x08000ee2
Info : halted: PC: 0x08000ee4
Info : halted: PC: 0x08000ee8
Info : halted: PC: 0x08000eea
Info : halted: PC: 0x08000eec
Info : halted: PC: 0x08000eee
Info : halted: PC: 0x08000ef2
Info : halted: PC: 0x08000ef4
Info : halted: PC: 0x08000ef6
Info : halted: PC: 0x08000efa
Info : halted: PC: 0x08000efc
Info : halted: PC: 0x08000efe
Info : halted: PC: 0x08000f00
Info : halted: PC: 0x08000f04
Info : halted: PC: 0x08000f06
Info : halted: PC: 0x08000f08
Info : halted: PC: 0x08000f0c
Info : halted: PC: 0x08000f0e
Info : halted: PC: 0x08000f10
Info : halted: PC: 0x08000f12
Info : halted: PC: 0x08000f16
Info : halted: PC: 0x08000f18
Info : halted: PC: 0x08000f1a
Info : halted: PC: 0x08000f1e
Info : halted: PC: 0x08000f20
Info : halted: PC: 0x08000f22
Info : halted: PC: 0x08000f24
Info : halted: PC: 0x08000f26
Info : halted: PC: 0x08000f28
Info : halted: PC: 0x08000f2a
Info : halted: PC: 0x08000f2c
Info : halted: PC: 0x08000f2e
Info : halted: PC: 0x08000f30
Info : halted: PC: 0x08000f32
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08000f38
Info : halted: PC: 0x08000f3a
Info : halted: PC: 0x08000f3c
Info : halted: PC: 0x08000f3e
Info : halted: PC: 0x08000f40
Info : halted: PC: 0x08000f42
Info : halted: PC: 0x08000f44
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08000f4a
Info : halted: PC: 0x08000f4c
Info : halted: PC: 0x08000f4e
Info : halted: PC: 0x08000f50
Info : halted: PC: 0x08000f52
Info : halted: PC: 0x08000f54
Info : halted: PC: 0x08000f56
Info : halted: PC: 0x08000f58
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08000f5e
Info : halted: PC: 0x08000f60
Info : halted: PC: 0x08000f62
Info : halted: PC: 0x08000f66
Info : halted: PC: 0x08000f6a
Info : halted: PC: 0x08000f6c
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08000f72
Info : halted: PC: 0x08000f74
Info : halted: PC: 0x08000f76
Info : halted: PC: 0x08000f78
Info : halted: PC: 0x08000f7a
Info : halted: PC: 0x08000f7c
Info : halted: PC: 0x08000f7e
Info : halted: PC: 0x08000f82
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08000f88
Info : halted: PC: 0x08000f8a
Info : halted: PC: 0x08000f8c
Info : halted: PC: 0x08000f8e
Info : halted: PC: 0x08000f92
Info : halted: PC: 0x08000f94
Info : halted: PC: 0x08000f96
Info : halted: PC: 0x08000f98
Info : halted: PC: 0x08000f9a
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08000fa0
Info : halted: PC: 0x08000fa4
Info : halted: PC: 0x08000fa6
Info : halted: PC: 0x08000fa8
Info : halted: PC: 0x08000faa
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08000fb2
Info : halted: PC: 0x08000fb4
Info : halted: PC: 0x08000fb6
Info : halted: PC: 0x08000fb8
Info : halted: PC: 0x08000fba
Info : halted: PC: 0x08000fbc
Info : halted: PC: 0x08000fbe
Info : halted: PC: 0x08000fc0
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08000fc8
Info : halted: PC: 0x08000fca
Info : halted: PC: 0x08000fcc
Info : halted: PC: 0x08000fce
Info : halted: PC: 0x08000fd0
Info : halted: PC: 0x08000fd2
Info : halted: PC: 0x08000fd4
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08000fdc
Info : halted: PC: 0x08000fde
Info : halted: PC: 0x08000fe0
Info : halted: PC: 0x08000fe2
Info : halted: PC: 0x08000fe4
Info : halted: PC: 0x08000fe6
Info : halted: PC: 0x08000fe8
Info : halted: PC: 0x08000fec
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08000ff4
Info : halted: PC: 0x08000ff6
Info : halted: PC: 0x08000ff8
Info : halted: PC: 0x08000ffa
Info : halted: PC: 0x08000ffc
Info : halted: PC: 0x08000ffe
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08001006
Info : halted: PC: 0x08001008
Info : halted: PC: 0x0800100a
Info : halted: PC: 0x0800100c
Info : halted: PC: 0x0800100e
Info : halted: PC: 0x08001010
Info : halted: PC: 0x08001012
Info : halted: PC: 0x08001014
Info : halted: PC: 0x08001016
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x0800101c
Info : halted: PC: 0x0800101e
Info : halted: PC: 0x08001020
Info : halted: PC: 0x08001022
Info : halted: PC: 0x08001024
Info : halted: PC: 0x08001026
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x0800102e
Info : halted: PC: 0x08001030
Info : halted: PC: 0x08001032
Info : halted: PC: 0x08001034
Info : halted: PC: 0x08001036
Info : halted: PC: 0x08001038
Info : halted: PC: 0x0800103a
Info : halted: PC: 0x0800103c
Info : halted: PC: 0x08001040
Info : halted: PC: 0x0800037c
Info : halted: PC: 0x08001046
Info : halted: PC: 0x08001048
Info : halted: PC: 0x0800104a
Info : halted: PC: 0x0800104e
Info : halted: PC: 0x08001050
Info : halted: PC: 0x0800037c

It’s almost as if it’s stepping in Instruction mode or an auto-step mode. One difference with the ‘slow stepping’ function is that it’s defined and called in the same main.c file.

So, maybe the function is optimized, inlined, and gdb doesn’t know how to gracefully step over such a function. Maybe tweaks to optimization would resolve the issue. If, instead of stepping, I set a breakpoint after that function and Run, execution is fast.

My concern is that it would be pretty common to debug, say, a class where calls to functions defined in the same file would be very common and a 1-minute-per-step time hit would adversely impact development.

Any suggestions on what to try or how to isolate the issue?

More info...
The ‘slow stepping’ functions are in-lined which can be seen in the Disassembly window. This inlining can be turned off by setting Optimization to None (-O0). That’s the work-around and now my question is this: is there a way to configure either gdb or Eclipse to step-over inlined functions and be quick about it?


Have same problem, nobody cant fix it? For normall debugging i use breakpoints, but some times its not comfortably.