Tips and Tricks

From AVR-Eclipse

Jump to: navigation, search

Here you can share useful tips to get the most out of the AVR Eclipse Plugin. Eclipse is a very powerful tool with many features and options. Due to the sheer size of Eclipse it is sometimes difficult to find the right places for your optimization. On this page I will add items I have discovered and you are welcome to do the same.

Contents


Print application size before build

As the ROM and RAM space of an AVR microcontroller is limited, it is useful to track the delta memory consumption between builds. A "Size Before" function cannot be fully integrated into the Plugin due to the way Eclipse/CDT generates the makefile. However this functionality can easily be added manually: Open the project properties, go to C/C++ Build > Settings > Build Steps and set the following as the Pre-build steps command:

SizeBefore.png

Note: Under Linux (Fedora11) + Eclipse 3.5 (Galileo) this tip fails. The executable seems to have been deleted before this step is run?

Autosave before build

If you have Build Automatically disabled in the Project Menu, it makes sense to have Eclipse save all open files when starting a build, so it won't build without the latest changes you made and forgot to save. To activate Autosave open the Eclipse Preferences (Window > Preferences...) and select General -> Workspace. Here the Save automatically before build option can be enabled.

Generate flash images in formats other than iHex

The plugin only generates image files in the Intel iHex format. This was a deliberate design choice to reduce options clutter in the settings and to avoid potential pitfalls for less experienced users.

However in some situations generating flash images in other formats than iHex might be required. This can be done with a postbuild step. For example, to generate a flash image in the raw binary format enter the following line in the postbuild step command field:

avr-objcopy -R .eeprom -O binary ${BuildArtifactFileName}  ${BuildArtifactFileBaseName}.bin

After a project build the file projectname.bin can be found in the folder with the name of the active build configuration, e.g. Debug.

Postbuild binary image.png

To generate other formats than raw binary change the "-O binary" option to your required format. Currently avr-objcopy supports the following formats: elf32-avr, coff-avr, coff-ext-avr, elf32-little, elf32-big, srec, symbolsrec, tekhex, binary, and ihex

Personal tools