Tool/software: Code Composer Studio
I'm trying to use the ROV to debug an issue with a semaphore not firing when I expect it to. When I start up the ROV I see the following in the BIOS->Scan for errors tab:
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.
Tool/software: Code Composer Studio
I'm trying to use the ROV to debug an issue with a semaphore not firing when I expect it to. When I start up the ROV I see the following in the BIOS->Scan for errors tab:
I've confirmed that the errors are present as soon as soon as the first breakpoint I can set after BIOS_Start() trips in my application.
I ran the simple_peripheral example on our custom board, and when I set a breakpoint at the beginning of SimplePeripheral_taskFxn() and launch the RoV, there are no errors. I can't do a whole lot more with an unmodified simpe_peripheral example because of hardware difference between the LaunchPad and our custom board.
One thing that's probably worth bringing up, is that I've changed the Heap manager configuration in our application. Considering the memory that RoV is complaining about is out in the heap, I'm thinking this could be a factor.
The simple_peripheral example has this heap configuration:
var HEAPMGR_CONFIG = 0x00;
Our custom application uses the auto-size heap option:
var HEAPMGR_CONFIG = 0x80;
I finally got around to digging into this a little further. It's definitely the heap configuration that is throwing things for a loop. If I switch back to the static osal Heap manager config (HEAPMGR_CONFIG = 0x00) I don't see any issues in the RoV.
When I use the static heap size I'm seeing some weird behavior, with the default size of 30,000 bytes I get:
20012cf8 heapEnd 2000c2cb heapStart
Which is 27181 bytes, where's the rest going? Overhead?
If change the heap size to 20000 (var HEAPMGR_SIZE = 20000), the heap actually gets bigger:
20012cf8 heapEnd 20009bbb heapStart
This comes out to 37181 bytes. Since this is exactly 10,000 bytes bigger than the previous config, I'm thinking something is messed up with my heap configuration. It seems like heapEnd and heapStart are actually being auto-sized to use all remaining RAM, and there's a second heap somewhere that's getting allocated based on HEAPMGR_SIZE. I'm basing this off of the heap size I calculated from heapEnd - heapStart growing by the same amount I decreased HEAPMGR_SIZE by.
here's the full heap section of my *.cfg file:
var Memory = xdc.useModule('xdc.runtime.Memory');
// JDM: TI ROV tool doesn't work with SDK 1.6 when auto heap size (0x80) is used
// Also, with static (0x0) heap size, the HEAPMGR_SIZE doesn't always allocate the right amount of RAM to the heap
//var HEAPMGR_CONFIG = 0x80;
var HEAPMGR_CONFIG = 0x0;
var HEAPMGR_SIZE = 30000;
if (typeof HEAPMGR_CONFIG === 'undefined' )
{
var HEAPMGR_CONFIG = 0x80;
}
// The following will create the #define HEAPMGR_CONFIG. It can then be used by include <xdc/cfg/global.h>
Program.global.HEAPMGR_CONFIG = HEAPMGR_CONFIG;
if (HEAPMGR_CONFIG === 1 || HEAPMGR_CONFIG === 0x81)
{
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams = new HeapMem.Params();
if (HEAPMGR_CONFIG === 0x1)
{
heapMemParams.size = HEAPMGR_SIZE;
Program.global.HEAPMGR_SIZE = HEAPMGR_SIZE;
}
else
{
// if you get an undefined error for the symbol bellow it means that AUTOHEAPSIZE has been defined in the application.
Program.global.HEAPMGR_SIZE = 0;
heapMemParams.usePrimaryHeap = true;
HeapMem.primaryHeapBaseAddr = "&heapStart";
HeapMem.primaryHeapEndAddr = "&heapEnd";
}
Program.global.stackHeap = HeapMem.create(heapMemParams);
var HeapCallback = xdc.useModule('ti.sysbios.heaps.HeapCallback');
var params = new HeapCallback.Params();
params.arg = 1;
Program.global.heap0 = HeapCallback.create(params);
HeapCallback.initInstFxn = '&myHeapMemInitFxn'; // Call First When BIOS boot. Initialize the Heap Manager.
HeapCallback.allocInstFxn = '&myHeapMemAllocFxn'; // Call for allocating a buffer
HeapCallback.freeInstFxn = '&myHeapMemFreeFxn'; // Call for Freeing a buffer
HeapCallback.getStatsInstFxn = '&myHeapMemGetStatsFxn'; // Return Statistic on the Heap.
HeapCallback.isBlockingInstFxn = '&myHeapMemIsBlockingFxn'; // Return TRUE: This heap is always blocking ('Hwi Gate' like )
Memory.defaultHeapInstance = Program.global.heap0;
}
else if (HEAPMGR_CONFIG === 2 || HEAPMGR_CONFIG === 0x82)
{
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams = new HeapMem.Params();
if (HEAPMGR_CONFIG === 2)
{
heapMemParams.size = HEAPMGR_SIZE;
Program.global.HEAPMGR_SIZE = HEAPMGR_SIZE;
}
else
{
// if you get an undefined error for the symbol bellow it means that AUTOHEAPSIZE has been defined in the application.
//
heapMemParams.usePrimaryHeap = true;
HeapMem.primaryHeapBaseAddr = "&heapStart";
HeapMem.primaryHeapEndAddr = "&heapEnd";
Program.global.HEAPMGR_SIZE = 0;
}
var tempHeap = HeapMem.create(heapMemParams);
var HeapTrack = xdc.useModule('ti.sysbios.heaps.HeapTrack');
HeapTrack.common$.diags_ASSERT = xdc.module("xdc.runtime.Diags").ALWAYS_ON;
var heapTrackParams = new HeapTrack.Params();
heapTrackParams.heap = tempHeap;
Program.global.stackHeap = HeapTrack.create(heapTrackParams)
var HeapCallback = xdc.useModule('ti.sysbios.heaps.HeapCallback');
var params = new HeapCallback.Params();
params.arg = 1;
Program.global.heap0 = HeapCallback.create(params);
HeapCallback.initInstFxn = '&myHeapTrackInitFxn'; // Call First When BIOS boot. Initialize the Heap Manager.
HeapCallback.allocInstFxn = '&myHeapTrackAllocFxn'; // Call for allocating a buffer
HeapCallback.freeInstFxn = '&myHeapTrackFreeFxn'; // Call for Freeing a buffer
HeapCallback.getStatsInstFxn = '&myHeapTrackGetStatsFxn'; // Return Statistic on the Heap.
HeapCallback.isBlockingInstFxn = '&myHeapTrackIsBlockingFxn'; // Return TRUE: This heap is always blocking ('Hwi Gate' like )
Memory.defaultHeapInstance = Program.global.heap0;
}
else if (HEAPMGR_CONFIG === 0 || HEAPMGR_CONFIG === 0x80)
{
var HeapCallback = xdc.useModule('ti.sysbios.heaps.HeapCallback');
var params = new HeapCallback.Params();
params.arg = 1;
Program.global.heap0 = HeapCallback.create(params);
HeapCallback.initInstFxn = '&osalHeapInitFxn'; // Call First When BIOS boot. Initialize the Heap Manager.
HeapCallback.allocInstFxn = '&osalHeapAllocFxn'; // Call for allocating a buffer
HeapCallback.freeInstFxn = '&osalHeapFreeFxn'; // Call for Freeing a buffer
HeapCallback.getStatsInstFxn = '&osalHeapGetStatsFxn'; // Return Statistic on the Heap.
HeapCallback.isBlockingInstFxn = '&osalHeapIsBlockingFxn'; // Return TRUE: This heap is always blocking ('Hwi Gate' like )
//HeapCallback.createInstFxn = '&osalHeapCreateFxn'; // Not Supported
//HeapCallback.deleteInstFxn = '&osalHeapDeleteFxn'; // Not supported
Memory.defaultHeapInstance = Program.global.heap0;
if (HEAPMGR_CONFIG === 0)
{
// the following definition will create the #define HEAPMGR_SIZE ,
// which is used by thestack to have information about the heap manager size.
// if set to 0, this imply auto-size heap
Program.global.HEAPMGR_SIZE = HEAPMGR_SIZE;
}
else
{
// the following definition will create the #define HEAPMGR_SIZE ,
// which is used by the stack to have information about the heap manager size.
// if set to 0, this imply auto-size heap
// The heap buffer will be created automaticaly by using all the remaiing RAM available at the end of the build/link.
// For this, 2 symbole needs to be created by teh linker file: heapStart and heapEnd
Program.global.HEAPMGR_SIZE = 0;
}
}
I probably should have looked a little closer at the documentation before that last post, whoops.
I just noticed the warning in the dynamic memory allocation section. So, from what I can gather heapStart and heapEnd only need to be defined in the linker if auto-size heap is being used. My linker has those symbols defined, so they're being allocated all leftover RAM, which explains why I was thinking the static heap allocation was screwed up. I undefined those symbols and rebuilt, they no longer show up in the map file and my project still works. I don't see where the heap is actually being allocated in the map file...but I haven't went over it in great detail. From looking at the amount of unallocated RAM between builds with different heap sizes I can at least infer that its being allocated to the correct size.
The one item that's still open, is why does ROV throw errors when I use the auto-size heap? I see a disclaimer in the documentation about ROV Classic having issues, but nothing saying the new ROV shouldn't work with an auto-sized heap.