2020-07-31 07:56 AM
Hi,
I have used STM32l562-edk evk hardware and stm32cubeide for software. I have enable freertos in the project. For debug print message purpose I have created one function named as logPrint.
char g_msg_buf[100];
void logPrint(const char *format, ...)
{
int DataIdx = 0;
int len = 0;
va_list args;
va_start(args, format);
vsprintf(g_msg_buf,format, args);
len = strlen(g_msg_buf);
for (DataIdx = 0; DataIdx < len; DataIdx++) {
ITM_SendChar( g_msg_buf[DataIdx] );
}
va_end (args);
}
When I have run the program and invoke the logPrint function at that time OS stuck at vsprintf.
Observation:
Please help me to figure out this issue.
Solved! Go to Solution.
2020-07-31 10:14 AM
1st check that the stack size of the task(s) using printf-family functions is large enough. They need a lot more than the minimal stack size often used at the beginning for whatever reason. Try e.g.. 2k and tailor it later.
Also there are FreeRTOS config items to enable stack checks and asserts. Enable them all while developing/ debugging.
2020-07-31 08:32 AM
printf family of functions are not thread safe (specially gcc implementation). use a thread safe printf library like this:
2020-07-31 09:38 AM
Common problem, I think. Check your configuration with:
2020-07-31 10:14 AM
1st check that the stack size of the task(s) using printf-family functions is large enough. They need a lot more than the minimal stack size often used at the beginning for whatever reason. Try e.g.. 2k and tailor it later.
Also there are FreeRTOS config items to enable stack checks and asserts. Enable them all while developing/ debugging.
2020-07-31 10:19 AM
There is a also a doc provided by STM which could be helpful:
Developing applications on STM32Cube with RTOS
and note that FreeRTOS Support by CubeIDE v1.4.0 is broken. Maybe use CubeIDE v1.3.0 instead.
2020-07-31 02:29 PM
> and note that FreeRTOS Support by CubeIDE v1.4.0 is broken
Any details or reference, please?
-- pa
2020-08-01 01:36 AM
It‘s already reported and confirmed by ST here. It‘s messing up the interrupt prios.
2020-08-01 01:12 PM
Thanks -- pa
2020-08-03 11:39 PM
Hi All,
Thank you for your quick reply.
Issue is resolved.