Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
495 kaklik 1
# makefile, written by guido socher
2
MCU=atmega168
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: blik.hex
9
#-------------------
10
help: 
11
	@echo "Usage: make all|load|load_pre|rdfuses|wrfuse1mhz|wrfuse4mhz|wrfusecrystal"
12
	@echo "Warning: you will not be able to undo wrfusecrystal unless you connect an"
13
	@echo "         external crystal! uC is dead after wrfusecrystal if you do not"
14
	@echo "         have an external crystal."
15
#-------------------
16
blik.hex : blik.out 
17
	$(OBJCOPY) -R .eeprom -O ihex blik.out blik.hex 
18
blik.out : blik.o 
19
	$(CC) $(CFLAGS) -o blik.out -Wl,-Map,blik.map blik.o 
20
blik.o : blik.c 
21
	$(CC) $(CFLAGS) -Os -c blik.c
22
#------------------
23
load: $(FILE).hex
24
	./prg_load_uc $(FILE).hex
25
# here is a pre-compiled version in case you have trouble with
26
# your development environment
27
load_pre: $(FILE).hex
28
	./prg_load_uc $(FILE)_pre.hex
29
#
30
loaduisp: $(FILE).hex
31
	./prg_load_uc -u $(FILE).hex
32
# here is a pre-compiled version in case you have trouble with
33
# your development environment
34
load_preuisp: $(FILE)_pre.hex
35
	./prg_load_uc -u avrm8ledtest.hex
36
#-------------------
37
# fuse byte settings:
38
#  Atmel AVR ATmega8 
39
#  Fuse Low Byte      = 0xe1 (1MHz internal), 0xe3 (4MHz internal), 0xe4 (8MHz internal)
40
#  Fuse High Byte     = 0xd9 
41
#  Factory default is 0xe1 for low byte and 0xd9 for high byte
42
# Check this with make rdfuses
43
rdfuses:
44
	./prg_fusebit_uc -r
45
# use internal RC oscillator 1 Mhz
46
wrfuse1mhz:
47
	./prg_fusebit_uc -w 1
48
# use internal RC oscillator 4 Mhz
49
wrfuse4mhz:
50
	./prg_fusebit_uc -w 4
51
# use external 3-8 Mhz crystal
52
# Warning: you can not reset this to intenal unless you connect a crystal!!
53
wrfusecrystal:
54
	@echo "Warning: The external crystal setting can not be changed back without a working crystal"
55
	@echo "         You have 3 seconds to abort this with crtl-c"
56
	@sleep 3
57
	./prg_fusebit_uc -w 0
58
#-------------------
59
clean:
60
	rm -f *.o *.map *.out *.hex
61
#-------------------