DSPRelated.com
Forums

Initializing memory

Started by Bushnaq May 21, 2008
Hello,

I am working on a project that compares the performance of FPGA's to
DSP kits. I am implementing a 2D 5/3 DWT using both kits.

I am using TMS320C6416 DSK and CCS 2.20.04

I have a limited background when it comes to either using the DSK or
CCS so please bear with me.

I am using mem_alloc in DSP/BIOS to allocate space for the pixels of
an image. My program seems to be working fine; the only problem is
that I am UNABLE TO FIND A WAY TO INITIALIZE THE HEAP? I have the
pixels of the image in a hex file, but then how do I initialize the
heap which I create with mem_alloc with the content of the hex file.

Let me be clearer. How do you initialize a segment of memory with a
large amount of a predetertmind data (whether statically or
dynamically, using memory_alloc or any other mean)??

Thank you

P.S. : let me know if I am unclear in my description....
Bushnaq,

the function calloc() allocates a section of memory from the heap and sets it to a specific
character value.
Or, do a malloc() and then memset() to allocate the memory then set it to a specific single
character value.
I.E. set the memory to a desired value just the same way you would set ANY memory/RAM to a value (or
value string).

R. Williams
---------- Original Message -----------
From: "Bushnaq"
To: c...
Sent: Wed, 21 May 2008 18:31:03 -0000
Subject: [c6x] Initializing memory

> Hello,
>
> I am working on a project that compares the performance of FPGA's to
> DSP kits. I am implementing a 2D 5/3 DWT using both kits.
>
> I am using TMS320C6416 DSK and CCS 2.20.04
>
> I have a limited background when it comes to either using the DSK or
> CCS so please bear with me.
>
> I am using mem_alloc in DSP/BIOS to allocate space for the pixels of
> an image. My program seems to be working fine; the only problem is
> that I am UNABLE TO FIND A WAY TO INITIALIZE THE HEAP? I have the
> pixels of the image in a hex file, but then how do I initialize the
> heap which I create with mem_alloc with the content of the hex file.
>
> Let me be clearer. How do you initialize a segment of memory with a
> large amount of a predetertmind data (whether statically or
> dynamically, using memory_alloc or any other mean)??
>
> Thank you
>
> P.S. : let me know if I am unclear in my description....
------- End of Original Message -------
Thanks For the prompt response.

As I said I need to initialize the memory with image pixels, minimum of 128x128 pixels. mem_valloc initialize the entire heap to one character.

I guess I can open the file through my code and extract the content, but I thought there should be an easier way to do it.

Bushnaq

Hello,
>
>I am working on a project that compares the performance of FPGA's to
>DSP kits. I am implementing a 2D 5/3 DWT using both kits.
>
>I am using TMS320C6416 DSK and CCS 2.20.04
>
>I have a limited background when it comes to either using the DSK or
>CCS so please bear with me.
>
>I am using mem_alloc in DSP/BIOS to allocate space for the pixels of
>an image. My program seems to be working fine; the only problem is
>that I am UNABLE TO FIND A WAY TO INITIALIZE THE HEAP? I have the
>pixels of the image in a hex file, but then how do I initialize the
>heap which I create with mem_alloc with the content of the hex file.
>
>Let me be clearer. How do you initialize a segment of memory with a
>large amount of a predetertmind data (whether statically or
>dynamically, using memory_alloc or any other mean)??
>
>Thank you
>
>P.S. : let me know if I am unclear in my description....
>
Bushnaq,

On 5/22/08, b...@gmail.com wrote:
>
> Thanks For the prompt response.
>
> As I said I need to initialize the memory with image pixels, minimum of
> 128x128 pixels. mem_valloc initialize the entire heap to one character.
>
> I guess I can open the file through my code and extract the content, but I
> thought there should be an easier way to do it.
>
> Bushnaq
>
> Hello,
> >
> >I am working on a project that compares the performance of FPGA's to
> >DSP kits. I am implementing a 2D 5/3 DWT using both kits.
> >
> >I am using TMS320C6416 DSK and CCS 2.20.04
> >
> >I have a limited background when it comes to either using the DSK or
> >CCS so please bear with me.
> >
> >I am using mem_alloc in DSP/BIOS to allocate space for the pixels of
> >an image. My program seems to be working fine; the only problem is
> >that I am UNABLE TO FIND A WAY TO INITIALIZE THE HEAP? I have the
> >pixels of the image in a hex file, but then how do I initialize the
> >heap which I create with mem_alloc with the content of the hex file.
> >
> >Let me be clearer. How do you initialize a segment of memory with a
> >large amount of a predetertmind data (whether statically or
> >dynamically, using memory_alloc or any other mean)??
>

You can write a script [or program] to create a large array of values that
represent your image.
like:


const unsigned char myImage[] {

255, 255, 98, 255, 60, 0, 255, 255, 255, 255, 17, 255, 255, 255, 255,
255,
255, 255, 82, 255, 255, 255, 255, 46, 255, 255, 255, 255, 255, 128, 8,
144,
1, 50, 64, 4, 192, 0, 17, 0, 3, 96, 0, 68, 16, 1, 50,
64};

mikedunn

>
> >Thank you
> >
> >P.S. : let me know if I am unclear in my description....
> >

--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php