Pages: [1]   Go Down
Author Topic: Sizes of loaded modules?  (Read 278 times)
0 Members and 1 Guest are viewing this topic.
Finland
Offline Offline
Jr. Member
**
Karma: 0
Posts: 96
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How to find out easily, which library modules are loaded in the compiling-linking proces to the .hex -file, and how large they are?

---
Background:
I try to find out, which features to use in my programs so that the program memory of Arduino Uno does not become too small.
E.g. the excellent library SdFat uses varying amount of memory.
Linker or some other program might have a suitable option to produce "a map" or list. If so, where and how to set the values?

(I did work several hours with google etc, but might have not found the suitable keywords.)
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8952
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Shut down the IDE.
Set the preferences.txt option: preproc.save_build_files=true
Re-start the IDE.
Set the Preferences... option for verbose build messages.
"Verify" the sketch.
Use the messages to find the build folder and navigate there.  In my case:

    cd /var/folders/cs/p6yz0z1m8xj9lf0059b_lzw00000gn/T/build6087954880987522770.tmp/

Run the avr-size command on the object files.  In my case:

 '/Applications/Arduino 1.0.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-size' *.o
   text      data       bss       dec       hex   filename
   4800       346       240      5386      150a   BalloonControl.cpp.o
      0         0         0         0         0   CDC.cpp.o
      0         0         0         0         0   HID.cpp.o
   1544         0       167      1711       6af   HardwareSerial.cpp.o
    512         0         6       518       206   IPAddress.cpp.o
   1710         2         0      1712       6b0   Print.cpp.o
   1244         0         0      1244       4dc   Stream.cpp.o
   1365         1        21      1387       56b   Tone.cpp.o
      0         0         0         0         0   USBCore.cpp.o
    288         0         4       292       124   WInterrupts.c.o
    306         0         0       306       132   WMath.cpp.o
   4796         1         1      4798      12be   WString.cpp.o
     30         0         0        30        1e   main.cpp.o
     44         0         0        44        2c   new.cpp.o
    564         0         9       573       23d   wiring.c.o
    266         1         0       267       10b   wiring_analog.c.o
    500         0         0       500       1f4   wiring_digital.c.o
    314         0         0       314       13a   wiring_pulse.c.o
    260         0         0       260       104   wiring_shift.c.o


Note that the libraries are built in sub-directories so you will have to navigate to them individually.  Some of those sub-directories have further sub-directories.

Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Finland
Offline Offline
Jr. Member
**
Karma: 0
Posts: 96
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot!
Your advice worked well, it is complete and accurate (at least for my case). E.g.:
Code:
C:\Documents and Settings\Omistaja\Local Settings\Temp\build6465181737384115800.
tmp>avr-size *.o
   text    data     bss     dec     hex filename
      0       0       0       0       0 CDC.cpp.o
   1544       0     167    1711     6af HardwareSerial.cpp.o
      0       0       0       0       0 HID.cpp.o
    512       0       6     518     206 IPAddress.cpp.o
     30       0       0      30      1e main.cpp.o
     44       0       0      44      2c new.cpp.o
   1710       2       0    1712     6b0 Print.cpp.o
   3673       3     140    3816     ee8 SdFatQuickStart.cpp.o
   1244       0       0    1244     4dc Stream.cpp.o
   1365       1      21    1387     56b Tone.cpp.o
      0       0       0       0       0 USBCore.cpp.o
    288       0       4     292     124 WInterrupts.c.o
    564       0       9     573     23d wiring.c.o
    266       1       0     267     10b wiring_analog.c.o
    500       0       0     500     1f4 wiring_digital.c.o
    314       0       0     314     13a wiring_pulse.c.o
    260       0       0     260     104 wiring_shift.c.o
    306       0       0     306     132 WMath.cpp.o
   4796       1       1    4798    12be WString.cpp.o

      0       0       0       0       0 SdFatQuickStart.cpp.eep
  17618      64     841   18523    485b SdFatQuickStart.cpp.elf
      0   17682       0   17682    4512 SdFatQuickStart.cpp.hex
   3673       3     140    3816     ee8 SdFatQuickStart.cpp.o
   1244       0       0    1244     4dc Stream.cpp.o
   1365       1      21    1387     56b Tone.cpp.o
      0       0       0       0       0 USBCore.cpp.o
    288       0       4     292     124 WInterrupts.c.o
    564       0       9     573     23d wiring.c.o
    266       1       0     267     10b wiring_analog.c.o
    500       0       0     500     1f4 wiring_digital.c.o
    314       0       0     314     13a wiring_pulse.c.o
    260       0       0     260     104 wiring_shift.c.o
    306       0       0     306     132 WMath.cpp.o
   4796       1       1    4798    12be WString.cpp.o

C:\Documents and Settings\Omistaja\Local Settings\Temp\build6465181737384115800.
tmp\SdFat>avr-size *.o
   text    data     bss     dec     hex filename
   3395       0       0    3395     d43 istream.cpp.o
   1657       0       0    1657     679 ostream.cpp.o
   2550       0       0    2550     9f6 Sd2Card.cpp.o
  10116       0       6   10122    278a SdBaseFile.cpp.o
   1322       0       0    1322     52a SdFat.cpp.o
    152       0       0     152      98 SdFatUtil.cpp.o
    233       0       0     233      e9 SdFile.cpp.o
    756       8       0     764     2fc SdStream.cpp.o
   2726       0     523    3249     cb1 SdVolume.cpp.o

If I use a formatted Sd-card with one or two contiguous (defragmented) files in its root, I can have a logger to write those files using only Sd2Card.cpp.o , 2550 bytes. I have to know the starting block nr and take care of not bypassing the last block of the file.
In a test a moment ago this worked fine.
« Last Edit: January 31, 2012, 02:41:50 am by optimistx » Logged

Pages: [1]   Go Up
Jump to: