Project

General

Profile

Statistics
| Branch: | Revision:

scoutos / scout_avr / bom / Makefile @ b99ee462

History | View | Annotate | Download (1.01 KB)

1
#PART=m328p
2
#MCU=atmega328
3

    
4
PART=t85
5
MCU=attiny85
6

    
7
PROG=avrispMKII
8
TARGET ?= bom.hex
9

    
10
F_CPU=1000000
11

    
12
SRC=bom.c tiny-twi.c
13
HDR=
14
FLAGS=-mmcu=$(MCU) -DF_CPU=$(F_CPU)UL -funsigned-char -Os -fpack-struct -Wall
15
BOOT_FLAGS=$(FLAGS) -Wl,-Ttext=0xA00,--defsym=strt_pgrm=0x1E
16
VECT_FLAGS=$(FLAGS) -nostartfiles
17

    
18
default: bom.hex bootloader.hex bootvectors.hex
19

    
20
%.hex: %.elf
21
	avr-objcopy -j .text -j .data -O ihex $< $@
22

    
23
%.bin: %.elf
24
	avr-objcopy -j .text -j .data -O binary $< $@
25

    
26
bom.elf: $(SRC) $(HDR)
27
	avr-gcc $(FLAGS) $(SRC) -o $@
28

    
29
%.s: %.c
30
	avr-gcc $(FLAGS) -S $< -o $@
31

    
32
program: $(TARGET)
33
	avrdude -p $(PART) -c $(PROG) -P usb -B 5 -U flash:w:$(TARGET)
34

    
35
blinky.elf: blinky.c
36
	avr-gcc $(FLAGS) blinky.c -o $@
37

    
38
bootloader.elf: bootloader.c tiny-twi-sync.c tiny-twi-sync.h
39
	avr-gcc $(BOOT_FLAGS) bootloader.c tiny-twi-sync.c -o $@
40

    
41
bootvectors.elf: bootvectors.S
42
	avr-gcc $(VECT_FLAGS) bootvectors.S -o $@
43

    
44
burn: bootloader.hex bootvectors.hex
45
	avrdude -p $(PART) -c $(PROG) -P usb -B 5 -U flash:w:bootloader.hex \
46
	  -U flash:w:bootvectors.hex