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.

Accessing .sysmem ?

Hi guys,

I am trying to write my own pool allocation program that allocates blocks of memory for my processes. I understand that the heap section (.sysmem) can be set at build time. Now my question is how do I access this heap with my code so I can use that memory and allocate it for my processes? I am using the LM3S9D92 and its heap/SRAM starts at 0x2000.0000. Also this is for CCSv4.

  • You'll need to replace the heap functions in the RTS library.  Look at the file memory.c in the source code for the RTS.  It uses special linker-defined symbols to find the beginning and end of the heap.  You should be able use the same expressions in your heap manager.  The symbols you are looking for are:

    _sys_memory
    __TI_SYSMEM_SIZE
    
    
  • Hi,

    what worked for me is:

    extern void * _sys_memory;         // Start of heap
    extern int __SYSMEM_SIZE;    // Size of heap

    ... and later ...

    uint32_t* Heap = (uint32_t *)(&_sys_memory);
    uint32_t* HeapEnd = (uint32_t *)(&__SYSMEM_SIZE);
       
    HeapEnd = (uint32_t *)((uint32_t)Heap + (uint32_t)HeapEnd);

    (it would recognize _sys_memory but not __TI_SYSTEM_SIZE)

    thank you for pointing me in the right direction

    Imran