Closed GoogleCodeExporter closed 9 years ago
How do you get the avr tools to output the SRAM usage?
Also, how useful is this? Consider that the RAM usage changes as the program
runs, so even if you fit under the
limit when the program starts, you can run out of RAM in the middle of
execution.
Original comment by dmel...@gmail.com
on 16 Jun 2009 at 2:55
True, but at least your code starts up ok.
As far as size is concerned, could you check the bss + init data size?
Original comment by rleylan...@gmail.com
on 16 Jun 2009 at 11:24
Knowing how much .data + .bss being used will allow the programmer to leave a
margin
of safety in the memory.
Original comment by frank.zhao.main@gmail.com
on 12 Aug 2009 at 1:00
If you are working on several platforms, it is not so easy to keep track of the
RAM
usage all the time and it's easy to use up a little more than necessary. Even
if you
are an experienced programmer.
For me, it would be a big help to see the RAM usage after compilation, to avoid
wasting the not so ample resource on the microcontroller. In my last project I
reached the point one time just by sending debug messages via serial which were
a
little wordy. If you are used to a PC or other platforms with comparatively
extensive
RAM, you fall into the trap.
Since Arduino is also intended as a platform to teach working with
microcontrollers,
showing the RAM usage after compilation would show one of the key restrictions
when
programming on such platforms, just like the needed nad max flash memory, which
is
already shown.
Original comment by pj46...@t-online.de
on 20 Feb 2010 at 2:23
This would essentially require an arduino simulator to be run for some
unspecified
time. Also the inputs would need to be simulated somehow (buttons, sensors...)
as
different functions are likely to be involved based on the inputs (and their
in-scope
variables and hence SRAM usage. Also, how about recursive funcions?)
While it would be nice to have an arduino emulator/simulator, I think it is
unreasonable to expect that of the IDE and compiler. It is really not just
another
simple function to add a "SRAM usage" warning, like with the (basically static,
but not
neccesarily so) flash memory. For now that is up to the programmer to know how
much
SRAM is needed, and how much the particular arduino variant has.
(Im just a casual user of the Arduino IDE, I just wanted to comment on this).
Original comment by raron...@gmail.com
on 25 Mar 2010 at 1:13
As an aside, this is a pretty standard feature of professional development
tools (eg.
MPLAB). Knowing how much RAM is used (and remaining) is critical to maximizing
your
hardware use.
This bug concerns static memory use.
Run time RAM allocation (dynamic) is another matter. That is not something
expected
from the linker/compiler/IDE, and could/should be caught by the allocation
methods,
and described in a separate report.
Original comment by rleylan...@gmail.com
on 25 Mar 2010 at 4:44
If I'm expect to be using dynamic allocation, I will definitely be checking the
return status and (I hope) failing as gracefully as I can when I'm out.
But I agree that it would be very nice to get a basic lower bound for static
SRAM usage, even if it is just an estimate (it could be presented as an
estimate of usage, to avoid confusion). It would also help be a guide when
trying to refactor to save RAM, to see how much of a difference a particular
change might make.
Andrew
Original comment by sch...@gmail.com
on 16 Aug 2010 at 6:39
I'd like to see this feature support add ons from other vendors that use other
AVR chips such as the teensy or sanguino. Of course those vendors would have to
setup their board support files appropriately...
Original comment by standard...@gmail.com
on 18 Aug 2010 at 2:56
yes i'd love to see this as well, just as the compiler reports flash usage, it
should report initial/static RAM usage(again, MPLab has been doing this for at
least 11 years)
Original comment by glov...@gmail.com
on 16 Feb 2011 at 10:48
[deleted comment]
Since the microcontroller knows that a buffer overflow happens, IDE could at
least show where on the code was the problem. I believe that the
microcontroller warns of buffer overflow errors.
Original comment by xanoko...@gmail.com
on 18 Mar 2011 at 12:17
To check for static RAM please take a look at this:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1224729260
There is even a comment from dmellis adding this to the TO DO list :-)
So please consider this a gentle reminder to incorporate this into the next
revision.
thanks,
Robert.
Original comment by rleylan...@gmail.com
on 18 Mar 2011 at 12:45
Issue 395 has been merged into this issue.
Original comment by dmel...@gmail.com
on 3 Apr 2012 at 2:36
Please keep in mind that many new users already misunderstand the flash memory
usage message today. Many believe that X bytes (of a Y maximum) is how much
RAM, or simply stated "memory", is free. So is saying nothing better than
saying something?
It would be helpful to include at least an estimation (from avr-size?) to help
people realize there is a difference between RAM and PROGMEM.
Initial RAM Usage: 562 bytes (of a 2048 byte maximum)
Binary sketch size (PROGMEM): 2650 bytes (of a 32256 byte maximum)
This would at least prompt the question, "what's the difference?"
Original comment by byerly0...@gmail.com
on 23 May 2012 at 2:29
Using the code as a starting point from this very old example:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1224729260
I have modified it to work with the latest 1.01 source such that now it the
Arduino app prints this out:
Binary sketch size: 163718 bytes (of a 258048 byte maximum)
Initial minimum RAM usage (more will be used at run time): 1098 bytes (of a
8192 byte maximum)
I have also modified the boards.txt file to contain the SRAM size for each
board.
The modification uses objdump to get the static allocation for SRAM which we
know of course is only the starting point since there is dynamic allocation
going on at run time as well. But, it's still very useful.
I use this myself everyday and several others have asked me for it and are
using it. How can I get this submitted so that it becomes part of the standard
distribution. Seems like many, many people want this.
Attached is a zip file containing the modified files.
Ron Curry
Original comment by Wingspin...@gmail.com
on 29 May 2012 at 5:17
Attachments:
yes please,
amazing that the standard IDE does not provide an indication on where one is
starting at.
for new users, the output would also allow them to learn how ram usage changes with different styles of code. having nothing because its not perfect is an interesting responce.
in a car, if I had a choice between no breaks , because it was hard to make
perfect, and breaks that were slow but worked, I know what I'd have.
Original comment by andrew6...@gmail.com
on 8 Jul 2012 at 6:05
a little extra update,
its amazing how many example code we see that use memory free to try to get an
estimate of free memory,
Original comment by andrew6...@gmail.com
on 27 Jul 2012 at 6:03
The memory check has been introduced in the IDE 1.5.x series.
Original comment by c.mag...@arduino.cc
on 21 Feb 2014 at 3:57
Original issue reported on code.google.com by
rleylan...@gmail.com
on 16 Jun 2009 at 1:44