DSPRelated.com
Forums

Memory Allocation :Help

Started by deepti_d_r May 8, 2007
Hi all

I am working on C6416 DSK Simulator. I am trying to port a code written
in C, developed for video coding (H.264 based ) of frame size qcif
(176x144). Right now am trying to port only the code for a single
frame as a starting. I am inputing the frame as *.h file.

My problem is after coding a few blocks of the input image, it is
giving error
"May be stack overflow or memory access violation "...

Can somebody help plz let me know if is this problem because of no
proper stack allocation. what are the things i should take care while
writing cmd file ? Like how can i decide on my stack size if i am using
c6416.

One more thing is can i use Dynamic memory allocation as we use in C ???

Please help

regards
deepti
Deepti,

The error "stack overflow " you are getting is due to use of stack more than
specified in the linker command file.
Stack has critical role at the time of context switching, try to look in
your code that you are not putting a lot of data (like any big size array or
structure) on the stack, also you can increase/decrease the size of
system-stack as well as task-stack through cdb or cmd file
.
The error "memory access violation " is due to access of any memory location
which is not defined in the cmd file or trying to write a read-only memory
location.

Writing a cmd file is very simple, a lot of examples and application notes
are available, you can pick them and tweak it according to your requirement.
some things you need to keep in mind when you are porting a plain C code on
a processor specific platfrom is the availble memory, support for runtime
routines etc.

yes you can use the dyamnic memory allocation as you use in C, the
corresponding API's in the DSP-BIOS are MEM_alloc, MEM_free etc. remember
that these allocation are from heap area so you need to define the optimum
size of heap in the cdb or cmd file.

On 5/8/07, deepti_d_r wrote:
>
> Hi all
>
> I am working on C6416 DSK Simulator. I am trying to port a code written
> in C, developed for video coding (H.264 based ) of frame size qcif
> (176x144). Right now am trying to port only the code for a single
> frame as a starting. I am inputing the frame as *.h file.
>
> My problem is after coding a few blocks of the input image, it is
> giving error
> "May be stack overflow or memory access violation "...
>
> Can somebody help plz let me know if is this problem because of no
> proper stack allocation. what are the things i should take care while
> writing cmd file ? Like how can i decide on my stack size if i am using
> c6416.
>
> One more thing is can i use Dynamic memory allocation as we use in C ???
>
> Please help
>
> regards
> deepti
>
>
>

--
Regards,

Sukesh