Subversion Repositories HomeAutomation

Rev

Rev 283 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 283 Rev 284
Line 1... Line 1...
1
PRG            = bios
1
PRG            = bios
2
OBJ            = vectors.o bios.o flash.o mcp2515/mcp2515.o
2
OBJ            = vectors.o bios.o flash.o mcp2515/mcp2515.o
3
MCU_TARGET     = atmega8
3
MCU_TARGET     = atmega88
4
OPTIMIZE       = -Os -mcall-prologues
4
OPTIMIZE       = -Os -mcall-prologues
5
BIOS_START     = 0x1400
5
BIOS_START     = 0xd00
6
BOOT_START     = 0x1e00
6
BOOT_START     = 0x1e00
7
 
7
 
8
DEFS           =
8
DEFS           =
9
LIBS           =
9
LIBS           =
10
 
10
 
11
TARGET_CLK_SRC = 0x24
11
TARGET_CLK_SRC = 0xe2
12
#TARGET_CLK_SRC for mega88		
12
#TARGET_CLK_SRC for mega88		
13
#0xe7		#CKDIV8=1, external crystal
13
#0xe7		#CKDIV8=1, external crystal
14
#0xe0		#CKDIV8=1, external clock
14
#0xe0		#CKDIV8=1, external clock
15
#0xe2		#CKDIV8=1, internal RC
15
#0xe2		#CKDIV8=1, internal RC
16
#TARGET_CLK_SRC for mega8
16
#TARGET_CLK_SRC for mega8
17
#0x24		#BODLEVEL = 4.0V, BODEN=enabled, internal 8MHz
17
#0x24		#BODLEVEL = 4.0V, BODEN=enabled, internal 8MHz
18
#0x20		#BODLEVEL = 4.0V, BODEN=enabled, external clock
18
#0x20		#BODLEVEL = 4.0V, BODEN=enabled, external clock
19
 
19
 
-
 
20
#uncomment this line for programming fuses 
-
 
21
#PRGFUSES 	= ok
-
 
22
 
20
#
23
#
21
# You should not have to change anything below here.
24
# You should not have to change anything below here.
22
#
25
#
23
 
26
 
24
CC             = avr-gcc
27
CC             = avr-gcc
25
 
28
 
26
# Override is only needed by avr-lib build system.
29
# Override is only needed by avr-lib build system.
27
 
30
 
28
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
31
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
29
override LDFLAGS       = -Wl,-Map,$(PRG).map,--defsym,__bios_start=$(BIOS_START),--defsym,__boot_start=$(BOOT_START),-T$(MCU_TARGET)_bios.ld,--cref
32
override LDFLAGS       = -Wl,-Map,$(PRG).map,--defsym,__bios_start=$(BIOS_START),--defsym,__boot_start=$(BOOT_START),-T$(MCU_TARGET)_bios.ld,--cref
30
override ASFLAGS       = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(MCU_TARGET) $(DEFS)
33
override ASFLAGS       = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(MCU_TARGET) $(DEFS)
Line 33... Line 36...
33
OBJDUMP        = avr-objdump
36
OBJDUMP        = avr-objdump
34
SIZE           = avr-size
37
SIZE           = avr-size
35
SZFLAGS        = 
38
SZFLAGS        = 
36
UPLOAD         = avrdude
39
UPLOAD         = avrdude
37
#avrispv2 avr910
40
#avrispv2 avr910
38
ULFLAGS        = -p $(MCU_TARGET) -P /dev/ttyS0 -c avr910 -b 115200 -U flash:w:$(PRG).hex
41
ULFLAGS        = -p $(MCU_TARGET) -P /dev/ttyUSB0 -c avrispv2 -b 115200 -U flash:w:$(PRG).hex
39
 
42
 
40
ifeq ($(MCU_TARGET),atmega88)
43
ifeq ($(MCU_TARGET),atmega88)
41
#BOOTRST=0, BOOTSZ0=1, BOOTSZ1=1
44
#BOOTRST=0, BOOTSZ0=0, BOOTSZ1=1
42
EXTFUSE  = 0x06
45
EXTFUSE  = 0x04
43
#BODLEVEL = 4.3V
46
#BODLEVEL = 4.3V
44
HIGHFUSE = 0xdc
47
HIGHFUSE = 0xdc
45
LOWFUSE  = $(TARGET_CLK_SRC)
48
LOWFUSE  = $(TARGET_CLK_SRC)
46
endif
49
endif
47
 
50
 
48
ifeq ($(MCU_TARGET),atmega8)
51
ifeq ($(MCU_TARGET),atmega8)
49
#BOOTRST=0, BOOTSZ0=1, BOOTSZ1=1
52
#BOOTRST=0, BOOTSZ0=0, BOOTSZ1=1
50
HIGHFUSE = 0xd6
53
HIGHFUSE = 0xd4
51
LOWFUSE  = $(TARGET_CLK_SRC)
54
LOWFUSE  = $(TARGET_CLK_SRC)
52
endif
55
endif
53
 
56
 
54
AVRDUDE_WRITE_FUSEBITS = -u
57
AVRDUDE_WRITE_FUSEBITS = -u
55
ifdef EXTFUSE
58
ifdef EXTFUSE
56
AVRDUDE_WRITE_FUSEBITS += -U efuse:w:$(EXTFUSE):m
59
AVRDUDE_WRITE_FUSEBITS += -U efuse:w:$(EXTFUSE):m
57
endif
60
endif
58
ifdef HIGHFUSE
61
ifdef HIGHFUSE
59
AVRDUDE_WRITE_FUSEBITS += -U hfuse:w:$(HIGHFUSE):m
62
AVRDUDE_WRITE_FUSEBITS += -U hfuse:w:$(HIGHFUSE):m
60
endif
63
endif
61
ifdef LOWFUSE
64
ifdef LOWFUSE
62
AVRDUDE_WRITE_FUSEBITS += -U lfuse:w:$(LOWFUSE):m
65
AVRDUDE_WRITE_FUSEBITS += -U lfuse:w:$(LOWFUSE):m
63
endif
66
endif
64
 
67
 
65
#comment this line for not programming fusebits
68
#comment this line for not programming fusebits
-
 
69
ifdef PRGFUSES
66
#ULFLAGS      += $(AVRDUDE_WRITE_FUSEBITS)
70
ULFLAGS      += $(AVRDUDE_WRITE_FUSEBITS)
-
 
71
endif
67
 
72
 
68
default: $(PRG).elf lst
73
default: $(PRG).elf lst
69
	@$(SIZE) $(SZFLAGS) $(PRG).elf
74
	@$(SIZE) $(SZFLAGS) $(PRG).elf
70
 
75
 
71
all: $(PRG).elf lst text eeprom
76
all: $(PRG).elf lst text eeprom