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