How to fix AVR-SIZE on Ubuntu 10.04

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.

Comments

  1. hajma says:

    This is exactly the type of articles I do not want to see at HaD. Is there a way to filter it out?

  2. Felix says:

    hajma – Yeah, stop being whiney and find somewhere else to be.

    I might downgrade to 9.10, I seemed to have some new issues that popped up.

    I grabbed a huge makefile from a website once that was meant to be used as a template. It would be cool to go through the toolchain step by step from avr-gcc to getting it on the chip.

  3. mike says:

    this is the kind of problem i run into but its not major enough that i look for a fix, helpful to just find it one day and have it fixed

  4. mjrippe says:

    @hajma – Yes, it’s the little wheel in the center of your mouse. Takes less time than posting a complaint.

  5. Grazz256 says:

    Myself, I made a

  6. Grazz256 says:

    doh…

    Myself I made a quick python script to paras the normal output and make it more user friendly.

  7. toodlestech says:

    Or he could just submit a patch like normal people do. Trivial article.

  8. Tacos says:

    @toodlestech, I believe the problem was that the Ubuntu package was out of date. This seems to be a common occurrence (at least in my experience). Then again, manually installing a package *IS* pretty trivial… I kinda wish this would have been in a roundup.

  9. pff says:

    This is exactly the problem with Ubuntu users, they are just windows users in disguise that cant fix anything for themselves.
    ‘help i cant open program.exe’
    typical help question from an ubuntu user.

  10. cantido says:

    Don’t mix debian packages into Ubuntu.. get the package source and rebuild it (Look at the new maintainer guide) for Ubuntu or just install Debian.

  11. darkore says:

    @pff, the problem is between your ears. If what you say it’s true, it only means that Ubuntu managed to put together an environment that can rival Windows, which can only be good news. Unfortunately this is not true in my experience.

  12. Jac says:

    While this is interesting to a suitable audience, I fail to see how “download the version that’s already patched, and install it on your system” is a hack.

    Now, if the Ubuntu PC would be an embedded device with a read-only root file system, and the program you want to run is closed-source and isn’t intended to run on the device, and is incompatible with the system libraries on that device, and you can get it to run anyway, that would impress me.

    (For an example by Yours Truly, see: http://www.linksysinfo.org/forums/showthread.php?t=63293 :-)

    ===Jac

  13. hans says:

    stupid way to set the package on hold. just do
    aptitude install binutils-avr=

  14. pff says:

    @darkore
    Most of the environment is more to do with the desktop manager. most linux distros are the same now anyway, there are exceptions of course.
    I didn’t mean that all people who use ubuntu are retarded (only really ~85%), i just meant that retarded people who use linux seem to use ubuntu, and then they act like theyre the best thing since sliced bread because it makes them cool and unique.

  15. John says:

    Thanks for this info — very useful to me.

  16. Tom says:

    Hi. An updated package has been uploaded to Ubuntu and can be downloaded and installed in 10.04 without any problem:

    http://archive.ubuntu.com/ubuntu/pool/universe/b/binutils-avr/

  17. Amos says:

    Does anyone know where I can get the source of just the avr-size program (preferably “fixed”) without having to download the entire 21MB binutils collection? Or, perhaps you’ve downloaded said binutils and can dig it out for me?

    I want to port it to a system for which I already have the rest of the (also gcc-based) tool-chain.

    Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 92,324 other followers