Bits and bytes

How much AVR resources does your little program occupy?

If you’ve ever played with WinAVR, you have probably noticed the pretty resource usage info printed after each compile. You may miss that candy if you compile with GCC on Linux. In that case, grab a simple script avr-mem.sh. While the script should work with common AVR chips, you must modify it in order to use it with AT90USB646.

Open the source file and insert the code below into the line 101:

“at90usb646”)  PROGMAX=${AVR64K}; DATAMAX=${AVR4K}; EEPROMMAX=${AVR2K};;

This way you can add support for any unsuported AVR, provided that you know how much resources it has. After you’ve modified the script, you can go to the command line and run it on the .elf file your compiler generates:

tomo@tomo-laptop:~/Projekt$  ./avr-mem.sh firmware.elf at90usb646
AVR Memory Usage:
—————–
Device: at90usb646

Program:   12454 bytes (19.0% Full) (.text + .data + .bootloader)
Data:        243 bytes (5.9% Full) (.data + .bss + .noinit)

Pretty, isn’t it?

atmega165