cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE hangs when printf to SWV ITM Data Console

Garland
Associate

Evaluation board: STM32L476G-EVAL

A simple program created using FreeRTOS and Configuration: SYS > Debug: Trace Async Sw.

FreeRTOS running a single task. The task prints out a line every 1 ms.

The single task has the following loop:

 

for (int32_t i = 0;; ++i)

{

TaskDelay(1);

printf("%ld DEBUG printf hang: SWV ITM Data Console buffer overflow.\n", i);

}

 

 

Start Debug, the SWV console prints out text and works for a while, then the IDE hangs. See screenshot below:

Garland_0-1689861432320.png

IDE hangs and not responding. Force close IDE and restart it. Try to try debug again and get the following error:

 

Garland_2-1689861548861.png

 

Disconnect and reconnect the evaluation board, run debug again, get the following error:

 

STMicroelectronics ST-LINK GDB server. Version 7.4.0

Copyright (c) 2023, STMicroelectronics. All rights reserved.

 

Starting server with the following options:

Persistent Mode : Disabled

Logging Level : 1

Listen Port Number : 61234

Status Refresh Delay : 15s

Verbose Mode : Disabled

SWD Debug : Enabled

InitWhile : Enabled

 

Failed to bind to port 61235, error code -1: No error

Failure starting SWV server on TCP port: 61235

Failed to bind to port 61234, error code -1: No error

Failure starting GDB server: TCP port 61234 not available.

Shutting down...

Exit.

 

The only way to fix the problem is to restart my PC.

 

IDE version: 

Garland_3-1689861671103.png

 

4 REPLIES 4
AScha.3
Chief II

>The task prints out a line every 1 ms.

so you can read 1000 lines per sec. ??

well , IDE/java cannot write 1000 lines/s .    some internal buffer flooded...

try same, but delay 1000 . 1 sec.  this about the update rate in the IDE , afaik.

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

Hello @Garland  and welcome to the community,

I have tried to reproduce this issue using FreeRTOS and Configuration: SYS > Debug: Trace Async Sw on STM32CubeIDE 1.13.0 version. Everything is working correctly with the created task that  prints out a line every 1 ms, but you have to increase the trace buffer size (window => Preferences => STM32Cube =>Serial Wire Viewer) before getting full.

I hope this helps!

Thanks.

Hello @Rim LANDOLSI 

I am using SWV ITM Data Console for serial protocol testing over longer periods of time. Is there a way to make the viewer act as a fifo with limited length? This prevent hanging due to overflow in the number of windows messages in the buffer.

I also have the impression that once you cover the IDE with another window (rendering updates of the viewer window unnecessary), the hanging happens much more frequently. Can you comment on this or check with the developers?

Other point is that I see no reason to hang the IDE if the buffer is full. Maybe this can also be addresses by the team?

Rim LANDOLSI
ST Employee

Hello @Garland ,

Thank you for your contributions and for your detailed explanations. The issue has been reported to STM32CubeIDE development team. An internal ticket ID 163337(This is an internal tracking number and is not accessible or usable by customers) is submitted to escalate this issue internally to the STM32CubeIDE team .

I will keep you posted with updates, and I hope that this answered your question.

Thanks,

Rim