Only thing is, I just started looking at some of the V-USB based projects, some of which are supposed to be able to fit onto a device with 2k of flash (there's a few Attiny2313 projects out there). Even the main V-USB hardware page mentions 2k of flash as a minimum requirement. However all of the projects I have downloaded and have lazily typed 'make all' on came in well over 2k in code size. This is important to me - I want to develop a dongle for a certain serial protocol keyboard - it wants to be in a smallish package, and wants a hardware UART. Attiny2313 fits the bill, but hey it's only got 2k Flash... I know the attiny85 has 8k but theres no harware UART...
Anyway - I checked the compiler version and noticed gcc v4 was being used. I tried to change it to v3.x and then I noticed that v3 was no longer available in Crosspack - it has been removed, so I downloaded the previous version, changed gcc version to 3 and rebuilt a project I've been hacking around with the last few days. PS2USB.
I use the basic 3.6v zener diode interface hooked up directly to my Atmel STK500 dev board, and plugged in a spare atmega88. I have removed the code for the second pad. Its made the code smaller, but even so, look at the results:
Code: Select all
$ make clean; make all
rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s
avr-gcc -Wall -Os -DF_CPU=12000000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=atmega88 -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
avr-gcc -Wall -Os -DF_CPU=12000000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=atmega88 -x assembler-with-cpp -c usbdrv/usbdrvasm.S -o usbdrv/usbdrvasm.o
avr-gcc -Wall -Os -DF_CPU=12000000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=atmega88 -c usbdrv/oddebug.c -o usbdrv/oddebug.o
avr-gcc -Wall -Os -DF_CPU=12000000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=atmega88 -c main.c -o main.o
main.c: In function 'main':
main.c:483: warning: unused variable 'idleCounter'
main.c: At top level:
main.c:15: warning: 'outBuffer2' defined but not used
avr-gcc -Wall -Os -DF_CPU=12000000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=atmega88 -o main.elf usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
rm -f main.hex main.eep.hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
text data bss dec hex filename
0 3034 0 3034 bda main.hex
avr-gcc v4: 3034 bytes
avr_gcc v3: 2712 bytes
That's a whopping difference. At this rate I'd be hard pushed to fit my own project on a 4k device, never mind a 2k one. I was wondering if I can remove the debug code and see what, if anything it does to reduce the code size. Is there anything else I could be missing?
Size is everything in this world, right guys?