Project Memory Usage


#1

Using GCC.

Is there a simple way to see a summary of my project’s memory usage; eg,
ROM: xxx Kbytes used (X%)
RAM: yyy Kbytes used (Y%)

The ‘m’ file in the gcc\out folder looks like a Linker map file, and it looks like it should be possible to deduce this information from its content - but is there anywhere that a simple summary is presented, like the above?


#2

It looks like nobody knows an answer… Or maybe there is indeed no easy solution to this. I would also be interested in an answer to this question…

awneil, did you find a way to find out the RAM/ROM usage?

The only two ways of finding out the free RAM I can think of are

  1. allocate, until you can’t get no more…

  2. wrap the get/release memory in own functions and remember what is allocated.

I don’t like either of them… 2) also will not be able to consider what is allocated by static and global variables.

And I have no idea about the ROM…

I think the Wavecom Core Firmware should have a get_free_mem() function… What is the big deal? The operating system should really know what is used and how much is available…

Best Regards,
Jan


#3

No, I’m afraid not :frowning:

As far as I’m concerned, this is an absolutely basic piece of information that should be procvided by any embedded development environment.

It is really vey bad that Wavecom either doesn’t provide it, or makes it so difficult to find. :angry:

My actual interest is in the “static” usage of RAM and ROM - the memory available for dynamic allocation is another issue!


#4

I absolutely agree!

Well, I think you should get an estimate how much is used up by the static/global variables by trying 1) right after the application started and then subtract that number from the total memory available…

Anyway, this is much more complicated as it should be… :unamused: :unamused:


#5

Hello,

For Open AT older then 4.00 you can look into the “m” file in your GCC/OUT directory. You can see the static memory usage there.

From Open AT 4.00 there is a adl_memGetInfo() function. It provides you the
memory size of call stack, global variables and also the heap memory size for the OAT application. So this is a really useful function i think.

Best Regards,

tom


#6

Thanks, Tom!

That’s good news!! I can’t wait to get started with a new project on OpenAT 4.0!

Best Regards,
Jan


#7

Possibly - but, as I said originally:

So, is there a simple summary buried in the ‘m’ file somewhere?

If not, how can it be deduced?

Again, my original question was:

I need to know this at build time time - so a runtime API call is no help here!


#8

Hi Everybody
The forum nice to ask some questions but if you do not get answers you should ask your distributor they shoud be able to give you all the answers
Here is the answer for this question:

The amount of the RAM and ROM used by the Open AT application can be found from the “m” file found in the project’s “gcc/out” folder. In the “m” file under the heading “Linker script and memory map” the total size of ROM used by the Open AT application is indicated at the start of the “.text” section.

The size of RAM used is the sum of the size of RAM used for initialized data, uninitialized data and common data segments. The size of RAM used for initialized data is indicated at the start of the “.data” section. The size of RAM used by initialized data and common data is shown at the start of the “.bss” section. In the attached “m” file you can find our comments by searching for the string “ATSUP1496”.

In the attached “m” file,
ROM used by the Open AT Application = 0x2297c = 141692 bytes
RAM used by the Open AT Application = 0xf30 + 0x3c20 = 0x4b50 = 19280 bytes

The “arm-elf-size.exe” tool returns the size of the “.elf” file and the size of the various segments of the file that is given as an argument. In the screen shot the “gcc_SMS_App_32.elf” file consists of 140108 bytes of text, 3884 bytes of initialized data and 39808 bytes of uninitialized data and stack. The last two columns are the total size of the file in decimal and hexadecimal format. Hence, this tool can also be used to obtain the size of RAM and ROM used by the Open AT application. The text size returned by this tool corresponds to the ROM used by the application. The sum of “data” and “bss” sizes corresponds to the RAM used by the Open AT application.

I hope this is helpfull
Best regards
Walter


#9

Hi Walter,

thank you very much for this answer!

How can I see the attachments?

Thanks again,
Jan


#10

Hi Jan
The only file that should be there is the “M” file
it should look the same as from any application but if you want this specific one (there is nothing special about it, it is from a normal application) then I will e-mail it to you.
I forgot to mention that on some PC’s you have to copy the “arm-elf-size.exe” file to your cygwin/bin folder.

Best regards
Walter


#11

Yes, I had to do that! :frowning:

How could I get this to run at the end of every Target build?
(using Open-AT v3.03 with MS VisualStudio 2003)


#12

Shouldn’t that be un-initialised data in “.bss” :question:


#13

Hi Awneil

I personaly do not use this data.
I will ask wavecom for clarity.
But I think that the bss is the used ram at startup.
I say this because I compiled a blank application and looked at the values.
And acording to this it is used size at startup.
If you want to run this after compile then you need to modify the make files.
I would not recommend this.
rather create a small script file and run it from the “LoadIde.bat” file
I will try to get somebody who can create this script file.


#14

Hi All
I join you in this subject because with arm compiler the “m” file is more clear , so at the end of the file there is a table of sizes.

But my question is to know if the size of plugin (library) like WIP or CGPS are always the same for any Applications ? or the complier optimise according to the use or not of some Library API.

Regards,
Malek