507 |
kaklik |
1 |
# makefile, written by kaklik
|
|
|
2 |
MCU=atmega128
|
|
|
3 |
CC=avr-gcc
|
|
|
4 |
OBJCOPY=avr-objcopy
|
|
|
5 |
# optimize for size:
|
|
|
6 |
CFLAGS=-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues
|
|
|
7 |
#-------------------
|
|
|
8 |
all: lcd_hd44780_test.hex
|
|
|
9 |
#-------------------
|
|
|
10 |
lcd_hd44780_test.hex : lcd_hd44780_test.out
|
|
|
11 |
$(OBJCOPY) -R .eeprom -O ihex lcd_hd44780_test.out lcd_hd44780_test.hex
|
|
|
12 |
lcd_hd44780_test.out : lcd_hd44780_test.o
|
|
|
13 |
$(CC) $(CFLAGS) -o lcd_hd44780_test.out -Wl,-Map,lcd_hd44780_test.map lcd_hd44780_test.o
|
|
|
14 |
lcd_hd44780_test.o : lcd_hd44780_test.c
|
|
|
15 |
$(CC) $(CFLAGS) -Os -c lcd_hd44780_test.c
|
|
|
16 |
#------------------
|
|
|
17 |
load: $(FILE).hex
|
|
|
18 |
./prg_load_uc $(FILE).hex
|
|
|
19 |
# here is a pre-compiled version in case you have trouble with
|
|
|
20 |
# your development environment
|
|
|
21 |
load_pre: $(FILE).hex
|
|
|
22 |
./prg_load_uc $(FILE)_pre.hex
|
|
|
23 |
#
|
|
|
24 |
loaduisp: $(FILE).hex
|
|
|
25 |
./prg_load_uc -u $(FILE).hex
|
|
|
26 |
# here is a pre-compiled version in case you have trouble with
|
|
|
27 |
# your development environment
|
|
|
28 |
load_preuisp: $(FILE)_pre.hex
|
|
|
29 |
./prg_load_uc -u avrm8ledtest.hex
|
|
|
30 |
#-------------------
|
|
|
31 |
# fuse byte settings:
|
|
|
32 |
# Atmel AVR ATmega8
|
|
|
33 |
# Fuse Low Byte = 0xe1 (1MHz internal), 0xe3 (4MHz internal), 0xe4 (8MHz internal)
|
|
|
34 |
# Fuse High Byte = 0xd9
|
|
|
35 |
# Factory default is 0xe1 for low byte and 0xd9 for high byte
|
|
|
36 |
# Check this with make rdfuses
|
|
|
37 |
rdfuses:
|
|
|
38 |
./prg_fusebit_uc -r
|
|
|
39 |
# use internal RC oscillator 1 Mhz
|
|
|
40 |
wrfuse1mhz:
|
|
|
41 |
./prg_fusebit_uc -w 1
|
|
|
42 |
# use internal RC oscillator 4 Mhz
|
|
|
43 |
wrfuse4mhz:
|
|
|
44 |
./prg_fusebit_uc -w 4
|
|
|
45 |
# use external 3-8 Mhz crystal
|
|
|
46 |
# Warning: you can not reset this to intenal unless you connect a crystal!!
|
|
|
47 |
wrfusecrystal:
|
|
|
48 |
@echo "Warning: The external crystal setting can not be changed back without a working crystal"
|
|
|
49 |
@echo " You have 3 seconds to abort this with crtl-c"
|
|
|
50 |
@sleep 3
|
|
|
51 |
./prg_fusebit_uc -w 0
|
|
|
52 |
#-------------------
|
|
|
53 |
clean:
|
|
|
54 |
rm -f *.o *.map *.out *.hex
|
|
|
55 |
#-------------------
|