Statistics
| Branch: | Revision:

root / Makefile @ 20e5429c

History | View | Annotate | Download (858 Bytes)

1
PART=t1634
2
MCU=attiny1634
3
#MCU=atmega2560
4
F_CPU=1000000
5
SRC=main.c serial.c \
6
		freemodbus/port/*.c \
7
		freemodbus/modbus/mb.c \
8
		freemodbus/modbus/rtu/mbrtu.c \
9
		freemodbus/modbus/ascii/mbascii.c \
10
		freemodbus/modbus/functions/*.c
11
HDR=tooltron_mb.h serial.h freemodbus/port/*.h
12

    
13
# TODO we can exclude modbus functions we don't need if the generated hex file
14
# ends up too large
15

    
16
FLAGS=-Os -Wall -mmcu=$(MCU) -DF_CPU=$(F_CPU) \
17
			-Ifreemodbus/port \
18
			-Ifreemodbus/modbus/rtu \
19
			-Ifreemodbus/modbus/ascii \
20
			-Ifreemodbus/modbus/include
21

    
22
PROG=avrispMKII
23

    
24
all: toolbox.hex
25

    
26
%.hex: %.elf
27
	avr-objcopy -j .text -j .data -O ihex $< $@
28

    
29
toolbox.elf: $(SRC) $(HDR)
30
	avr-gcc $(FLAGS) $(SRC) -o $@
31

    
32
%.asm: %.c
33
	avr-gcc -S $(FLAGS) $< -o $@
34

    
35
program: toolbox.hex
36
	avrdude -p $(PART) -c $(PROG) -P usb -B 1 -F -U flash:w:toolbox.hex
37

    
38
clean:
39
	rm -f *.elf *.hex