compiled code size

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
santacruzbob
Posts: 9
Joined: Wed Jul 01, 2009 11:14 pm

compiled code size

Post by santacruzbob » Fri Mar 12, 2010 6:45 pm

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

wblock
Posts: 1
Joined: Thu Mar 04, 2010 9:40 pm

Re: compiled code size

Post by wblock » Sat Mar 13, 2010 7:34 pm

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.

ulao
Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

Re: compiled code size

Post by ulao » Fri Mar 19, 2010 4:08 am

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.

santacruzbob
Posts: 9
Joined: Wed Jul 01, 2009 11:14 pm

Re: compiled code size

Post by santacruzbob » Thu Apr 22, 2010 4:34 am

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

Post Reply