Details | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 183 | andfri | 1 | PRG = main |
| 2 | OBJ = main.o |
||
| 229 | andfri | 3 | MCU_TARGET = atmega88 |
| 183 | andfri | 4 | OPTIMIZE = -Os -mcall-prologues |
| 229 | andfri | 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 |
||
| 183 | andfri | 8 | |
| 223 | andfri | 9 | DEFS = -I../AVR-Bios |
| 183 | andfri | 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) |
||
| 229 | andfri | 19 | 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) |
||
| 183 | andfri | 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 --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 |