Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread safe Newlib Nano heap
#1
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?
Reply
#2
Writing your own wrappers and use the --wrap option of GCC?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)