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