请教大家问题,我在OMAPL138单独调试DSP程序(使用SYSBIOS)时,在任务中使用calloc函数动态申请内存,用完后free,类似如下结构
float *x_d=(float *)calloc(len_in,sizeof(float)); //256
其他程序段。。。。。
free(x_d);
使用DSP侧单独调试功能,验证动态申请没有问题。
但是,当ARM侧加载DSP核心程序实际运行时,上述函数申请的内存好像失败,没有成功。请问是不是需要在哪里设置。
yuyinfeng1982:
补充说明
补充说明 我大约calloc 每次共计大小为5K*16bits,怀疑哪里需要配置一下 (不过疑惑的是,为何单独DSP仿真就没有问题呢?) 是不是需要在DSP.CFG中进行配置 我现在的配置为 /* * ======== Operating System Configuration ======== */ /* no rts heap */ Program.heap = 0; Program.argSize = 100; /* minimum size */ Program.stack = 0xF000; //此处修改后的值。不太懂,所以改大 /* create a default heap */ var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem'); var heapMemParams = new HeapMem.Params(); heapMemParams.size = 0xFf00; //此处修改后的值。不太懂,所以改大 var Memory = xdc.useModule('xdc.runtime.Memory'); Memory.defaultHeapInstance = HeapMem.create(heapMemParams); /* configure System module */ var SysMin = xdc.useModule('xdc.runtime.SysMin'); SysMin.bufSize = 0x1000; SysMin.flushAtExit = false; var System = xdc.useModule('xdc.runtime.System'); System.SupportProxy = SysMin; /* configure SysBios to use the lower half of Timer 1 */ var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer'); var Clock = xdc.useModule('ti.sysbios.knl.Clock'); Timer.timerSettings[1].master = true; Timer.defaultHalf = Timer.Half_LOWER; Clock.timerId = 1; /* * ======== Miscellaneous Configuration ======== */ /* set default diags mask */ var Diags = xdc.useModule('xdc.runtime.Diags'); var Defaults = xdc.useModule('xdc.runtime.Defaults'); Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF; Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF; Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF; Defaults.common$.diags_INTERNAL = Diags.ALWAYS_OFF; /* needed for asserts */ Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF; /* development only */ Defaults.common$.diags_STATUS = Diags.RUNTIME_ON; Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF; Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF; Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF; Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF; Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF; Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF; Defaults.common$.diags_INFO = Diags.ALWAYS_OFF; Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF; /* override diags mask for selected modules */ xdc.useModule('xdc.runtime.Main'); Diags.setMaskMeta( "xdc.runtime.Main", Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON ); var Registry = xdc.useModule('xdc.runtime.Registry'); Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF; Registry.common$.diags_EXIT = Diags.RUNTIME_OFF; Registry.common$.diags_INFO = Diags.RUNTIME_OFF; Registry.common$.diags_USER1 = Diags.RUNTIME_OFF; /* create a logger instance */ var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf'); var loggerBufP = new LoggerBuf.Params(); loggerBufP.numEntries = 128; /* 128 entries = 4 KB of memory */ loggerBufP.bufType = LoggerBuf.BufType_FIXED; var appLogger = LoggerBuf.create(loggerBufP); appLogger.instance.name = "AppLog_Core1"; Defaults.common$.logger = appLogger; Memory.defaultHeapSize = 0x8192; Idle.idleFxns[0] = "&LEDStatus"; Cache.initSize.l2Size = Cache.L2Size_32K;
yuyinfeng1982:
回复 yuyinfeng1982:
怎么没有人大力这个问题呢? 求解。
Tony Tang:
回复 yuyinfeng1982:
动态内存申请是在heap里,不是在stack里。