2019-07-22 07:57 PM
I have a problem in STM32CubeIDE.
unsigned char readKey (void)
{
volatile unsigned char keyValue=HAL_GPIO_ReadPin (KEY_GPIO_Port, KEY_Pin);
if (0 == keyValue)
{
printf ("before delay\r\n");
HAL_Delay (10);
keyValue=HAL_GPIO_ReadPin (KEY_GPIO_Port, KEY_Pin);
if (0 == keyValue)
{
printf ("after delay\r\n");
return 1;
}
}
return 0;
}
These codes will be OK in keil. But the STM32CubeIDE will not be able to print characters. My optimization level is -O0.
2019-07-22 10:23 PM
This is not Unix/Linux with standardized stdin + stdout channels.
Check the CubeIDE documentation what the printf is supposed to do there. "Semihosting" would ba a keyword.
Or even better, stick with Keil.
2019-07-23 12:57 AM
Hi,
see AN4989 (STM32 microcontroller debug toolbox) §7 Printf
This is Everything You Always Wanted to Know About Printf* (*But Were Afraid to Ask)
Rgds
BT