Hi,
I did a search but couldn't find reliable information.
Could someone confirm for me if the newlib-nano delivered in the MCUXpresso package is thread safe?
Sincerely,
Fernando
已解决! 转到解答。
Hi @fernando_dabadia ,
Newlib and newlib-nano are part of the GNU ARM Embedded Toolchain distribution maintained by ARM. The IDE includes the package in unmodified binary form. Newlib requires FreeRTOS platform support to provide thread-safety. But we haven't such example.
https://nadler.com/embedded/NXP_newlibAndFreeRTOS.html
https://github.com/DRNadler/FreeRTOS_helpers
Regards,
Jing
Hi @fernando_dabadia ,
Newlib and newlib-nano are part of the GNU ARM Embedded Toolchain distribution maintained by ARM. The IDE includes the package in unmodified binary form. Newlib requires FreeRTOS platform support to provide thread-safety. But we haven't such example.
https://nadler.com/embedded/NXP_newlibAndFreeRTOS.html
https://github.com/DRNadler/FreeRTOS_helpers
Regards,
Jing
Hi @jing,
Thanks for the answer. I read the material recommended by you and several others that I found on the internet, in addition to performing some tests myself (which I had already done in the past). From what I could see, newlib-nano behaves the same way as newlib, when it comes to the thread-safe requirement. I had already implemented several hooks functions (even before this question) required by the newlib in addition to wrapping the malloc, malloc_r, free and free_r functions (I am using FreeRTOS and calling the pvPortMalloc and vPortFree functions in the wrap). From what I could see, the newlib's operations (printf, for example) are always using mutexes to protect events (using the hook functions I implemented).
However I still have some sporadics Hard Faults in my code, which is messing the process stack (where it points to). I'm still under investigation, in the past I had a similar problem when I was using the standard libraries without the necessary implementations for thread-safe (before I was using IAR and now GCC/MCUXpresso), that's why I posted this question, even having previously implemented what was demanded by newlib to make it thread-safe.
Thanks,
Fernando.