aboutsummaryrefslogtreecommitdiffstats
path: root/boo-stanby-watcher/Makefile
blob: 2646d03cc60a4b90b644d9aeb109d90df0f70da8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
DEVICE     = attiny25
CLOCK      = 1000000
FUSES      = -U lfuse:w:0x62:m -U hfuse:w:0xdd:m

PROGRAMMER = avrdude
PROGRAMMER += -c buspirate
PROGRAMMER += -P /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A400XJSH-if00-port0
PROGRAMMER += -p $(DEVICE) -B 4

DEFS    = -DF_CPU=$(CLOCK)UL
CFLAGS  = -Wall -Werror -pedantic -std=c99
CFLAGS += -O2 -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -mmcu=$(DEVICE) $(DEFS)
#LIBS    = -Wl,--relax,--gc-sections,--print-gc-sections,--entry=main
#LIBS = -Wl,--entry=main,--gc-sections,--rela
#LDFLAGS = $(LIBS)

all: main.hex size

main.hex: main.c
	avr-gcc -o main.elf $? $(CFLAGS) $(LDFLAGS)
	avr-objcopy -j .text -j .data -O ihex main.elf main.hex

f: flash
flash: all
	$(PROGRAMMER) -U flash:w:main.hex:i

fuse:
	$(PROGRAMMER) $(FUSES)

clean:
	rm -f *.o *.elf *.hex

size:
	avr-size --mcu=$(DEVICE) -t -A main.elf
	avr-size --mcu=$(DEVICE) -C main.elf
	avr-nm --size-sort main.elf