0

Following the information here: Renode GDB doc, I tried setting up debugging between the emulation and Eclipse-based STM32CubeIDE.

For that, I added to my .resc script, which creates the STM32L072-based machine and loads my firmware .elf file(s), a line at the end:

machine StartGdbServer 3333 true

That was my first attempt, with the "true" for auto-starting the emulation once GDB connects. With that, my debug config in CubeIDE is as follows:

  1. create "GDB Hardware Debugging" template to start off (the STM32-specific template offered by CubeIDE cannot be used as it presumes the presence of an ST-Link or similar HW debugger)
  2. "Main" tab: set "Project", and "C/C++ Application" binary, disable auto-build - to not have the IDE change the binary that's already loaded by the .resc script
  3. "Debugger": "JTAG Device" to "Generic TCP/IP", "localhost:3333"
  4. "Startup": no loading of image or symbols, as .resc script already loads .elf files, "Run commands" box is empty

If I then start Renode, in the monitor, load my .resc file with "include" (i.e. not starting the emulation, just preparing the device & starting gdbserver), and then start to debug with that above configuration, CubeIDE's threads view shows like there was a breakpoint, but at address 0x0,and no source code file is opened. Starting and pausing the program with the > and || buttons does not improve anything. The monitor output also does not show a lot of action, seems the pogram does indeed not really run:

[INFO] my_app: GDB server with all CPUs started on port :3333
[INFO] cpu0: Guessing VectorTableOffset value to be 0x8000000.
[INFO] cpu0: Setting initial values: PC = 0x8001F49, SP = 0x20005000.

No more output. (logging function names is enabled) So I tried the alternative of not setting "start once gdb connects" to true:

machine StartGdbServer 3333

and, for debug config step 4., the "Run commands" box now contains:

monitor start
continue

If I then start Renode again, load the .resc file, and then start debugging from CubeIDE, I see, in the Renode monitor, the program running through until the point where it runs into an assertion, while the CubeIDE debug session looks basically ending immediately after starting. So, at least the "monitor start" has arrived, as the program ran, although unimpeded by the connected(?) GDB.

What's missing from these configurations for debugging to work?

sktpin
  • 317
  • 2
  • 15

0 Answers0