Blame | Last modification | View Log | Download
# makefile, written by kaklik
MCU=atmega128
CC=avr-gcc
OBJCOPY=avr-objcopy
# optimize for size:
CFLAGS=-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues
#-------------------
all: lcd_hd44780_test.hex
#-------------------
lcd_hd44780_test.hex : lcd_hd44780_test.out
$(OBJCOPY) -R .eeprom -O ihex lcd_hd44780_test.out lcd_hd44780_test.hex
lcd_hd44780_test.out : lcd_hd44780_test.o
$(CC) $(CFLAGS) -o lcd_hd44780_test.out -Wl,-Map,lcd_hd44780_test.map lcd_hd44780_test.o
lcd_hd44780_test.o : lcd_hd44780_test.c
$(CC) $(CFLAGS) -Os -c lcd_hd44780_test.c
#------------------
load: $(FILE).hex
./prg_load_uc $(FILE).hex
# here is a pre-compiled version in case you have trouble with
# your development environment
load_pre: $(FILE).hex
./prg_load_uc $(FILE)_pre.hex
#
loaduisp: $(FILE).hex
./prg_load_uc -u $(FILE).hex
# here is a pre-compiled version in case you have trouble with
# your development environment
load_preuisp: $(FILE)_pre.hex
./prg_load_uc -u avrm8ledtest.hex
#-------------------
# fuse byte settings:
# Atmel AVR ATmega8
# Fuse Low Byte = 0xe1 (1MHz internal), 0xe3 (4MHz internal), 0xe4 (8MHz internal)
# Fuse High Byte = 0xd9
# Factory default is 0xe1 for low byte and 0xd9 for high byte
# Check this with make rdfuses
rdfuses:
./prg_fusebit_uc -r
# use internal RC oscillator 1 Mhz
wrfuse1mhz:
./prg_fusebit_uc -w 1
# use internal RC oscillator 4 Mhz
wrfuse4mhz:
./prg_fusebit_uc -w 4
# use external 3-8 Mhz crystal
# Warning: you can not reset this to intenal unless you connect a crystal!!
wrfusecrystal:
@echo "Warning: The external crystal setting can not be changed back without a working crystal"
@echo " You have 3 seconds to abort this with crtl-c"
@sleep 3
./prg_fusebit_uc -w 0
#-------------------
clean:
rm -f *.o *.map *.out *.hex
#-------------------