12-12-2024, 01:17 PM
Hi!
I'm working on a STM32G473 project using FreeRTOS.
Due to FLASH memory size limitations, I had to change from using Newlib to Newlib Nano-branch, and with this, I lost malloc/free heap thread safety.
With Newlib, I had the heap thread safe by implementing these functions with a FreeRTOS mutex:
void __malloc_lock(struct _reent * ptr);
void __malloc_unlock(struct _reent * ptr);
But these functions are not called from Newlib Nano.
I've googled around about Newlib Nano-branch, and some older versions does not provide this feature, but other versions seems to support it,
for example on this link: https://sourceware.org/git/gitweb.cgi?p=...3d3167e0cb
Any suggestions how I can overcome this?
I'm working on a STM32G473 project using FreeRTOS.
Due to FLASH memory size limitations, I had to change from using Newlib to Newlib Nano-branch, and with this, I lost malloc/free heap thread safety.
With Newlib, I had the heap thread safe by implementing these functions with a FreeRTOS mutex:
void __malloc_lock(struct _reent * ptr);
void __malloc_unlock(struct _reent * ptr);
But these functions are not called from Newlib Nano.
I've googled around about Newlib Nano-branch, and some older versions does not provide this feature, but other versions seems to support it,
for example on this link: https://sourceware.org/git/gitweb.cgi?p=...3d3167e0cb
Any suggestions how I can overcome this?