I have a new project with fast semihosting enabled. Printf works fine in the main part of my project but doesn’t work in an interrupt callback. Seems like I’ve done this before with cout in a C++ program but this program is just C so far. Here’s the code in main that does work:
printf("Starting receive DMA\n");
if (HAL_UART_Receive_DMA(&UartHandle, (uint8_t *)rxBuffer, RXBUFFERSIZE) != HAL_OK)
{
Error_Handler();
}
printf("Starting transmit DMA\n");
if (HAL_UART_Transmit_DMA(&UartHandle, (uint8_t*)txBuffer, TXBUFFERSIZE) != HAL_OK)
{
Error_Handler();
}
Here’s the interrupt callback and some associated stuff where printf doesn’t work:
void usart2CharMatchCallback(UART_HandleTypeDef *huart);
void USART2_IRQHandler(void)
{
HAL_UART_IRQHandler(&UartHandle);
if (__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_CMF))
{
usart2CharMatchCallback(&UartHandle);
__HAL_UART_CLEAR_FLAG(&UartHandle, USART_ICR_CMCF);
}
}
void usart2CharMatchCallback(UART_HandleTypeDef *huart)
{
HAL_Delay(1);
printf("hit HAL_UART_CharMatchIdleCallback\n");
}
The Embedded Project C Library Type is “Newlib-nano with floating point support in printf() and scanf()
The Implementations is Minimal (no semihosting)
and I have the Fast Semihosting and Embedded Profiler Embedded Framework checked
and Semihosting console support in Embedded Debug Tweaking > ARM Semihosting is set to Enabled.
Suggestions?
Thanks
-
This topic was modified 3 years, 5 months ago by GeneM.
-
This topic was modified 3 years, 5 months ago by GeneM.