Subversion Repositories HomeAutomation

Rev

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

Rev 236 Rev 313
Line 2... Line 2...
2
OBJ            = main.o
2
OBJ            = main.o
3
MCU_TARGET     = atmega88
3
MCU_TARGET     = atmega88
4
OPTIMIZE       = -Os -mcall-prologues
4
OPTIMIZE       = -Os -mcall-prologues
5
# grep bios.map for __bios_ram_end to retreive this value
5
# grep bios.map for __bios_ram_end to retreive this value
6
# In the future, this should be automatically inserted into *_app.ld at every bios compilation
6
# In the future, this should be automatically inserted into *_app.ld at every bios compilation
7
BIOS_RAM_END   = 0x0080015d
7
BIOS_RAM_END   = 0x0080012a
8
ifeq ($(MCU_TARGET),atmega88)
-
 
9
	#uncomment this line if you're using m88, remove line when gcc-bug fixed
-
 
10
	EXTRA_LD        = avr-ld -m avr4 -o $(PRG).elf /usr/avr/lib/avr4/crtm88.o -L/usr/lib/gcc/avr/4.1.0/avr4 -L/usr/lib/gcc/avr/4.1.0/avr4 -L/usr/avr/lib/avr4 -Map $(PRG).map -L../AVR-Bios --defsym __bios_ram_end=$(BIOS_RAM_END) -T$(MCU_TARGET)_app.ld $(PRG).o -lgcc -lc -lgcc
-
 
11
endif
-
 
12
 
8
 
13
DEFS           = -I../AVR-Bios
9
DEFS           = -I../AVR-Bios
14
LIBS           =
10
LIBS           =
15
 
11
 
16
# You should not have to change anything below here.
12
# You should not have to change anything below here.
17
 
13
 
18
CC             = avr-gcc
14
CC             = avr-gcc
19
 
15
 
20
# Override is only needed by avr-lib build system.
16
# Override is only needed by avr-lib build system.
21
 
17
 
22
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
18
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
23
override LDFLAGS       = -v -Wl,-Map,$(PRG).map,-L../AVR-Bios,--defsym,__bios_ram_end=$(BIOS_RAM_END),-T$(MCU_TARGET)_app.ld
19
override LDFLAGS       = -v -Wl,-Map,$(PRG).map,-L../AVR-Bios,--defsym,__bios_ram_end=$(BIOS_RAM_END),-T$(MCU_TARGET)_app.ld
24
override ASFLAGS       = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(MCU_TARGET) $(DEFS)
20
override ASFLAGS       = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(MCU_TARGET) $(DEFS)
25
 
21
 
26
OBJCOPY        = avr-objcopy
22
OBJCOPY        = avr-objcopy
27
OBJDUMP        = avr-objdump
23
OBJDUMP        = avr-objdump
28
SIZE           = avr-size
24
SIZE           = avr-size
29
SZFLAGS        = 
25
SZFLAGS        = 
30
UPLOAD         = avrdude
26
UPLOAD         = avrdude
31
ULFLAGS        = -p $(MCU_TARGET) -D -P /dev/ttyUSB0 -c avrispv2 -b 115200 -U flash:w:$(PRG).hex
27
ULFLAGS        = -p $(MCU_TARGET) -D -P /dev/ttyUSB0 -c avrispv2 -b 115200 -U flash:w:$(PRG).hex
32
# -D disables erase!
28
# -D disables erase!
33
 
29
 
34
default: $(PRG).elf lst text
30
default: $(PRG).elf lst text
35
	@$(SIZE) $(SZFLAGS) $(PRG).elf
31
	@$(SIZE) $(SZFLAGS) $(PRG).elf
36
 
32
 
37
all: $(PRG).elf lst text eeprom
33
all: $(PRG).elf lst text eeprom
38
 
34
 
39
$(PRG).elf: $(OBJ)
35
$(PRG).elf: $(OBJ)
-
 
36
ifeq ($(MCU_TARGET),atmega88)
-
 
37
	#remove this workaround when gcc-bug fixed
-
 
38
	avr-ld -m avr4 -o $(PRG).elf /usr/avr/lib/avr4/crtm88.o -L/usr/lib/gcc/avr/4.1.0/avr4 -L/usr/lib/gcc/avr/4.1.0/avr4 -L/usr/avr/lib/avr4 -Map $(PRG).map -L../AVR-Bios --defsym __bios_ram_end=$(BIOS_RAM_END) -T$(MCU_TARGET)_app.ld $(OBJ) -lgcc -lc -lgcc
-
 
39
else
40
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
40
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
41
	$(EXTRA_LD)
41
endif
42
 
42
 
43
clean:
43
clean:
44
	rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak 
44
	rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak 
45
	rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
45
	rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
46
 
46