Rev 348 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 348 | Rev 349 | ||
|---|---|---|---|
| 1 | PRG = main |
1 | PRG = main |
| 2 | OBJ = main.o\ |
2 | OBJ = main.o\ |
| 3 | ../lib/src/lcd/lcd_HD44780.o\ |
3 | ../lib/src/lcd/lcd_HD44780.o\ |
| 4 | # ../lib/src/lcd/clcd20x4.o\ |
4 | # ../lib/src/lcd/clcd20x4.o\ |
| 5 | 5 | ||
| 6 | MCU_TARGET = atmega88 |
6 | MCU_TARGET = atmega88 |
| 7 | OPTIMIZE = -Os -mcall-prologues |
7 | OPTIMIZE = -Os -mcall-prologues |
| 8 | # grep bios.map for __bios_ram_end to retreive this value |
8 | # grep bios.map for __bios_ram_end to retreive this value |
| 9 | # In the future, this should be automatically inserted into *_app.ld at every bios compilation |
9 | # In the future, this should be automatically inserted into *_app.ld at every bios compilation |
| 10 | BIOS_RAM_END = 0x0080012a |
10 | BIOS_RAM_END = 0x0080012a |
| 11 | #0x0080015d |
11 | #0x0080015d |
| 12 | ifeq ($(MCU_TARGET),atmega88) |
12 | ifeq ($(MCU_TARGET),atmega88) |
| 13 | #uncomment this line if you're using m88, remove line when gcc-bug fixed |
13 | #uncomment this line if you're using m88, remove line when gcc-bug fixed |
| 14 | 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 |
14 | 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 |
| 15 | endif |
15 | endif |
| 16 | BIOS_RAM_END = 0x0080012a |
16 | BIOS_RAM_END = 0x0080012a |
| 17 | 17 | ||
| 18 | DEFS = -I../AVR-Bios\ |
18 | DEFS = -I../AVR-Bios\ |
| 19 | -I../lib/src/lcd\ |
19 | -I../lib/src/lcd\ |
| 20 | -I../lib/funcdefs\ |
20 | -I../lib/funcdefs\ |
| 21 | 21 | ||
| 22 | LIBS = |
22 | LIBS = |
| 23 | 23 | ||
| 24 | # You should not have to change anything below here. |
24 | # You should not have to change anything below here. |
| 25 | 25 | ||
| 26 | CC = avr-gcc |
26 | CC = avr-gcc |
| 27 | 27 | ||
| 28 | # Override is only needed by avr-lib build system. |
28 | # Override is only needed by avr-lib build system. |
| 29 | 29 | ||
| 30 | override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) |
30 | override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) |
| 31 | override LDFLAGS = -v -Wl,-Map,$(PRG).map,-L../AVR-Bios,--defsym,__bios_ram_end=$(BIOS_RAM_END),-T$(MCU_TARGET)_app.ld |
31 | override LDFLAGS = -v -Wl,-Map,$(PRG).map,-L../AVR-Bios,--defsym,__bios_ram_end=$(BIOS_RAM_END),-T$(MCU_TARGET)_app.ld |
| 32 | override ASFLAGS = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(MCU_TARGET) $(DEFS) |
32 | override ASFLAGS = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(MCU_TARGET) $(DEFS) |
| 33 | 33 | ||
| 34 | OBJCOPY = avr-objcopy |
34 | OBJCOPY = avr-objcopy |
| 35 | OBJDUMP = avr-objdump |
35 | OBJDUMP = avr-objdump |
| 36 | SIZE = avr-size |
36 | SIZE = avr-size |
| 37 | SZFLAGS = |
37 | SZFLAGS = |
| 38 | UPLOAD = avrdude |
38 | UPLOAD = avrdude |
| 39 | ULFLAGS = -p $(MCU_TARGET) -D -P /dev/ttyUSB0 -c avrispv2 -b 115200 -U flash:w:$(PRG).hex |
39 | ULFLAGS = -p $(MCU_TARGET) -D -P /dev/ttyUSB0 -c avrispv2 -b 115200 -U flash:w:$(PRG).hex |
| 40 | # -D disables erase! |
40 | # -D disables erase! |
| 41 | 41 | ||
| 42 | default: $(PRG).elf lst text |
42 | default: $(PRG).elf lst text |
| 43 | @$(SIZE) $(SZFLAGS) $(PRG).elf |
43 | @$(SIZE) $(SZFLAGS) $(PRG).elf |
| 44 | 44 | ||
| 45 | all: $(PRG).elf lst text eeprom |
45 | all: $(PRG).elf lst text eeprom |
| 46 | 46 | ||
| 47 | $(PRG).elf: $(OBJ) |
47 | $(PRG).elf: $(OBJ) |
| 48 | ifeq ($(MCU_TARGET),atmega88) |
48 | ifeq ($(MCU_TARGET),atmega88) |
| 49 | #remove this workaround when gcc-bug fixed |
49 | #remove this workaround when gcc-bug fixed |
| 50 | 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 |
50 | 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 |
| 51 | else |
51 | else |
| 52 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) |
52 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) |
| 53 | endif |
53 | endif |
| 54 | 54 | ||
| 55 | clean: |
55 | clean: |
| 56 | rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak $(OBJ) |
56 | rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak $(OBJ) |
| 57 | rm -rf *.lst *.map $(EXTRA_CLEAN_FILES) |
57 | rm -rf *.lst *.map $(EXTRA_CLEAN_FILES) |
| 58 | 58 | ||
| 59 | lst: $(PRG).lst |
59 | lst: $(PRG).lst |
| 60 | 60 | ||
| 61 | %.lst: %.elf |
61 | %.lst: %.elf |
| 62 | $(OBJDUMP) -h -S $< > $@ |
62 | $(OBJDUMP) -h -S $< > $@ |
| 63 | 63 | ||
| 64 | # Rules for building the .text rom images |
64 | # Rules for building the .text rom images |
| 65 | 65 | ||
| 66 | text: hex bin srec |
66 | text: hex bin srec |
| 67 | 67 | ||
| 68 | hex: $(PRG).hex |
68 | hex: $(PRG).hex |
| 69 | bin: $(PRG).bin |
69 | bin: $(PRG).bin |
| 70 | srec: $(PRG).srec |
70 | srec: $(PRG).srec |
| 71 | 71 | ||
| 72 | %.hex: %.elf |
72 | %.hex: %.elf |
| 73 | $(OBJCOPY) -j .text -j .data -O ihex $< $@ |
73 | $(OBJCOPY) -j .text -j .data -O ihex $< $@ |
| 74 | 74 | ||
| 75 | %.srec: %.elf |
75 | %.srec: %.elf |
| 76 | $(OBJCOPY) -j .text -j .data -O srec $< $@ |
76 | $(OBJCOPY) -j .text -j .data -O srec $< $@ |
| 77 | 77 | ||
| 78 | %.bin: %.elf |
78 | %.bin: %.elf |
| 79 | $(OBJCOPY) -j .text -j .data -O binary $< $@ |
79 | $(OBJCOPY) -j .text -j .data -O binary $< $@ |
| 80 | 80 | ||
| 81 | # Rules for uploading rom images to flash |
81 | # Rules for uploading rom images to flash |
| 82 | 82 | ||
| 83 | install: hex |
83 | install: hex |
| 84 | $(UPLOAD) $(ULFLAGS) |
84 | $(UPLOAD) $(ULFLAGS) |
| 85 | 85 | ||
| 86 | # Rules for building the .eeprom rom images |
86 | # Rules for building the .eeprom rom images |
| 87 | 87 | ||
| 88 | eeprom: ehex ebin esrec |
88 | eeprom: ehex ebin esrec |
| 89 | 89 | ||
| 90 | ehex: $(PRG)_eeprom.hex |
90 | ehex: $(PRG)_eeprom.hex |
| 91 | ebin: $(PRG)_eeprom.bin |
91 | ebin: $(PRG)_eeprom.bin |
| 92 | esrec: $(PRG)_eeprom.srec |
92 | esrec: $(PRG)_eeprom.srec |
| 93 | 93 | ||
| 94 | %_eeprom.hex: %.elf |
94 | %_eeprom.hex: %.elf |
| 95 | $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ |
95 | $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ |
| 96 | 96 | ||
| 97 | %_eeprom.srec: %.elf |
97 | %_eeprom.srec: %.elf |
| 98 | $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@ |
98 | $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@ |
| 99 | 99 | ||
| 100 | %_eeprom.bin: %.elf |
100 | %_eeprom.bin: %.elf |
| 101 | $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@ |
101 | $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@ |
| 102 | 102 | ||
| 103 | # Every thing below here is used by avr-libc's build system and can be ignored |
103 | # Every thing below here is used by avr-libc's build system and can be ignored |
| 104 | # by the casual user. |
104 | # by the casual user. |
| 105 | 105 | ||
| 106 | FIG2DEV = fig2dev |
106 | FIG2DEV = fig2dev |
| 107 | EXTRA_CLEAN_FILES = *.hex *.bin *.srec |
107 | EXTRA_CLEAN_FILES = *.hex *.bin *.srec |
| 108 | 108 | ||
| 109 | dox: eps png pdf |
109 | dox: eps png pdf |
| 110 | 110 | ||
| 111 | eps: $(PRG).eps |
111 | eps: $(PRG).eps |
| 112 | png: $(PRG).png |
112 | png: $(PRG).png |
| 113 | pdf: $(PRG).pdf |
113 | pdf: $(PRG).pdf |
| 114 | 114 | ||
| 115 | %.eps: %.fig |
115 | %.eps: %.fig |
| 116 | $(FIG2DEV) -L eps $< $@ |
116 | $(FIG2DEV) -L eps $< $@ |
| 117 | 117 | ||
| 118 | %.pdf: %.fig |
118 | %.pdf: %.fig |
| 119 | $(FIG2DEV) -L pdf $< $@ |
119 | $(FIG2DEV) -L pdf $< $@ |
| 120 | 120 | ||
| 121 | %.png: %.fig |
121 | %.png: %.fig |
| 122 | $(FIG2DEV) -L png $< $@ |
122 | $(FIG2DEV) -L png $< $@ |
| 123 | 123 | ||