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.

RTOS/TM4C1294NCPDT: HeapTrack doesn't work with SDRAM?

Part Number: TM4C1294NCPDT

Tool/software: TI-RTOS

tm4c1294ncpdt
CCS6.1.3
tirtos_tivac_2_10_01_38
compiler: TI V5.1.11
XDC: 3.30.4.52

I have a board with SDRAM at 0x60000000 and size is 8M and a memheap is dynamically created on the whole RAM. Originally HeapTrack is not enabled in .cfg. Today I enabled it trying to debug, and found that ROV detected the heap is corrupted. Please see the snampshot below for details.

The code to create heap is:

int NonCriticalMemInit(void)
{
  HeapMem_Params prms;
  Error_Block eb;
  
  Error_init(&eb);
  HeapMem_Params_init(&prms);
  
  prms.size = GetSdRamTotalSize();
  prms.buf = (Ptr)GetSdRamStartAddr();
  
  heapMemNonCritical0 = HeapMem_create(&prms, &eb);

  return NULL != heapMemNonCritical0;
}


If I place a breakpoint at the last line of the above function, I could see the error in ROV. So does it mean HeapTrack can't work with SDRAM, or is there anything wrong when creating the heap?

Thanks

  • First of all the error is for HeapMem and not HeapTrack. What is the value of heapMemNonCritical0?

    How are you "enabling" HeapTrack? If you are just setting the following, this only enables HeapTrack to reside on top of the default heap. Do you have a default heap? Look in ROV->HeapMem...how many instances are there?
  • Oops...forgot the "following". If you are setting this in the .cfg, it only plugs HeapTrack on top of the default heap.

    BIOS.heapTrackEnabled = true;
  • Please see the update snapshot. The value of "heapMemNonCritical0" is 0x20000820 in this new snapshot (and was 0x2000850 in the old one. I don't know why the value changes today.

    Yes, Heaptrack is enabled by "BIOS.heapTrackEnabled = true;" in .cfg.

    There are two instances of heap, one for default and the other for the SDRAM.

    The ROV detects this error immediately after the heap is created, without any alloc and free.

  • Can you view 0x60000000 in a CCS memory browser? What are the first two 32-bit words at that address (I'm assuming it will be zero and 8388608) ? I'm thinking that ROV does not know that memory exists and therefore cannot parse it. Do you have that memory in your linker file?

    Todd

  • Yes, you are right. They are 0 and 0x800000. SDRAM is not in linker file.

    If I add SDRAM into linker file, there is still error.

    MEMORY
    {
    ...
    SRAM (RWX) : origin = 0x20000000, length = 0x00040000
    SDRAM (RW) : origin = 0x60000000, length = 0x00800000
    }

    So how?

  • Hi Jianyi,

    I'm not sure what is wrong? Can you confirm a couple things
    1. You are able to allocate memory from the heap in SDRAM?
    2. If you do have "BIOS.heapTrackEnabled = true;" you get the above errors in ROV. If you have it set to false, you get no errors in ROV.

    After the SDRAM heap is created can you get snapshots of both ROV->HeapMem ->Detailed and ROV->HeapMem ->Basic and attach them.

    Todd
  • 1. SDRAM could be used. I have been using it for years and things seem fine.
    2. When heaptrack is not enabled, there is still such an error. But it looks fine to use API to get heap status, such as "HeapMem_getStats"

  • Thanks. So HeapTrack is not part of the issue and the actual code is working well...good.

    I need to check with someone about this. I thought adding the segment into the linker file should have fixed this. I should have an answer (or a follow-up guestion) soon.

    Todd
  • Hi Jianyi,

    Okay. It looks like just adding it into the linker file is not enough. There needs to be a section associated with it. Can you try adding this into your .cfg file?

    var Model = xdc.module("xdc.rov.Model");
    var memReader = Model.getMemoryImageInst();
    var sections = memReader.getSections();
    sections.addSection(base, end-base); // where base is 0x60000000 and end-base is 0x60800000

    Hopefully this fixes ROV. It will have no impact on the target code (but it might be good to do a diff of the map file before and after this change...just to be safe).

    Todd
  • memReader.getSections(): function "getSections()" is not found.

  • Sorry. I should have tried it on your version. We are fixing it in a newer version of XDCtools that is unfortunately not compatible with your TI-RTOS. Without making changes to the installed TI-RTOS product, there is no way to fix the ROV issue you are seeing. Let me know if you deem it important enough to fix the ROV tool for this and I can send you the work-around.

    Todd
  • Thanks. Please send me the workaround and I try to fix it.

  • After updating to tirtos_tivac_2_16_01_14 (the newest version I could find), and the xdc to xdctools_3_32_00_06_core, still it can't find function getSections(). So is this fixed in a very new version?