#!/bin/bash Proj=${1} Part=${2:-${AVR_DEFAULT_PART:-atmega168}} BuildDir=${AVR_BUILD_DIR:-/tmp/} SourceFile=${Proj}.c ElfFile=${BuildDir}/${Proj}.elf HexFile=${BuildDir}/${Proj}.hex EepFile=${BuildDir}/${Proj}.eep echo Building $SourceFile for $Part avr-gcc -g -Os -mmcu=$Part -o $ElfFile $SourceFile && \ avr-objcopy -j .text -j .data -O ihex $ElfFile $HexFile && \ avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex $ElfFile $EepFile || \ echo Build Failed