You previously mentioned that malloc() works. When using DSP/BIOS, all malloc calls are in routed to MEM_alloc using the location configured by "MEM.MALLOCSEG".
Calling Memory_alloc with params.seg = 0 may be allocating from a different memory segment. As all the Memory_* function calls are abstracted to call MEM_alloc, MEM_*, etc. on the devices running BIOS.
The following configuration line:
bios.MEM.MALLOCSEG = bios.DDR2
set which Segment location malloc/free calls will allocated from. In order for Memory_alloc -> MEM_alloc to allocate from the same memory heap as what was configured in bios."MEM.MALLOCSEG", you can do something as follows in your config(*.tcf):
bios.DDR2.enableHeapLabel = true;
bios.DDR2["heapLabel"] = prog.extern("SEG0");
Then in your C code, you can add the following:
extern Int SEG0;
Memory_AllocParams allocParams;
allocParams.type = Memory_CONTIGPOOL;
allocParams.flags = Memory_NONCACHED;
allocParams.align = 128;
allocParams.seg = SEG0;
tempBuf2 = (XDAS_UInt8 *)Memory_alloc( minSamples, &allocParams);
For sake of completeness, you would typically also enable a heap creation for that particular memory segment with a size as follows:
bios.DDR2.createHeap = true;
bios.IDDR2.enableHeapLabel = true;
bios.DDR2["heapLabel"] = prog.extern("SEG0");
bios.DDR2.heapSize = 0x2000;
In your case, this may not be necessary since you indicated that calling malloc works which means that a heap somewhere in your configuration was already being created for that memory segment used by malloc.