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