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