问题
Is there any stdlib-like library for bare-metal programming?
I am trying to build a program (supposed to be built on linux) for bare-metal environment. The program is dependent on stdlib and posix lib (malloc, calloc, realloc, free, and pthread usage). I will modify it for single thread anyway.
I was reading https://www.ibm.com/developerworks/aix/tutorials/au-memorymanager/ and maybe I will implement my own memory management. But in my case the program has malloc/realloc/free s of various sizes. If there is any program (open source) supporting memory management (and hopefully pthread too.) please give me an advice. The language is C.
回答1:
For the memory allocation functions, you should be able to adapt Doug Lea's public domain dlmalloc implementation. Read the file for details, but you will need to supply a function for MORECORE
that requests a chunk of memory - if you're on bare metal then this will probably just return consecutive blocks starting above the location your code is loaded.
来源:https://stackoverflow.com/questions/44193992/stdlib-like-library-on-bare-metal-environment-memory-management-and-hopefully