Code Size Produced by newer AVRGCC

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi to all,
I have a question about output code size of AVRGCC. When I compile it with an older version of AVRGCC (1999-mm-dd) the size of the .HEX file is about 6 Kb, but when I compile it with a new version (2000/2001-mm-dd) the size is very large about 15 Kb! I use various options -O2 -O3 -Os but output code size doesn't differ very much. Then I disassemble the object files and saw the strange thing - for example functions __addsf3 and __subsf3 used in floating point calculations:

Older compiler:

000005ca :
5ca: 50 58 subi r21, 0x80 ; 128

000005cc :
5cc: 19 2e mov r1, r25
5ce: 09 d0 rcall .+18 ; 0x5e2
5d0: 38 d0 rcall .+112 ; 0x642
5d2: 1f c0 rjmp .+62 ; 0x612

.
.
.

------------------------------------

Newer compiler:

000008a4 :
8a4: a0 e2 ldi r26, 0x20 ; 32
8a6: b0 e0 ldi r27, 0x00 ; 0
8a8: e7 e5 ldi r30, 0x57 ; 87
8aa: f4 e0 ldi r31, 0x04 ; 4
8ac: b2 c5 rjmp .+2916 ; 0x1412
8ae: b9 2f mov r27, r25
8b0: a8 2f mov r26, r24
8b2: 97 2f mov r25, r23
8b4: 86 2f mov r24, r22
8b6: 89 8f std Y+25, r24 ; 0x19
8b8: 9a 8f std Y+26, r25 ; 0x1a
.
.
.

00000916 :
916: a0 e2 ldi r26, 0x20 ; 32
918: b0 e0 ldi r27, 0x00 ; 0
91a: e0 e9 ldi r30, 0x90 ; 144
91c: f4 e0 ldi r31, 0x04 ; 4
91e: 79 c5 rjmp .+2802 ; 0x1412
920: b9 2f mov r27, r25
922: a8 2f mov r26, r24
924: 97 2f mov r25, r23
926: 86 2f mov r24, r22
928: 89 8f std Y+25, r24 ; 0x19
92a: 9a 8f std Y+26, r25 ; 0x1a
.
.
.

It looks like that the newer compiler produce individual code for most of the functions, and this code is same in each one. I use makefiles used in GCCTEST with a little modifications. I compiled other little programs with demo versions with other commersial compilers and their code sizes are like these ones compiled with the older AVRGCC.

Why the code size produced by the new AVRGCC is so large?

Regards,
Atanas Uzunov

http://www.mcs.dir.bg/index_en.htm
MICROCONTROLLER-BG

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Instead libgcc.a use libm.a.
Change makefile : LDFLAGS = ...,-lm
^^^!!!

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

YES, that helped for me also !!

Markus

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, now the compiler works fine, but I wonder why the default library is libdcc.a and why this option is not included in the makefiles in GCCTEST.

Regards,
Atanas

admin's test signature