DSPRelated.com
Forums

Heap, Stack, Global, and unions

Started by William C Bonner May 10, 2007
How efficient is the heap memory management in TI's libraries for the
6713 processor?

How much risk do I run into with a few allocations / deallocations of
large memory blocks that I'll fragment the memory and not be able to
allocate large blocks of memory?

I'm currently not explicitly using the heap, but I am using a bunch of
system calls for sprintf() sscanf() and various math functions. I don't
know what system calls may use the heap, and so I'm declaring a simple
heap size of 0x800.

I'm writing a program that needs to do several things.

In one mode it needs a large buffer of L2 Ram to run EDMA controlled
data access into, and then analyze that data.

In another it needs a large block for formatting data to be sent to the
host.

Neither operation should be running at the same time.

I could use the heap to allocate the memory, but I'm not sure how risky
the garbage cleanup might make it. I'd essentially be allocating one of
two large blocks of memory and deallocating it. I don't know if system
calls such as printf() use the heap, and would cause fragmentation, and
block future allocations.

Normally I'd simply work with a large stack and it's very nature would
allow me to know who was working with memory at the time. Since I'm
using DMA routines, and interrupt routines that respond to DMA
completion interrupts, it acts much more like a multi threaded program,
and automatic stack variables don't seem to work as well for this
process. I'm currently using a global buffer for my data acquisition.
The problem is that it uses the ram when the module is included in my
project, whether or not the data acquisition portion of the module is
running or not.

My module that does data acquisition also programs the system clocks and
helps to maintain my system time. It also controls the CPLD which lets
me control my LEDs that give simple status information to the outside world.
In general I don't like tightly linked code that uses global memory and
accesses to structure from all over the place. it seems that the
constraints of the embedded environment are forcing me in that
direction, and I'm just hoping that someone can show me an elegant way
out of my problem.