Blame view

Tangible/Makefile 724 Bytes
67b73333   amoreau   Ajout du squelette
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
  MCU = atmega328p
  FCPU = 16000000
  
  CC = avr-gcc
  LD = avr-gcc
  FLAGS = -mmcu=$(MCU)
  CFLAGS = -Wall $(FLAGS) -DF_CPU=$(FCPU) -Os
  LDFLAGS = $(FLAGS)
  
  DUDE = avrdude
  PROTOCOL = stk500v1	# stk500 / stk500v1
  SPEED = 115200		# 57600 / 115200
  SERIAL = /dev/ttyACM0	# ttyUSB0 / ttyACM0
  
  TARGET = broadcast
  SOURCES = $(wildcard *.c)
  OBJECTS = $(SOURCES:.c=.o)
  
  all: $(TARGET).hex
  
  clean:
  	rm -f *.o $(TARGET).hex $(TARGET)
  
  $(TARGET): $(OBJECTS)
  
  $(TARGET).hex: $(TARGET)
  	avr-objcopy -j .text -j .data -O ihex $(TARGET) $(TARGET).hex
  
  upload: $(TARGET).hex
  	stty -F $(SERIAL) hupcl
  	$(DUDE) -F -v -p $(MCU) -c $(PROTOCOL) -b $(SPEED) -P $(SERIAL) -U flash:w:$(TARGET).hex
  
  size: $(TARGET)
  	avr-size --format=avr --mcu=$(MCU) $(TARGET)