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