Page 1 of 1

compiled code size

Posted: Fri Mar 12, 2010 6:45 pm
by santacruzbob
has anyone managed to get a modern (gcc-4.2+) avr-gcc compiling the code so it will still fit in the 2k bootloaders? I'm not sure if there are some options I should be trying to cut down on space or if the code needs to be modified or what we need to do. using gcc-4.3.4 the USBasploader code compiles to 2088 bytes so we need to save at least 40 bytes somewhere. Thanks in advance -Bob

Re: compiled code size

Posted: Sat Mar 13, 2010 7:34 pm
by wblock
Turning off the EEPROM options in bootloaderconfig.h will save more than enough. I turned off both, but disabling HAVE_EEPROM_BYTE_ACCESS alone says it saves 54 bytes. This is with avr-gcc 4.3.4.

Re: compiled code size

Posted: Fri Mar 19, 2010 4:08 am
by ulao
I got mine down to 1950 doing the same and removing the debug code. I'd like to get it lower but cant seem to do so. As it is, my main flash needs to be 87.5% or less and I'm always fighting with it. I was thinking some compiler options would help, I have used these in the past

--param inline-call-cost=2
-fno-inline-small-functions
-ffunction-sections
-Wl,--relax
-Wl,--gc-sections

but no luck with them on the bootloader.

Re: compiled code size

Posted: Thu Apr 22, 2010 4:34 am
by santacruzbob
I appreciate your responses. I've been fighting with usbasploader on a mega88p for months. I can compile the code for mega88 or mega88p and the generated hex file is identical. The code works properly (and well) on the mega88 chips but the mega88p chips just won't work. I have attempted to debug the issue on my own but I'm unable to find the problem (I know it's not an issue of SIG_INTERRUPT0 not being defined in iom88p.h) I would like to hear if anyone else is having success with the usbasploader code on any of the *P chips? the non-bootloader examples run properly on both the 88 and 88p