If you're using Proteus 8.1, there is a way to automate this behaviour (.bin generation).
Proteus 8 has its compiler settings stored in .xml files in the (C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\VSM Studio\compilers) folder. For example, winavr.xml defines your winavr compiler/linker settings. Labcenter probably doesn't want you to (you could screw up), but you can edit these files on your own with an .xml editor and add additional compilation steps, alter parameters, etc. Hell, you could set it up to your own compiler/linker combo to suit your needs completely.
Back to the problem! winavr.xml already has an entry describing eeprom file generation, but it's in the wrong (for our purpose) format - Intel hex (.eep). We need it in .bin (plain binary). Here's the line:
Code:
$(OBJ) avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex "%OUTFILE_DIR%/%OUTFILE_NAME%.elf" "%OUTFILE_DIR%/%OUTFILE_NAME%.eep" || exit 0
As you can see, this behaviour outputs .eeprom section from the .elf file, adjusts it a bit and outputs it in ihex (intel hex) format. That's the
Code:
-O ihex "%OUTFILE_DIR%/%OUTFILE_NAME%.elf" "%OUTFILE_DIR%/%OUTFILE_NAME%.eep"
part.
You can actually just double this entry in a .xml editor, switch the extension and set -O binary and you have a .bin generated each time, along your .eep!
The new enty looks like this:
Code:
$(OBJ) avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O binary "%OUTFILE_DIR%/%OUTFILE_NAME%.elf" "%OUTFILE_DIR%/%OUTFILE_NAME%.bin" || exit 0
Since (this kind of) xml holds data in a HTML-like format (" everywhere!), you can't easily edit this line into your winavr.xml.
That's why I've rendered it to xml for you, so you just need to open winavr.xml in notepad++ and add:
Code:
<POSTPROCESS TOOL="LD" CMDLINE="$(OBJ) avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O binary "%OUTFILE_DIR%/%OUTFILE_NAME%.elf" "%OUTFILE_DIR%/%OUTFILE_NAME%.bin" || exit 0 " />
after
Code:
<POSTPROCESS TOOL="LD" CMDLINE="$(OBJ) avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex "%OUTFILE_DIR%/%OUTFILE_NAME%.elf" "%OUTFILE_DIR%/%OUTFILE_NAME%.eep" || exit 0 " />
which is line 607 in my winavr.xml
Now, it Proteus generates .bin on every build!