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.

IWR1642BOOST: Memory issues while running custom code in IWR1642BOOST

Part Number: IWR1642BOOST
Other Parts Discussed in Thread: SYSBIOS

Tool/software:

Hi, 

I have a very simple main code as shown below. When I try to debug this code, I see the stack overrun and heap has no free memory. I am using mmWave SDK or BIOS functions as it is.  Can you help me debug this further. All the details are given below 

main.c


#define UNUSED(x) x = x
#define NAMELEN 16
#include <xdc/runtime/System.h>
/* mmWave SK Include Files: */
#include <ti/common/sys_common.h>
#include <ti/drivers/soc/soc.h>
#include <ti/drivers/uart/UART.h>
#include <ti/drivers/pinmux/pinmux.h>
#include <ti/drivers/esm/esm.h>
#include <xdc/std.h>
#include <stdio.h>

#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Event.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/heaps/HeapBuf.h>
#include <ti/sysbios/heaps/HeapMem.h>
#include <ti/sysbios/knl/Event.h>
#include <ti/sysbios/family/arm/v7a/Pmu.h>
#include <ti/sysbios/hal/Timer.h>

/* mmWave SDK Include Files: */
#include <ti/common/sys_common.h>
#include <ti/common/mmwave_sdk_version.h>
#include <ti/drivers/soc/soc.h>
#include <ti/drivers/esm/esm.h>
#include <ti/drivers/crc/crc.h>

uint32_t gCPUClockFrequency = (200 * 1000000);
/* Global Variable which holds the DMA Instance */
DMA_Handle gDMAHandle;

int main(int argc, char **argv)
{
SOC_Handle socHandle;
SOC_Cfg socCfg;
DMA_Params dmaParams;

int k = 0;
/* Initialize the ESM: Dont clear errors as TI RTOS does it */
ESM_init(0U);
/* Initialize the SOC confiugration: */
memset ((void *)&socCfg, 0, sizeof(SOC_Cfg));

/* Populate the SOC configuration: On the EVM we want to ensure that the BSS is
* executing and the system clock is correctly configured. */
socCfg.clockCfg = SOC_SysClock_INIT;

/* Initialize the SOC Module: This is done as soon as the application is started
* to ens ure that the MPU is correctly configured. */


socHandle = SOC_init (&socCfg, &errCode);
BIOS_start();
return 0;
}

HWI   

Heap 

Cfg file is as below 

environment['xdc.cfg.check.fatal'] = 'false';
/********************************************************************
************************** BIOS Modules ****************************
********************************************************************/
var Memory = xdc.useModule('xdc.runtime.Memory');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Idle = xdc.useModule('ti.sysbios.knl.Idle');
var SEM = xdc.useModule('ti.sysbios.knl.Semaphore');
var Event = xdc.useModule('ti.sysbios.knl.Event');
var Hwi = xdc.useModule('ti.sysbios.family.arm.v7r.vim.Hwi');
var System = xdc.useModule('xdc.runtime.System');
var SysStd = xdc.useModule('xdc.runtime.SysStd');
var clock = xdc.useModule('ti.sysbios.knl.Clock');
var Pmu = xdc.useModule('ti.sysbios.family.arm.v7a.Pmu');
var Load = xdc.useModule('ti.sysbios.utils.Load');
// var timer = xdc.useModule('ti.sysbios.hal.Timer');
System.SupportProxy = SysStd;
/* FIQ Stack Usage: */
Hwi.fiqStackSize = 2048;
Hwi.fiqStackSection = ".myFiqStack"
Program.sectMap[".myFiqStack"] = "DATA_RAM";
/* Default Heap Creation: Local L2 memory */
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 32*1024;
heapMemParams.sectionName = "systemHeap";
Program.global.heap0 = HeapMem.create(heapMemParams);
Memory.defaultHeapInstance = Program.global.heap0;
/* Enable BIOS Task Scheduler */
BIOS.taskEnabled = true;
/* Reduce the size of BIOS */
BIOS.swiEnabled = false; /* We don't use SWIs */
BIOS.libType = BIOS.LibType_Custom;
Program.stack = 2048; /* for isr context */
Task.idleTaskStackSize = 800;
var Text = xdc.useModule('xdc.runtime.Text');
Text.isLoaded = false;
/* do not call update for load - Application will call it at inter-frame boundary */
Load.updateInIdle = false;
/* Install idle function to sleep the R4F (using WFI instruction). Note above
Load.updateInIdle is false which allows to sleep the R4F in idle.
Also, no other book-keeping etc functions should be installed in the idle thread */
//Idle.addFunc('&MmwDemo_sleep');
Program.sectMap[".vecs"] = "VECTORS";
/* Make sure libraries are built with 32-bit enum types to be compatible with DSP enum types*/
BIOS.includeXdcRuntime = true;
BIOS.libType = BIOS.LibType_Custom;
BIOS.customCCOpts += " --enum_type=int ";
/********************************************************************
* Enabling DebugP Log Support
********************************************************************/
var Log = xdc.useModule('xdc.runtime.Log');
var Main = xdc.useModule('xdc.runtime.Main');
var Diags = xdc.useModule('xdc.runtime.Diags');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
/* Configure the Logger Buffer: */
var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.bufType = LoggerBuf.BufType_CIRCULAR;
loggerBufParams.exitFlush = false;
loggerBufParams.instance.name = "_logInfo";
loggerBufParams.numEntries = 200;
/* Create the Logger and attach this to the application */
MyAppLogger = LoggerBuf.create(loggerBufParams);
Main.common$.logger = MyAppLogger;
Main.common$.diags_USER1 = Diags.RUNTIME_ON;
Task.common$.diags_USER1 = Diags.RUNTIME_ON;
Thanks in Advance 
  • Hi,

    We do not help debug custom software on this forum. Can you start with the one of the drivers projects, maybe the GPIO or something small, and see if that works?

    Best,

    Nate

  • Hi Nathan,

    My final requirement is to do a custom Code debugging. However the steps mentioned in previous mail, I gave is simplified code which only have TI code. If you see my main() I only have 3 function ESM_init(0), SOC_Init(0) and BIOS_Start(). All 3 functions are taken from mmWave SDK.. The config file used is also taken from mmWave OOB demo as it is. Is there any other factor that can contribute to the memory overflow and no heap memory available. 

    I tried drivers as you mentioned earlier however I got into multiple issues for which I have created seperate queries. But i think both the issues are mutually exclusive and hence simplified the code for better debugging. 

    Thanks 

    Regards

    Gayatri