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