Showing results for 
Search instead for 
Did you mean: 

Is STM32CubeIDE newlib with FreeRTOS now really thread safe?

Associate III

I'm using STM32Cube IDE with FreeRTOS. The Errata for STM32CubeIDE 1.7.0 state "70505 Implemented a newlib-malloc solution that is thread safe by default."

Is newlib truly thread safe now? As far as I can tell, when building a project in STM32CubeIDE 1.8.0 with newlib-nano (3.3.0) no __malloc_lock()/unlock() is provided. There seem to be no calls to vTaskSuspendAll() nor to vPortEnterCritical() from inside newlib. So if newlib's malloc has been made thread safe, how? And the_ sbrk() provided in the file sysmem.c does not have any reentrancy protections.

Can someone from ST provide a definitive statement about this? And best, can you provide the source code that is used to build your version of newlib?

Associate III

That's a bug in the version of newlib included with ST's latest toolchain distribution.

Associate III

Thanks. I had just reached the concusion that the lock was not being initialised. The workaround does work.

I now need to implement the mods suggested by BCowp