We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I want to allocate a memory in a memory pool, so I call "init_mempool" function like this:
init_mempool (&XBYTE[0x0400], 0x0C00);
How can I know that the memory pool doesn't overlay on other vars in xdata? By making the area you'll use for the mempool off-limits to the linker. Basically, you have to lie to the linker about how much xdata you actually have, so it won't use all of it. can I call init_mempool 2 times in my program? Read the manual yourself.
"Basically, you have to lie to the linker about how much xdata you actually have" Isn't there an option to tell the Linker not to use a certain area of XRAM? Look in the Manual.
How about:
#define HEAP_SIZE 0x0C00 U8 heap[HEAP_SIZE]; init_mempool( heap, HEAP_SIZE );
mempool .... the '51 ain't no PC how few do realize that? Erik
"the '51 ain't no PC" For a PC Application, the author doesn't know how much memory will be available when it actually gets run by the customer on the cusomer's equipment - so dynamic allocation makes sense. (same applies to other Computer systems) On an embedded system (especially 8051-based), the amount of memory usually is known at compile time - so dynamic allocation makes little sense (especially on an 8051-based system, where resources are generally limited).