This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

HeapMin instance

Other Parts Discussed in Thread: SYSBIOS

I have a large heap on a 28335 in external SRAM.  By creating this heap, there is some configuration meta-data that is put at the very beginning of the heap instance that I would like moved to the end due to alignment issues with the blocks of memory I'm allocating.  There are only 60h words with a label _xdc_runtime_HeapMin_Instance_State_0_buf__A .  Is there any way to get the linker to put this data somewhere else other than at the very beginning of the heap?

Thanks,

Mark Takatz

  • Hi Mark,

    Can you include the code that creates the HeapMin instance in a post? Also the version of SYSBIOS.

    I'm not quite sure what you mean by "only 60h words with a label _xdc_runtime_HeapMin_Instance_State_0_buf__A". Can you include the lines from the mapfile where you see this?

    When I created a HeapMin instance with the following code,

    var HeapMin = xdc.useModule('xdc.runtime.HeapMin');
    var heapMinParams = new HeapMin.Params();
    heapMinParams.size = 256;
    heapMinParams.align = 128;
    heapMinParams.sectionName = '.myHeap';
    myHeap = HeapMin.create(heapMinParams);
    Program.sectMap['.myHeap'] = "MSARAM";

    My mapfile looks like this:

     

    .myHeap 0 00000000 00000100 UNINITIALIZED
                     00000000 00000100 swi.p28FP.obj (.myHeap)

    Todd

  • Mark,
    it seems you are creating a heap statically, right? I am guessing that from your reference to HeapMin_InstanceState_0_buf__A. So, are you seeing the configuration meta-data in the first 60h words in that buffer?

     

  • Yes, Sasha, that is correct.  Bios 6, of course, sorry if I was too ambiguous.

    What I would like to do is force that meta-data to some other location, internal SRAM if possible since I have small regions that are currently unused looking for friendly data to occupy them.  At the very least, I would like to be able to put the meta-data at the end of my heap rather than the beginning.  In particular, given a heap size of 34000h words, I'd like to increase it to 34060h words and place the 60h meta-data block at the end.  This will allow me to compact my heap significantly and, ultimately, allow me to increase another heap I have.  The latter heap does not have any alignment issues whereas the first heap is where my FFT data resides.  An 8192-point FFT (floating point) requires alignment on 8000h boundaries and, given that most of the blocks of data that I'm allocating to this heap are 4000h or 8000h, I'm left with 3FA0h unused space within the first heap (I do not have any smaller blocks that I place in it.)  Basically this will get my heap down to 30060h instead of 340060h, or allow me to double the size of one of my other allocated regions.

    Thanks...

    Mark

  • Mark,
    it's possible to allocate or even eliminate various pieces of metadata related to module instances. However, HeapMin instances are not supposed to have any metadata in their buffers (HeapMin_InstanceState_0_buf__A is a pointer to an instance0's buffer). When are you checking the content of the buffer? Is it possible that some code already allocated some memory before you looked at the buffer?

    There is a large C file in the package/cfg subdirectory of your working directory. If you can post that file or send it to me, I could look for more clues about what's happening.

  • I don't want to eliminate or access the data, I just want it placed somewhere else.  I did find the setting:

    var Memory = xdc.useModule('xdc.runtime.Memory');

    Memory.defaultHeapInstance = Program.global.<desired section>

    Mark