cancel
Showing results for 
Search instead for 
Did you mean: 

How to find out how much space are in RAM and Flash occupied in bytes?

VYoun
Associate III

Hello,

I am using STM8l151, ST Visual Develop, and Cosmic compiler. I need to find out how much space is occupied in RAM and Flash.

I found the .map file and checed there, but everything there is said in terms of segments and also code size in flash is not mentioned.

I found other discussions in this forum about this, but they do not mention how to calculate size in Bytes.

Thank you in advance for your help.

2 REPLIES 2

I'm not an STM8 users so not particularly familiar with your toolset.

Generally the .MAP file should provide enough detail, the FLASH content tends to be an aggregate of the code, fixed data, and initialized data, the latter being copied to RAM at startup, and then the uninitialized statics (bss), typically the arrays cleared to zero. Then whatever stack and heap allocations you have specified.

If your linker doesn't output appropriate stats (usually at the end) you might want to write a simple script to process the .MAP and do the math for you.

Linker scripts can typically also allow you to define symbols, and these can be used to establish accumulated sizes.

You might also want to inspect the object file output by the linker (.ELF ?), the load details in the program header should indicate how large the output .BIN files will be. There are usually tools to inspect these files. You could also look at the .HEX or .BIN files emitted by the linker or secondary tools.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

@Community member​ thank you very much for the information.