Question
Gcc optimization problem
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.