Project

General

Profile

Statistics
| Branch: | Revision:

root / scout_avr / bom / Makefile @ 89f527ad

History | View | Annotate | Download (963 Bytes)

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
16
VECT_FLAGS=$(FLAGS) -nostartfiles
17

    
18
default: bom.hex
19

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

    
23
bom.elf: $(SRC) $(HDR)
24
	avr-g++ $(FLAGS) $(SRC) -o $@
25

    
26
%.s: %.c
27
	avr-gcc $(FLAGS) -S $< -o $@
28

    
29
program: $(TARGET)
30
	avrdude -p $(PART) -c $(PROG) -P usb -B 5 -U flash:w:$(TARGET)
31

    
32
test.elf: test.c tiny-twi-sync.c tiny-twi-sync.h
33
	avr-g++ $(FLAGS) test.c tiny-twi-sync.c -o $@
34

    
35
bootloader.elf: bootloader.c tiny-twi-sync.c tiny-twi-sync.h
36
	avr-g++ $(BOOT_FLAGS) bootloader.c tiny-twi-sync.c -o $@
37

    
38
bootvectors.elf: bootvectors.S
39
	avr-g++ $(VECT_FLAGS) bootvectors.S -o $@
40

    
41
burn: bootloader.hex bootvectors.hex
42
	avrdude -p $(PART) -c $(PROG) -P usb -B 5 -U flash:w:bootloader.hex \
43
	  -U flash:w:bootvectors.hex