FreeRTOs stuck at vsprintf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-07-31 7: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:
- When I have disable the freeRTOS then function is working properly and i get the data on console.
- When I have enable the freeRTOS then OS stuck at vsprintf.
Please help me to figure out this issue.
Solved! Go to Solution.
- Labels:
-
FreeRTOS
-
STM32L5 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-07-31 8:32 AM
printf family of functions are not thread safe (specially gcc implementation). use a thread safe printf library like this:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-07-31 9:38 AM
Common problem, I think. Check your configuration with:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-07-31 2:29 PM
> and note that FreeRTOS Support by CubeIDE v1.4.0 is broken
Any details or reference, please?
-- pa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-01 1:36 AM
It‘s already reported and confirmed by ST here. It‘s messing up the interrupt prios.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-01 1:12 PM
Thanks -- pa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-03 11:39 PM
Hi All,
Thank you for your quick reply.
Issue is resolved.
