Use weak functions in the RTEMS core?

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Apr 8 15:28:30 UTC 2020


Hello,

another use case for a weak function could be the heap. If you only 
allocate memory and never free it, then the implementation can be very 
simple:

https://git.rtems.org/rtems/tree/cpukit/score/src/memoryallocate.c#n49

We could use something like this in heapallocate.c:

RTEMS_WEAK void *_Heap_Allocate_impl(size) { /* Very simple */ }

void *_Heap_Allocate(size)

{

   return _Heap_Allocate_impl(size)

}

In heapfree.c:

void *_Heap_Allocate_impl(size) { /* Complex */ }



More information about the devel mailing list