Using newlib

Toolchains may provide a set of utilities, which often include dynamic memory allocation mechanisms. GCC-based toolchains for microcontrollers include a reduced set of standard C calls, usually in the built-in standard C library. A popular choice, often included in the ARM-GCC embedded toolchain, is newlib. While providing the implementation of many standard calls, newlib remains as flexible as possible, by allowing customization of the operations involving the hardware. The newlib library can be integrated in both single-thread bare-metal applications and in a real-time operating system, provided that the required system calls are implemented.

In the case of malloc, newlib requires an existing implementation of the sbrk function. ...

Get Embedded Systems Architecture now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.