DAVE 3 : How to determine how much program and data storage memory has been used ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi All,

Happy new year.

I'm looking for a way to display how much program and data storage memory has been used after compiling in DAVE 3.

Thanks very much
Aaron
0 Likes
14 Replies
elm0
Employee
Employee
Hi,

I don't know the situation in DAVE 3, but in DAVE 4 you find a .lst file in the Debug folder. There should be something similar in DAVE 3.

Regards
elm0
0 Likes
Not applicable
Thanks elm0, I did look at the .lst file but it is pretty big. I searched for obvious keywords like PSRAM but failed to find the information. Do you know where to look in the file or keywords to search for ?
0 Likes
elm0
Employee
Employee
Right at the beginning, there should be a summary of the sections with information about size, VMA (virtual memory address) and LMA (load memory address) for each. This are the sections specified in the linker script. Usually, the .text section contains the program data, the .data section contains initialized data and the .bss section contains uninitialized data.

The LMA shows where the section is loaded by the debugger (or whatever programming device), the VMA shows where the section is expected to be by the compiled code. For example, the .data section contains the data which shall be available in the DSRAM (VMA) during code execution, but it has to be stored in the non volatile Flash (LMA). Thus, somewhere in the startup code, there is a procedure which copies the data from the loaded flash location to DSRAM.
On the other hand, for the .bss section containing uninitialized data, the LMA doesn't matter, because the memory space is only allocated.

Maybe (as it is in my DAVE 4 XMC4000 projects), there might be some other sections predefined in the linker script, containing special program code or data. At the end, you need to sum by hand. At least that is how I do.
0 Likes
Not applicable
Thanks elm0.
0 Likes
Not applicable
Hi elm0,

I found the following in the .map file which seems to give the amount of data memory used...

0x000016d0 __Xmc4500_Data_Size = (__Xmc4500_eData - __Xmc4500_sData)

I haven't found the code size yet though.

Best regards
Aaron
0 Likes
elm0
Employee
Employee
The variables mentioned in the statement you posted are variables of the linker script and thus their meaning is depending on how the linker script is written.
Let me show you an example of one of my projects. I find the following information in my lst-file:

1746.attach

So I have:
.text: 0x450C bytes of code loaded in uncached flash memory (LMA), executed via cache (VMA)
.rodata: 0x701 bytes of read only data in flash (same way of address handling as for .text section)
Stack: The stacksize is 0x1000 bytes and the stack is located at the beginning of the PSRAM
.data: 0xB4 bytes of initialized data located in DSRAM (but loaded in uncached flash to be non volatile)
.bss: 0x34 bytes of uninitialized data located in DSRAM
.no_init: Another 0x14 bytes of uninitialized data located at the end of the DSRAM.

Regards
Elmo
0 Likes
Not applicable
Thanks again Elmo, that makes complete sense now.

I have a feature request for Infineon if the feature does not already exist...

Display this information from the DAVE environment with clear descriptions of each parameter and maybe a total for the ram usage.

Best regards
Aaron
0 Likes
elm0
Employee
Employee
Hi Aaron,

I found something like you are asking for in DAVE 4!

1747.attach

In the toolchain, there is a program called "ARM-GCC Print Size" invoked. When I check the "Show Totals" in the toolsettings, I get the highlighted output in the screenshot. I think that is exactly what you're looking for, hopefully the tool is also used in the DAVE 3 toolchain!

Regards
Elmo
0 Likes
elm0
Employee
Employee
I crosschecked for my example: In that output, "text" contains the .text (code) and the .rodata sections, "data" conatins simply the .data section and "bss" contains the .bss, the .no_init and the Stack sections.
0 Likes
Not applicable
Hi Elmo,

Fantastic, it works in DAVE 3 too. I also found the following explanation for the Eclipse IDE...

http://mcuoneclipse.com/2013/04/14/text-data-and-bss-code-and-data-size-explained/

Thanks again for your help.

Best regards
Aaron
0 Likes
Not applicable
HI,

In DAVE 3 and DAVE 4, when you compile your code, in the console window, you can find out the program and variable size.

Here’s an example from the console window:
"C:\DAVEv4\DAVE-4.1.2\eclipse\ARM-GCC-49/bin/arm-none-eabi-size" --format=berkeley "XMC13S2_SECUREBSL_XMC1302-T038x0200_0.elf"
text data bss dec hex filename
9193 132 1116 10441 28c9 XMC13S2_SECUREBSL_XMC1302-T038x0200_0.elf


‘text’ is what ends up in FLASH memory
‘data’ is used for initialized data.
‘bss’ contains all the uninitalized data.


Regards,
Daryl
0 Likes
Not applicable
Thanks Daryl
0 Likes
elm0
Employee
Employee
😄 That's true. The output was always there, also without checking the "Show Totals".
0 Likes
Not applicable
You're welcome 🙂
Have a good weekend!
0 Likes