cancel
Showing results for 
Search instead for 
Did you mean: 

How to program an SREC during debug?

BStic.2
Senior

Our project requires some post-processing of the SREC at compile time. I would like to load the regular ELF file for symbols, but write the SREC to memory. It seems the IDE only accepts ELF files, which I cannot generate. How do I program an SREC as part of launching a debug configuration? I am using a Segger JLINK Ultra +

1 ACCEPTED SOLUTION

Accepted Solutions
mattias norlander
ST Employee

The CubeIDE debugger relies on the GDB load command to dispatch task of loading binaries to the currently used GDB-server.

In this way the debugger does not really have to know/care much about which target is connected. We trust that the GDB-server has the awareness. And in that

This gives us a clean interface between CubeIDE and the debugger back-end and the benefit of less maintenance and code duplication.

The down-side is that the load command of GDB does not support loading srec-files.

Still what you want to do can be achieved relying on other features in the IDE. My advice would be to:

  1. Setup an external tools configuration, where you invoke JlinkCommander to carry out the srec load.
  2. Then make sure that the debug configuration points to use the elf-file, but has unchecked the download check-box or we will overwrite the srec...
  3. You can then setup a Launch group which will allow you to chain the external tools config as a first step. Once finished the Debug config will be launched. You should probably also disable auto-build in the debug config which does not make sense to have between the external tools config and the debug config.

This could work depending on what your "elf-->srec" script does...

Could this work for you?

View solution in original post

5 REPLIES 5
Pavel A.
Evangelist III

But srec files do not have debug info, you're going to need the elf anyway.

Note that CubeIDE debugger can load only the debug info from the elf file, and load multiple binaries without debug info.

The OP is talking about a block of arbitrary data, why on earth could this not be loaded by a debug script? I could do it with a LOAD command in Keil (Intel Hex, for sure).​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Ya, I am going down the route of doing a JLinkCommander script, but it would be much nicer if I can just do this all at debug time instead of making it a manual task.

mattias norlander
ST Employee

The CubeIDE debugger relies on the GDB load command to dispatch task of loading binaries to the currently used GDB-server.

In this way the debugger does not really have to know/care much about which target is connected. We trust that the GDB-server has the awareness. And in that

This gives us a clean interface between CubeIDE and the debugger back-end and the benefit of less maintenance and code duplication.

The down-side is that the load command of GDB does not support loading srec-files.

Still what you want to do can be achieved relying on other features in the IDE. My advice would be to:

  1. Setup an external tools configuration, where you invoke JlinkCommander to carry out the srec load.
  2. Then make sure that the debug configuration points to use the elf-file, but has unchecked the download check-box or we will overwrite the srec...
  3. You can then setup a Launch group which will allow you to chain the external tools config as a first step. Once finished the Debug config will be launched. You should probably also disable auto-build in the debug config which does not make sense to have between the external tools config and the debug config.

This could work depending on what your "elf-->srec" script does...

Could this work for you?

BStic.2
Senior

Yes, this is also the answer that I landed on from what I could patch together. I have not gotten it working completely yet, but its close. Thanks.