Live Tracing on STM32H753ZI with VisualGDB

Sysprogs forums Forums VisualGDB Live Tracing on STM32H753ZI with VisualGDB

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #36653

    We have a tricky problem which looks like it needs some tracing.  In VisualGDB Properties, I turned Software tracing on and selected a function to trace. All good so far. The debugger had to be restarted and now a cryptic debugging failed message issues. Any help would be much appreciated.

    Attachments:
    You must be logged in to view attached files.
    #36659
    support
    Keymaster

    Hi,

    Sorry, this looks like the ELF file you are trying to trace contains some non-standard relocation records, so VisualGDB won’t know how to patch it. We can update VisualGDB to dump the exact address of the relocation record so you could try to adjust the code to avoid it, but it may turn out that there are multiple similar records with no easy fix.

    #36660

    We are using a bin file not an elf file. It looks like the relocation is caused by the live tracing. I searched the code for relocate and can only find standard code.

    Attachments:
    You must be logged in to view attached files.
    #36662
    support
    Keymaster

    Sorry, that wouldn’t work. You need an ELF file built with relocation records and full debugging symbols.

    #36664

    Thanks for the reply. Would hex files also work? There is no easy way I can see for gcc to make an elf file.

    #36666

    Quick update. I managed to fix the issue which was caused by the command buffer having an extra zero in the array and a length of 1. Resetting the buffer fixes the issue but there is still the question of how this random byte is getting set which is where a trace would be great. I will ask the team if anyone knows how to make an elf file from the arm compiler and come back here to report how it goes with an elf file. Thanks again for the help.

    #36676

    Another update. The issue is still there, and I really need to use the Trace function. I have turned off the bin output file and now the arm GCC compiler generates an elf file. However Visual GDB does not seem to be able to find the file even though it is present in the output folder:

    stm32-h7.elf: No such file or directory.

     

    #36682
    support
    Keymaster

    The ELF file should be generated even if the bin file generation is enabled.

    The last error looks like you somehow managed to break the project while attempting to get tracing to work.

    If nothing works, please try creating a new simple project for the same device from scratch, and verify that tracing works there. If it does, please try comparing the current project layout against the test project layout, to see if there are any differences that could be interfering.

    #36686

    OK, thanks. It looks like an elf file is always generated by gcc.

    I did try to load a smaller project and it seems to work. It asked a question about relocating records which I didn’t get on the main project. I will keep trying. Thanks for the info.

    #36689

    With the trace, now that it is working, how do you view the last 1000 lines of code executed? I see that you can add tracepoint events but a trace is when you stop the code and view previous execution.

    For example, I am pretty sure another service is coming in and interrupting the code which is why data is going missing. I am not sure how many services we have running but it would in the hundreds so impossible to find without a trace function.

     

    #36690
    support
    Keymaster

    These are two different tracing techniques. To view the last 1000 running lines of code, you would need to use separate J-Trace hardware and have the trace pins properly routed on the board (see this tutorial). Software trace works differently: it patches specific code locations to generate software trace events (ultimately, just write data to a buffer that VisualGDB will decode). So, you would need to think how the program is structured, what code could preempt the main thread, and put tracepoints there to reconstruct what is going on.

    #36691

    Great thanks for the info. The next question was going to be “What is the Hardware tracing for?”

    So, to summarize, Software tracing is a cutdown tracing utility which can be useful if you are very smart, otherwise the Segger J-Trace Pro is the way to go but cost $4k or so.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.