I have just finished my encoder and decoder implementation on TMS320C6713
DSK.
I have some things that are not clear in my mind. ==>
## What is method to calculate heap and stack sizes?
## What will be effect of larger heap and stack size allocation than required?
Will it improve performance in terms of cycles?
## Do I need to allocate some arbitrary space in memory for uninitialized length
0 sections?
Thanks and Regards,
Nilesh
How to do heap and stack size calculation?
Started by ●March 5, 2007
Reply by ●March 5, 20072007-03-05
Hi Nilesh,
At 21:43 04.03.2007 -0800, H.264encoderondm642 wrote:
>I have just finished my encoder and decoder implementation on TMS320C6713 DSK.
>I have some things that are not clear in my mind. ==>## What is method to calculate heap and stack sizes?
Heap: sum up all memory allocations like malloc, calloc, etc.
You may also use the memmap() function from the runtime library sources
(rts.src) to display allocated and free heap blocks in your program (does
not work with DSP/BIOS).
Stack: all local variables, intermediate storage for registers, and
function parameters (if you have some functions with a lot of parameters).
The easiest way to determine the required stack size is filling the stack
memory area with a bitpattern in Code Composer, load and run the program,
and finally check how many stack space was actually used. Make sure that
all functions have been called during this test, and add some safety margin.
>## What will be effect of larger heap and stack size allocation than
>required? Will it improve performance in terms of cycles?
No, but the location of these memory sections will affect performance.
Internal L2RAM memory is - as always - the best option. If in external
memory (SDRAM) make sure that at least L1-cache is enabled for these areas.
>## Do I need to allocate some arbitrary space in memory for uninitialized
>length 0 sections?
No.
Best Regards,
Adolf Klemenz, D.SignT
-------------------------------
D.SignT - Digital Signalprocessing Technology GmbH & Co. KG
Adolf Klemenz
Gelderner Str.36
D-47647 Kerken
phone (+49)(0)2833/570-976
fax (+49)(0)2833/3328
email mailto:a...@dsignt.de
web http://www.dsignt.de
-------------------------------
At 21:43 04.03.2007 -0800, H.264encoderondm642 wrote:
>I have just finished my encoder and decoder implementation on TMS320C6713 DSK.
>I have some things that are not clear in my mind. ==>## What is method to calculate heap and stack sizes?
Heap: sum up all memory allocations like malloc, calloc, etc.
You may also use the memmap() function from the runtime library sources
(rts.src) to display allocated and free heap blocks in your program (does
not work with DSP/BIOS).
Stack: all local variables, intermediate storage for registers, and
function parameters (if you have some functions with a lot of parameters).
The easiest way to determine the required stack size is filling the stack
memory area with a bitpattern in Code Composer, load and run the program,
and finally check how many stack space was actually used. Make sure that
all functions have been called during this test, and add some safety margin.
>## What will be effect of larger heap and stack size allocation than
>required? Will it improve performance in terms of cycles?
No, but the location of these memory sections will affect performance.
Internal L2RAM memory is - as always - the best option. If in external
memory (SDRAM) make sure that at least L1-cache is enabled for these areas.
>## Do I need to allocate some arbitrary space in memory for uninitialized
>length 0 sections?
No.
Best Regards,
Adolf Klemenz, D.SignT
-------------------------------
D.SignT - Digital Signalprocessing Technology GmbH & Co. KG
Adolf Klemenz
Gelderner Str.36
D-47647 Kerken
phone (+49)(0)2833/570-976
fax (+49)(0)2833/3328
email mailto:a...@dsignt.de
web http://www.dsignt.de
-------------------------------
Reply by ●March 5, 20072007-03-05
Hi Adolf--
On 3/5/07, Adolf Klemenz wrote:
...
...
...
> >## What will be effect of larger heap and stack size allocation than
> >required? Will it improve performance in terms of cycles?
>
> No, but the location of these memory sections will affect performance.
> Internal L2RAM memory is - as always - the best option. If in external
> memory (SDRAM) make sure that at least L1-cache is enabled for these areas.
I guess you meant "L2-cache enabled" rather than "L1-cache enabled"
unless if you were talking about C64x+ devices. In case of C64x L1
cache is always ON. Just to clarify.
--Bhooshan
On 3/5/07, Adolf Klemenz wrote:
...
...
...
> >## What will be effect of larger heap and stack size allocation than
> >required? Will it improve performance in terms of cycles?
>
> No, but the location of these memory sections will affect performance.
> Internal L2RAM memory is - as always - the best option. If in external
> memory (SDRAM) make sure that at least L1-cache is enabled for these areas.
I guess you meant "L2-cache enabled" rather than "L1-cache enabled"
unless if you were talking about C64x+ devices. In case of C64x L1
cache is always ON. Just to clarify.
--Bhooshan
Reply by ●March 7, 20072007-03-07
Hi Bhooshan,
I think Nilesh is working on a 6713. On this processor you must set the
corresponding MAR register(s) to enable L1-caching for external memory.
Kind Regards,
Adolf Klemenz, D.SignT
At 22:29 05.03.2007 +0530, Bhooshan Iyer wrote:
>Hi Adolf--
>
>On 3/5/07, Adolf Klemenz wrote:
>...
>...
>...
>> >## What will be effect of larger heap and stack size allocation than
>> >required? Will it improve performance in terms of cycles?
>>
>>No, but the location of these memory sections will affect performance.
>>Internal L2RAM memory is - as always - the best option. If in external
>>memory (SDRAM) make sure that at least L1-cache is enabled for these areas.
>
>I guess you meant "L2-cache enabled" rather than "L1-cache enabled"
>unless if you were talking about C64x+ devices. In case of C64x L1
>cache is always ON. Just to clarify.
>
>--Bhooshan
>
I think Nilesh is working on a 6713. On this processor you must set the
corresponding MAR register(s) to enable L1-caching for external memory.
Kind Regards,
Adolf Klemenz, D.SignT
At 22:29 05.03.2007 +0530, Bhooshan Iyer wrote:
>Hi Adolf--
>
>On 3/5/07, Adolf Klemenz wrote:
>...
>...
>...
>> >## What will be effect of larger heap and stack size allocation than
>> >required? Will it improve performance in terms of cycles?
>>
>>No, but the location of these memory sections will affect performance.
>>Internal L2RAM memory is - as always - the best option. If in external
>>memory (SDRAM) make sure that at least L1-cache is enabled for these areas.
>
>I guess you meant "L2-cache enabled" rather than "L1-cache enabled"
>unless if you were talking about C64x+ devices. In case of C64x L1
>cache is always ON. Just to clarify.
>
>--Bhooshan
>
Reply by ●March 7, 20072007-03-07
H.264,
> ## What is method to calculate heap and stack sizes?
unless you are seriously crunched for RAM, use the default sizes
> ## What will be effect of larger heap and stack size allocation than
> required? Will it improve performance in terms of cycles?
No, it will not improve performance.
the stack and Heap must be 'big enough' or the program will do strange things
when the stack and/or heap get corrupted.
Making them bigger than 'big enough' has no real effect on program execution.
Are you even using the Heap?
> ## Do I need to allocate some arbitrary space in memory for uninitialized
> length 0 sections?
Length 0 sections means those sections are empty.
So no memory allocation is needed.
R. Williams
---------- Original Message -----------
From: "H.264encoderondm642"
To: c..., c...
Sent: Sun, 4 Mar 2007 21:43:23 -0800 (PST)
Subject: [c6x] How to do heap and stack size calculation?
> I have just finished my encoder and decoder implementation on
> TMS320C6713 DSK. I have some things that are not clear
> in my mind. ==> ## What is method to calculate heap and stack sizes?
>
> ## What will be effect of larger heap and stack size allocation than
required? Will it improve performance in terms of cycles?
>
> ## Do I need to allocate some arbitrary space in memory for uninitialized
length 0 sections?
> Thanks and Regards,
> Nilesh
------- End of Original Message -------
> ## What is method to calculate heap and stack sizes?
unless you are seriously crunched for RAM, use the default sizes
> ## What will be effect of larger heap and stack size allocation than
> required? Will it improve performance in terms of cycles?
No, it will not improve performance.
the stack and Heap must be 'big enough' or the program will do strange things
when the stack and/or heap get corrupted.
Making them bigger than 'big enough' has no real effect on program execution.
Are you even using the Heap?
> ## Do I need to allocate some arbitrary space in memory for uninitialized
> length 0 sections?
Length 0 sections means those sections are empty.
So no memory allocation is needed.
R. Williams
---------- Original Message -----------
From: "H.264encoderondm642"
To: c..., c...
Sent: Sun, 4 Mar 2007 21:43:23 -0800 (PST)
Subject: [c6x] How to do heap and stack size calculation?
> I have just finished my encoder and decoder implementation on
> TMS320C6713 DSK. I have some things that are not clear
> in my mind. ==> ## What is method to calculate heap and stack sizes?
>
> ## What will be effect of larger heap and stack size allocation than
required? Will it improve performance in terms of cycles?
>
> ## Do I need to allocate some arbitrary space in memory for uninitialized
length 0 sections?
> Thanks and Regards,
> Nilesh
------- End of Original Message -------