PropGCC compilation question re .debug items

I am using sprintf successfully but am very curious as to the contents of the report from propeller-elf-size -A -d -t %target%-%memmodel%.elf. If I don't use sprintf the "Total" is ~25K. The reported total with sprintf is much larger and is obviously not being actually loaded to the Prop. I suppose adding the debug symbols is a GCC switch that was used to compile the library? Thanks for any feedback on this.

Mike R.
GCC Compile/Load
               ================
Options: lmm, -Os, -mfcache
Target: ign.c
In file included from ign.c:19:0:
ign_vt100.c: In function 'DrawBox':
ign_vt100.c:166:14: warning: unused variable 'loc_b' [-Wunused-variable]
ign.c: In function 'main':
ign.c:28:14: warning: unused variable 'flag' [-Wunused-variable]
ign.c:28:11: warning: unused variable 'a' [-Wunused-variable]
ign.c:27:11: warning: unused variable 'cmd' [-Wunused-variable]
ign.c: At top level:
ign.h:33:12: warning: 'vrsim_stack' defined but not used [-Wunused-variable]
ign-lmm.elf  :
section           size    addr
.boot               32       0
.bootpasm           40       0
.init              184      72
.text            16264     256
.fini               60   16520
.hub              4640   16580
.math.kerext       220    1728
.start.kerext       60    1728
.float.kerext      252    1728
.ctors               8   21752
.dtors               4   21760
.data                0   21764
.lmmkernel        1320       0
.bss              2588   21764
.hub_heap            4   24352
.debug_aranges     320       0
.debug_info       4746       0
.debug_abbrev     1425       0
.debug_line       1576       0
.debug_frame       484       0
.debug_str          32       0
.debug_loc        2139       0
.debug_ranges      144       0
Total            36542


Propeller Version 1 on COM5
Loading ign-lmm.elf to hub memory
24352 bytes sent
Verifying RAM ... OK

Terminal will be reused by tasks, press any key to close it.
The difference between theory and practice is that, in theory, there is no difference between theory and practice, but in practice, there is.

Comments

  • ersmithersmith Posts: 3,054
    edited 2019-01-27 - 12:42:38
    Yes, the things in the .debug sections are in the .elf file, but not loaded to the Propeller. They're just debugging symbols for programs like gdb. You can see the flags for all of the sections by using:
    propeller-elf-objdump -h program.elf
    
    (replace "program.elf" with whatever your actual ELF file name is).

    Sections marked LOAD are the only ones actually loaded to the Propeller. Ones marked ALLOC define space that is reserved in memory, but which doesn't need to be loaded (this is like the "res" directive in Spin). Ones that are neither ALLOC nor LOAD are purely for internal use of the gcc tools.
  • Thank you kind sir!
    The difference between theory and practice is that, in theory, there is no difference between theory and practice, but in practice, there is.
Sign In or Register to comment.