Is newlib-nano thread safe?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Is newlib-nano thread safe?

ソリューションへジャンプ
562件の閲覧回数
fernando_dabadia
Contributor I

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

ラベル(1)
0 件の賞賛
1 解決策
520件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

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://community.nxp.com/t5/LPC-Microcontrollers/Newlib-none-C-exceptions-and-thread-safety/td-p/11...

https://nadler.com/embedded/NXP_newlibAndFreeRTOS.html

https://github.com/DRNadler/FreeRTOS_helpers

 

Regards,

Jing

元の投稿で解決策を見る

0 件の賞賛
2 返答(返信)
521件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

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://community.nxp.com/t5/LPC-Microcontrollers/Newlib-none-C-exceptions-and-thread-safety/td-p/11...

https://nadler.com/embedded/NXP_newlibAndFreeRTOS.html

https://github.com/DRNadler/FreeRTOS_helpers

 

Regards,

Jing

0 件の賞賛
492件の閲覧回数
fernando_dabadia
Contributor I

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.

0 件の賞賛