Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

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