I'm using the TI-RTOS and the F28377D Chip with an external memory device attached. I've already configured and can use the external memory to store data or execute code but I have a couple of questions.
After I setup the pins and registers to support the EMIF1 interface to the External Asynchronous RAM I create an HeapMem_Handle to the starting at the linker location for the external memory data section. This returns a valid handle.
Currently I'm doing the following for creating the handle:
HeapMem_Params_init(¶ms);
params.buf = &extHeapStart;
params.size = 0xF0000; //TODO Determine how to get this programmatically
ext_mem_part_id = HeapMem_create(¶ms, NULL);
When I used the extHeapSize variable that I created in the linker file I got the size equal to the global variables that I manually allocated to this heap not the size of the memory region which is what I want as I need to be able to allocate data off of this heap.
1. Is there a way to get my heap's full size programmatically rather than the hard coded value which is much less maintainable?
I have multiple tasks running in the system and each task has it's own stack. I want to allocate some or all of these off of the external heap I've set up due to their sizes. I tried the following in the task creation:
Task_Params_init(¶ms);
params.stackSize = stack_size;
params.priority = priority;
params.arg0 = arg1;
#ifdef USE_EXT_RAM
//Use the External Memory
if(opts == 1) {
params.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(ext_mem_part_id);
}
#endif
task_id = Task_create((Task_FuncPtr)func, ¶ms, NULL);
When I try to run the program I get the following exception:
[C28xx_CPU1] ti.sysbios.family.c28.TaskSupport: line 114: Stack (0x110000) not located on PAGE 0 (stack must be located entirely below 0x10000)
xdc.runtime.Error.raise: terminating execution
I've tried moving the heap to PAGE 0 but I got the same error. Is it possible to use the external memory which starts after 0x10000?
Finally I'm trying to get the statistics on how much memory is actually being used.
I've run: HeapMem_getStats(ext_mem_part_id, &stats);
res = HeapMem_isBlocking(ext_mem_part_id);
HeapMem_getExtendedStats(ext_mem_part_id, &ext_stats);
The values I get don't make sense:
stats.totalSize = 983040 (0xF0000)
stats.totalFreeSize = 1134516288 (0x439F5840)
stats.largestFreeSize = 1134516288 (0x439F5840)
is Blocking = True
ext_stats.buf = 0x110000
ext_stats.size = 983040 (This one prints out incorrectly in my sprintf function)
Is there something I need to do in order to get valid statistics from external memory?
Thanks,
Anthony