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.

TM4C1294NCPDT: RTOS: Checking Heap level over time during the run.

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: SYSBIOS

Based on setup

* : CCS 11.0 Or latest version.
* : Complier TI x20.2.6.LTS Or latest version.
* : XDCTools 3.32.2.25
* : TI-RTOS for TivaC <tirtos_tivac_2_16_01_14> 
* : TivaWare_C_Series 2.1.1.71b 

I wish to check heap from time to time temporary during runtime and then remove it.

I have reviewed the SPRUEX3P, page 166 mentioned about HeapTrack and 

file:///E:/010_WorkAOT/011MyGit20/106-TM4C_2021/tirtos_tivac_2_16_01_14/products/bios_6_45_02_31/docs/cdoc/ti/sysbios/heaps/HeapTrack.html 

I placed the code in cfg

/* ================ Kernel (SYS/BIOS) configuration ================ */
var BIOS = xdc.useModule('ti.sysbios.BIOS');

//BIOS.assertsEnabled = true;
BIOS.assertsEnabled = false;

/*
* Specify default heap size for BIOS.
*/
//BIOS.heapSize = 5120; //ex 1024. 5120 for FATFS.
BIOS.heapSize = 10000; //Will it fix crashes?
BIOS.heapTrackEnabled = true; // RGP: 6Jan21: To debug Heap operation ,remove when not needed.

BIOS.includeXdcRuntime = false;
//BIOS.includeXdcRuntime = true;
......

//----------------------------------------------Heap Debug
#include <ti/sysbios/heaps/HeapTrack.h>         // to debug heaps. See SPRUEX3T, page 166.
#include <xdc/runtime/IHeap.h>
#include <xdc/runtime/Memory.h>
......

HeapTrack_Handle heap;
void RFD_Heap_Init(void)
{
    //-------------------------Heap Monitor
    HeapTrack_Params prms;
    //HeapTrack_Handle heap;
    Error_Block eb;
    
    Error_init(&eb);
    HeapTrack_Params_init(&prms);
    prms.heap = heapHandle;
    heap = HeapTrack_create(&prms, &eb);
    if (heap == NULL) {
    System_abort("HeapTrack create failed");
    }
}

I'm not sure where "heapHandle" come from?, can u advise?

Thanks.

  • Hello Richard,

    I'm not really familiar with this feature in TI-RTOS but reading the document, it seems to be talking about using it with an existing heap... so that makes me think heapHandle is how you tie the tracker into the existing heap you want to track.

    I also feel maybe the document has a typo in the example and that it should be:

    HeapTrack_Params prms;
    HeapTrack_Handle heapHandle;
    Error_Block eb;
    
    Error_init(&eb);
    HeapTrack_Params_init(&prms);
    prms.heap = heapHandle;
    heap = HeapTrack_create(&prms, &eb);
    if (heap == NULL) {
     System_abort("HeapTrack create failed");
    }
    

    Sorry I don't have a more definitive answer but I will try and help brainstorm it further with you if this wasn't sufficient to get you moving forward.

    Best Regards,

    Ralph Jacobi