Quantcast
Channel: Embedded Software (Read Only)
Viewing all articles
Browse latest Browse all 25965

Forum Post: RE: sys bios - iheap and dynamic memory allocation

$
0
0

Hi Arpan,

I think a better option for you is to leave the system heap as is and create a separate heap for your buffers. You can for example create a heap managed by HeapMem module and place it in XINTF Zone 7. This can be done at runtime or at build time in your *.cfg script. I have shown an example of how to create a heap at build time:

*.cfg code

var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem'); var heapMemParams = new HeapMem.Params; heapMemParams.size = <size bytes>;  heapMemParams.align = <desired alignment>; heapMemParams.sectionName = ".myHeapMemSect"; Program.global.myBufferHeap = HeapMem.create(heapMemParams); 

Using the new heap in *.c code:

#include <xdc/runtime/IHeap.h> #include <xdc/runtime/Memory.h> #include <ti/sysbios/heaps/HeapMem.h>  #include <xdc/cfg/global.h>  func() {     IHeap_Handle heap = HeapBuf_Handle_upCast(myBufferHeap);     Memory_alloc(heap, BUFSIZE, 0, NULL); }

Best,

Ashish


Viewing all articles
Browse latest Browse all 25965

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>