Subversion Repositories svnkaklik

Rev

Rev 410 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

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