How to use SVW ITM Data Console with printf() in non-debug mode?
Hello everyone,
I'm figuring out the redirection of `printf()` function to ITM Data Console on example of Nucleo-G474RE.
I managed to set-up the forward of `printf()` to ITM Data Console when it is used in debug-mode, but I can't use it when it is build with regular Run command. The start trace button stays grey and unavailable. However, I can connect to SWV with STM32CubeProgrammer. Which setting am I missing?
The example code is simple and based on STM32 project without BSP. Code is:
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <stdio.h>
/* USER CODE END Includes */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
__attribute__((weak)) int _write(int file, char *ptr, int len)
{
(void)file;
for (int DataIdx = 0; DataIdx < len; DataIdx++)
{
ITM_SendChar(*ptr++);
}
return len;
}
/* USER CODE END 0 */
/* USER CODE BEGIN WHILE */
while (1)
{
printf("Hello from within STM32 via SWO!\r\n");
HAL_Delay(500);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */Project configuration is:

System info:
- Windows 11
- STLink firmware version : V3.J16.M8
- Used Board : Nucleo-G474RE
- STM32CubeIDE : 1.18.1
