Re: C library re-entrancy under Zephyr
Rob Meades
Answering my own question for the benefit of anyone listening who didn’t already know: the answer is that the built-in minimal C library offers some functions re-entrantly and, if you chose to use newlib, memory allocation through malloc() etc. is re-entrant, it’s the other functions (stdio etc.) in the integration with newlib which are not reentrant.
Rob From: Rob Meades
Just to be clear on this, is it true that re-entrancy is not supported by Zephyr for any of the newlib stdio.h or stdlib.h functions, so not just the likes of strok() but also snprintf() and, more fundamentally, malloc()/free()?
If this is the case, are there any other C libraries (so not newlib) for which Zephyr does support re-entrancy and which fulfil the same functions?
Rob From: Dave Nadler <drn@...>
*** This is an EXTERNAL email. It was sent from outside of u-blox. *** Hi Rob - Went through this a few years back with FreeRTOS.
On 3/11/2021 1:04 PM, Rob Meades via lists.zephyrproject.org wrote:
Thanks for the swift response. That's a shame.I will go look at the PR at your link as shifting to the re-entrant versions just for Zephyr is going to be painful.Rob-----Original Message-----From: users@... <users@...> On Behalf Of Kumar GalaSent: 11 March 2021 17:54To: Rob Meades <Rob.Meades@...>Cc: users@...Subject: Re: [Zephyr-users] C library re-entrancy under Zephyr*** This is an EXTERNAL email. It was sent from outside of u-blox. ***Re-entrant support between newlib and zephyr is not currently supported.There’s an old PR on the subjecthttps://github.com/zephyrproject-rtos/zephyr/pull/21518- kOn Mar 11, 2021, at 11:51 AM, Rob Meades via lists.zephyrproject.org <Rob.Meades=u-blox.com@...> wrote:Should I expect C library functions (e.g. strtok()) under Zephyr to be re-entrant or must I call the re-entrant versions (i.e. in this case strtok_r())?I ask because I am building/running nRF52840 (cortex-m4) and strok() _appears_ to NOT be re-entrant: I'd like to understand if this is expected or if I've messed up a configuration somewhere. My prj.conf file is attached in case it is helpful in answering the question.Rob<prj.conf>
-- Dave Nadler, USA East Coast voice (978) 263-0097, drn@..., Skype Dave.Nadler1
|
|