An unknown part of memory at the end of the data segment

*** OK - I think I figured the answer, the answer is that this memory is used to load static strings (see first reply for more details)
*** I'm leaving this post here, in case it will help someone who was bothered with that.

hi,
I'm using an Arduino-nano for operating a led matrix
running into some memory problem, I'm trying to figure out what parts of my program occupies the most memory.

to do that I looked at the symbol table, and found the following mystery:
the __data_start symbol is 0x800100
the last static variable in the data segment (named _ZTV14HardwareSerial) is at 0x800251 and is 18 bytes long,
naturally I would expect that the bss segment would start right after that (with some padding maybe to get it 16 bit aligned).
however - the bss segment starts at 0x800598, so there's apx 821 bytes at the end of the data segment which I'm not sure what they are used for.
I wouldn't complain about 821b normally, but the whole thing has 2k of SRAM, so that's quite a concern.

here is a snippet from the objdump:

/c/Program\ Files\ (x86)/Arduino/hardware/tools/avr/bin/avr-objdump.exe -t onairsign.ino.elf

00800100 g       .data  00000000 __data_start
00800100 l     O .data  000000c8 very_big_static_var
00800100 l    d  .data  00000000 .data
008001c8 l     O .data  00000004 _ZL12displayState
008001cc g     O .data  00000002 __malloc_heap_end
008001ce g     O .data  00000002 __malloc_heap_start
008001d0 g     O .data  00000002 __malloc_margin
008001d2 l     O .data  0000000c _ZN14DisplayBitmaps23AudioCapturing_Overlay3E
008001de l     O .data  0000000c _ZN14DisplayBitmaps23AudioCapturing_Overlay2E
008001ea l     O .data  0000000c _ZN14DisplayBitmaps23AudioCapturing_Overlay1E
008001f6 l     O .data  0000000c _ZN14DisplayBitmaps19AudioCapturing_BaseE
00800202 l     O .data  00000009 _ZN14DisplayBitmaps21AudioPlaying_overlay4E
0080020b l     O .data  00000009 _ZN14DisplayBitmaps21AudioPlaying_overlay3E
00800214 l     O .data  00000009 _ZN14DisplayBitmaps21AudioPlaying_overlay2E
0080021d l     O .data  00000009 _ZN14DisplayBitmaps21AudioPlaying_overlay1E
00800226 l     O .data  00000009 _ZN14DisplayBitmaps16AudioPlayingBaseE
0080022f l     O .data  0000000a CSWTCH.4
00800239 l     O .data  0000000c _ZTV28AudioCapturingDisplayElement
00800245 l     O .data  0000000c _ZTV26AudioPlayingDisplayElement
00800251 l     O .data  00000012 _ZTV14HardwareSerial
<What is this gap ???> 
00800598 g       .bss   00000000 __bss_start
00800598 g       .data  00000000 __data_end
00800598 g       .data  00000000 _edata
00800598 l     O .bss   00000001 _ZN8SPIClass13interruptSaveE
00800598 l    d  .bss   00000000 .bss

I'm attaching the full objdump outptut,
any explanation about this gap would be helpfull

thanks
Gal

memory_dump.txt (11.8 KB)

As promised, I used objdump to dump the actual content of the data segment,
as you can see below, the space starting apx at 0x800260 is used for static strings

8001d0 80000000 18000000 00000018 00000018  ................
 8001e0 24000000 00000024 18003c42 00000000  $......$..<B....
 8001f0 00000000 423c0000 0000047a 7a040000  ....B<.....zz...
 800200 00000000 00000000 42241800 00000000  ........B$......
 800210 245a2418 00000000 18241800 00000000  $Z$......$......
 800220 00180000 0000183c 7e000000 00000079  .......<~......y
 800230 057f0584 058c0592 05000000 00380520  .............8.
 800240 0599051d 05000000 001a0502 055705ff  .............W..
 800250 04000000 00dc033c 03690329 049a0378  .......<.i.)...x
 800260 038c034c 4f472000 0d0a0053 65747469  ...LOG ....Setti
 800270 6e67206e 65772073 74617465 20746f3a  ng new state to:
 800280 20436f6e 6e656374 65643d25 642c2041   Connected=%d, A
 800290 7564696f 20706c61 79696e67 3d25642c  udio playing=%d,
 8002a0 20417564 696f2063 61707475 72696e67   Audio capturing
 8002b0 3d25642c 2043616d 65726120 63617074  =%d, Camera capt
 8002c0 7572696e 673d2564 00676f74 2070696e  uring=%d.got pin
 8002d0 6700676f 74207469 636b0073 686f756c  g.got tick.shoul
 8002e0 64207265 66657368 20646973 706c6179  d refesh display
 8002f0 00656d70 74790070 6f696e74 20310073  .empty.point 1.s
 800300 74617469 63207465 78742069 73206174  tatic text is at
 800310 20257000 64796e61 6d696320 76617220   %p.dynamic var
 800320 69732061 74202570 00706f69 6e742032  is at %p.point 2

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.