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