Subj : where can I find a malloc for standalone programs ? To : comp.programming From : DEMAINE Benoit-Pierre Date : Fri Aug 19 2005 08:40 pm I am writing a program for standalone use; the circuit in configured with some bootstrap, then my code is called. There is no Linux, nor filesyem, nor libraries around. my code is statically compiled and linked with gcc. problem occurs about malloc: since there is no kernel, nor system, nor stdlib, there is no malloc defined. I can not either link my application against a stdlib stolen to any system, since I have no kernel, and that stdlib would not know the addresses of memory pages available. Thus, I need a new malloc that is initialised by a special initialisation call, with begin and end adresses of memory space, and implements malloc() and free(), and is aware of endianness, bus width, alignment problems ... It would be a plus if some internal function could return the amount of alocated zones, so that I can track memory consumption, and expect/track leakages. The memory pages available are not all memory locations wired on the board. the bootstrap requires about 50% for internal use, and interrupt management. I have the upper 50% for me. The CPU stack is stored somewhere else, not sure exactly where in fact :S Problem is that my code requires some bits of dynamically allocated variables and arrays, so that I really need malloc; I hope I spend less time implementing malloc than trying to port the code to use only fixed allocations. Inside my zone, I need to allocate for personnal use some pages (about 200kB, to store constants, and exchange values with interrupts). These pages shall NOT be managed by malloc; they are managed manually when I write my source. I am using at the moment GCC-bare-metal from http://www.codesourcery.com/gnu_toolchains/arm/, with Gentoo-x86 as host, and a Cogent CSB336 MC9328MXL as target: ARM920T with RAM, FLASH, and various devices. I can only use GPL and public programs, softwares, and libraries. Thanks for any help, URL, books, sneekers, check, tip ... :p -- DEMAINE Benoit-Pierre (aka DoubleHP ) http://www.demaine.info/ \_o< If computing were an exact science, IT engineers would not have work >o_/ .