lnls-dig / openMMC

Open source firmware for MMC controllers
GNU General Public License v3.0
39 stars 32 forks source link

the printf in printf-stdarg.h is not thread safe #90

Open umairsiddiqui-digitek opened 6 years ago

umairsiddiqui-digitek commented 6 years ago

it would be nice if you use a thread safe version of printf . one such threadsafe printf: thread safe version of printf found on freertos forum

henrique-silva commented 6 years ago

Yes, these [v][s][n]printf could cause some stack corruptions as a lot of people reported on the forums. I didn't change it before because the print itself was only used during debug routines, but it should definitely be thread-safe.

I'll try to replace the current code for the FreeRTOS implementation and check if it works correctly

Thanks!

umairsiddiqui-digitek commented 6 years ago

what about adding FreeRTOS_Plus_IO, it can used for both I2C and UART.

https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_IO/FreeRTOS_Plus_IO.shtml

https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_IO/Character_Queue_Transfer_Mode.shtml

printf can call write() function of FreeRTOS_Plus_IO.