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