This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
To All,
I am using the CCS version Version: 4.1.0.02000. I want to otiomize the size for the heap and stack size. Currently I have allocated Heap size of 0x1000 and stack size of 0x1000.
Q.1 How can I find out the amount of heap sapace and stack is used to optimize allocation of heap sapace and stack?
Thanks.
Ashok Modi
John,
the processor I am using is LM3S9B96. One more question, Do you know, is there a document that provides the library of C function calls supported by CCS for Stellaris LM3S9B96 family? If there is one how can I download it. Thanks.
Ashok Modi
Ashok,
One thought on the stack is to reduce it and then watch for stack overflow. The following wiki topic shows how you can use watchpoints to check for stack overflow. I am going to see if someone can quickly add the info for Cortex M3.
http://processors.wiki.ti.com/index.php/Checking_for_Stack_Overflow_using_Unified_Breakpoint_Manager
John
Ashok,
The heap is entirely dependent on the amount and type of data used for dynamic allocation (malloc, calloc, printf, etc.), therefore there is no mechanism in place to precisely evaluate the heap usage (unless if using an RTOS like BIOS).
To help evaluate the amount of heap used, check these tips:
- The usage for malloc/calloc allocation is pretty straightforward (number of elements X size)
- I usually start with 0x400 as a heap size (purely empiric value) when I only have printf() calls in my code. If you intend to use the C++ counterpart (cin/cout), the heap allocation should be larger (starting at 0x1000).
Additional details about the console I/O functions (printf, scanf, etc.) can be found in the page below:
http://processors.wiki.ti.com/index.php/Tips_for_using_printf
Hope this helps,
Rafael
To statically (i.e. without running the code) examine how much stack you need, use the call_graph tool from the cg_xml package http://processors.wiki.ti.com/index.php/Code_Generation_Tools_XML_Processing_Scripts .
Thanks and regards,
-George