Hello,
I am using Code Composer Studio version 5.5.00077, C6000 Bios version 6.35.4.50, C6000 Compiler version 7.4.11, and C6000 XDCTools version 3.25.4.88. The IDE is running under Windows 7
My project is set up to use separate configuration project.
When I edit the configuration, and try to add HeapStd heap (under XDCTools->Memory Management->Heaps, right-click on HeapStd and select "Use HeapStd", the first item on the menu), development tools "automagically" add a new memory segment for me. This memory segment is called ".sysmem". I can see it in the map file, but it does not show up in the configuration. Here is an excerpt from my map file:
******************************************************************************
TMS320C6x Linker PC v7.4.11
******************************************************************************
>> Linked Tue Nov 04 18:38:43 2014
OUTPUT FILE NAME: <test.out>
ENTRY POINT SYMBOL: "_c_int00" address: 8000a1a0
MEMORY CONFIGURATION
name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
IRAM 10800000 00020000 00000000 00020000 RW X
L1DSRAM 10f04000 0000c000 00000000 0000c000 RW
SRAM 42000000 00200000 00000000 00200000 RWIX
DDR2 80000000 08000000 0001bc68 07fe4398 RWIX
SEGMENT ALLOCATION MAP
run origin load origin length init length attrs members
---------- ----------- ---------- ----------- ----- -------
80000000 80000000 0000d0a0 0000d0a0 r-x
80000000 80000000 0000d0a0 0000d0a0 r-x .text
8000d0a0 8000d0a0 00008c10 00000000 rw-
8000d0a0 8000d0a0 00008c10 00000000 rw- .far
80015cb0 80015cb0 0000233c 0000233c r--
80015cb0 80015cb0 0000233c 0000233c r-- .const
80017ff0 80017ff0 00003000 00000000 rw-
80017ff0 80017ff0 00002000 00000000 rw- .stack
80019ff0 80019ff0 00001000 00000000 rw- .sysmem
8001aff0 8001aff0 0000056c 0000056c rw-
8001aff0 8001aff0 0000056c 0000056c rw- .fardata
8001b560 8001b560 00000120 00000000 rw-
8001b560 8001b560 00000120 00000000 rw- .cio
8001b800 8001b800 000005f0 000005f0 r-x
8001b800 8001b800 00000200 00000200 r-x .vecs
8001ba00 8001ba00 000003f0 000003f0 r-- .cinit
The side effect of this extra segment is somewhat mysterious. Before adding HeapStd, memory allocations for malloc() and calloc() occured from SysBios HeapMem. This heap was also automagically created, but was at least shown in the configuration editor when "Show Configuration Results" button was selected. It was explicitly marked by the tiny lock icon, and usually has a name of the form "Instance#(number)". I was able to observe and monitor this heap from the ROV, therefore having a debuggable system.
After I added HeapStd, the system automagically switched to using the hidded ".sysmem" segment (or a heap within it) for all malloc() and calloc() allocations. This occurred even though I did not create any heaps of type HeapStd, just added the module. This turned out to be somewhat wicked, since ".sysmem" does not show up in the ROV during debugging, and I spent a bit of time crawling over the configuration file and the map file before I spotted it, and realized that this is where allocations were made from. It looks like the size of ".sysmem" is controlled by Heap Size parameter shown on Program configuration screen (xdc->cfg->Program in Configuration Results tree).
This behavior is somewhat unexpected, and, what is worse, it prevents me from monitor memory use with ROV.
I'd like to understand better what has happened, and whether it is safe to use HeapStd (at this time I switched to using HeapMem for all cases where I need to use malloc() and free()).
Any explanations and clarifications would be very welcome.
Thank you in advance,
Dmitry.