cancel
Showing results for 
Search instead for 
Did you mean: 

Any way to receive SWV ITM debug data without Cube being in the post-F11 debug context?

PHolt.1
Senior III

Currently the Cube SWV ITM debug console does not receive the data unless you have built the project using the build+debug option F11.

This is a problem sometimes, when running code which contains the debug statements but which wasn't loaded from Cube IDE.

Or maybe there is some other program which can interface to STLINK V3 and receive this data?

5 REPLIES 5
AScha.3
Chief II

You can use CubeProgrammer and connect to SWV :

 

AScha3_1-1722501038670.png

+ just set real cpu frequ.

If you feel a post has answered your question, please click "Accept as Solution".

ST-LINK Utilities used to do it and STM32 Cube Programmer can do so now.

Code running on MCU can set up ITM, DWT and FPB too depending on how hard core bare metal you want to go.

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

Yes this is great. I have the ST Link Utility and that picks up the data

PHolt1_0-1722541284828.png

Curiously it reboots the target when it starts up but that's OK.

Thank you all!

 

 

Rim LANDOLSI
ST Employee

Hello @PHolt.1 ,

 

Yes, it is possible to receive Serial Wire Viewer debug data. These steps could be helpful:

  1. Enable the SWV feature in the debug configuration.
  2. Ensure that the clock settings are correctly configured to provide a stable clock for the SWV.
  3. Configure ITM by adding some code to "syscalls.c"
    #include "stm32f4xx.h"
    
    
    in the write function:
    
    __attribute__((weak)) int _write(int file, char *ptr, int len)
    {
      (void)file;
      int DataIdx;
    
      for (DataIdx = 0; DataIdx < len; DataIdx++)
      {
        __io_putchar(*ptr++);
        ITM_SendChar(*ptr++);
      }
      return len;
    }
    
    
  4. Click Debug to start a debug session.

In the debug session, open the SWV IT Data Console window and configure the port for receiving data, then click the button to run the view.

Thanks,

Rim

Not sure if ST-LINK Utilities offer connectivity options, ie so you can hot-plug

STM32 Cube Programmer might have more, and less disruptive, connection modes.

There should be a SWV tab/pane on the newer versions

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