I am an STM32 newcomer. I recently got an STM32F429 Discovery dev board which I have been playing around with. Currently I'm trying to figure out how to use the debugging functions of this M4 Cortex, specifically the SWV ones.
I used STM32CubeMX standalone to generate a project for Atollic TrueStudio and then modified the main.c files infinite loop as follows to blink an LED on and off every 2 seconds and to printf a message to the console.
while (1)
{
HAL_GPIO_TogglePin(GPIOG,GPIO_PIN_13);
HAL_Delay(2000);
printf("hello");
}
When I run debug it programs the board perfectly. I see the LED blink on and off. I followed the steps in this article which explains how to setup printf redirect to the console by generating a syscalls.c file and making some changes to the int _write function in that file. I am however struggling to get this to work. When I step through my code and get to that printf("hello") line it just skips over it like it doesn't exist and there is nothing printed to the SWV console.
Below is a picture of my debug settings and the modified version of int _write which resides in my syscalls.c file.
int _write(int32_t file, uint8_t *ptr, int32_t len)
{
int i=0;
for(i=0 ; i<len ; i++)
ITM_SendChar((*ptr++));
return len;
errno = ENOSYS;
return -1;
}
Is it possible I've missed something in the setup when using CubeMX? I followed Atollics recommended setup for printf redirect exactly but nothing shows up in the SWV console.