stdlib-like library on bare metal environment? (memory management and hopefully pthread support)

雨燕双飞 提交于 2019-12-12 05:26:41

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!