uEnv.txt, CMEM and memory layout

Hello all.
I’m trying to understand the memory layout of a Beagleboard XM and how the uEnv.txt mem args affect it.
I’ve had NO luck finding any documentation on how the uEnv.txt mem arguments relate to uboot commands.

Ultimately, I’m trying to fix an error I’m seeing using CMEM which says: CMEM phys_start( 0x85000000) overlaps kernel (0x80000000 → 0x9cd00000)
I’ve tried variations on uEnv.txt scripts, the most common recommendation for DSP use being:
mem=99M@0x80000000 mem=384M@0x88000000

What do those two mem commands do?
Is that allocating 99MB of ram starting at 0x80000000 for the Angstrom kernel?
So CMEM would have access to the other 413MB?
And what is the 384M line above doing?
The latest I’ve tried is reverting to the original 128MB Beagleboard’s mem command:
mem=99M@0x80000000
But that yields the error above.

Any ideas? I’d really like to understand this better. Thanks.

-Len

Actualy, the commands means that you are allocating 99mb starting at 0x80000000 (0x80000000 to 0x86300000) and 384mb starting at 0x88000000 (0x88000000 to0x9cd00000), so the linux kernel have 483mb for it, leaving 29mb for cmem, dsp, codecs, etc (0x86300000 to 0x88000000).
But seems like the linux kernel doesn’t like segmented memory spaces and then raises the overlap error. But you can solve it easily. Just add allowOverlap=1 to cmem insmod command at a script called loadmodules.sh, located somewhere under /usr/share/ti.
Regards,

Fernando

Thanks Fernando.
Is there a reason the Kernel would need 483M?
And why break it up into two chunks, rather than just one large one?
Since posting I got one test program running that uses CMEM.
However, a different sample app dies with “Memory_getBufferPhysicalAddress> ERROR: user buffer at addr=0x42435008, size 230400 is NOT contiguous”
Still trying to wrap my head around CMEM and its mysteries.
I DID use allowOverlap successfully. I suppose that allows CMEM to allocate much of that 483M for the DSP.
-Len

My c6run exercise [1] might shed some light on the memory allocation.

–Mark

[1] http://elinux.org/EBC_Exercise_18_Using_the_DSP_for_Audio_Processing#Sharing_Memory

Hey, thanks Mark!
That IS very illuminating.
A question that it brings up:
I’m using the c6accel library but not c6run.
Do you know if there’s a similar file to the environment.sh that you reference that would declare a DSP_REGION_START_ADDR?
I’m working with another’s person’s code (OpenCV DSP Acceleration Google Code project) and trying to solve CMEM-related errors.
After reading your article it struck me that perhaps he hard-coded a DSP_REGION that is no longer valid for my Beagleboard XM.

-Len

Len, sorry but I haven’t used c6accel.

–Mark

Hi Mark,
I followed your guide at the following link:

http://elinux.org/ECE497_Notes_on_Using_the_DSP_via_c6run

When I transferred the files on my BeagleBoard-xm (with Angstrom version 2011.03) I was able to run the files _arm but when I get those errors I _dsp on the values ​​and DSP_REGION_START_ADDR DSP_REGION_END_ADDR because I get the following error when i run ./loadmodule.sh :

insmod: error inserting ‘./cmemk.ko’: -1 Bad address

and when I run ./hello_world_dsp I get the following error

CMEM Error: init: Failed to open /dev/cmem: ‘No such file or directory’
CMEM_init() failed!
Segmentation fault

The script /loadmodule.sh in /opt/home/daniel/c6run_target/ has the following lines:

These values will get filled-in/updated by the config step

DSP_REGION_START_ADDR=“0x86300000”
DSP_REGION_END_ADDR=“0x88000000”

Insert CMEM as all heap (only a portion will actually be used as such)

CMEMK_OPTS=“phys_start=$DSP_REGION_START_ADDR phys_end=$DSP_REGION_END_ADDR allowOverlap=1”

if [ -e ./cmemk.ko ]; then
insmod ./cmemk.ko ${CMEMK_OPTS}
else
modprobe cmemk ${CMEMK_OPTS}
fi

I also replaced the uImage but still get the same error.
Of different from your guide I used the last toolchain, one for my version of Angstrom.

Could you help me?