The program avr-size is part of the AVR-GCC toolchain used to develop programs for that line of microprocessors. The program tells you how much space the code will take up on the chip, important information if you’re trying to cram a program into a small program memory. Perhaps more importantly, it shows you how much ram is being used. This is the “Data:” portion of the image above and if you overflow the memory this will be the only thing that lets you know that has happened (except for unstable behavior once the program is running).
For quite some time the avr-size package in Ubuntu has been missing a key feature that makes the information more human readable. [Jeff] over at mightyohm tracked down the solution to the problem on the bug tracker and posted the directions on how to bring your copy up to date. Basically, download the package from Debian (an upstream copy that has already been patched) and install it. [Jeff’s] guide is based on the AMD64 version so we’ve copied his procedure in a more generalized fashion after the break.
1. First, go here and download the appropriate package for your architecture. The most common is i386 and you should download the most recent revision number (2.20.1-1 at time of writing).
2. Use the Debian package management system to install the package you just downloaded (you will need to change the package name if you didn’t download the i386 version):
sudo dpkg -i binutils-avr_2.20.1-1_i386.deb
3. Place the package on hold to prevent automatic updates that actually downgrade back to the broken version:
echo "binutils-avr hold" | sudo dpkg --set-selections
That’s all there is to it. We like to use a makefile written as a WINAVR example to compile and upload our AVR code. We’ve made the changes necessary to use the fixed avr-size program. Download the makefile here.