Blame view

tests/atmega2560/makefile 896 Bytes
0168f2ba   pfrison   premier tests pou...
1
2
3
4
5
6
7
8
  export CC = avr-gcc
  
  export MCU = atmega2560
  export TARGET_ARCH = -mmcu=$(MCU)
  
  export CFLAGS =  -Wall -I. -DF_CPU=16000000 -Os #-g
  export LDFLAGS = -g $(TARGET_ARCH) -lm -Wl,--gc-sections #	-Os
  
7bb9b8f1   pfrison   Tests d'avr sur a...
9
  TARGET = servoControl
0168f2ba   pfrison   premier tests pou...
10
11
  TERM = /dev/ttyACM0
  CPPFLAGS = -mmcu=$(MCU)
7bb9b8f1   pfrison   Tests d'avr sur a...
12
13
  PGMERISP = -c wiring -b 115200 -P $(TERM) -D
  export DUDE = /usr/bin/avrdude -F -v -p $(MCU)
0168f2ba   pfrison   premier tests pou...
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  
  C_SRC = $(wildcard *.c)
  OBJS = $(C_SRC:.c=.o)
  
  all: $(TARGET).hex
  
  clean:
  	rm -f *.o *.hex *.elf
  
  %.o:%.c
  	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
  
  $(TARGET).elf: $(OBJS)
  	$(CC) $(LDFLAGS) -o $@ $(OBJS)
  
  $(TARGET).hex: $(TARGET).elf
  	avr-objcopy -j .text -j .data -O ihex $(TARGET).elf $(TARGET).hex
  	avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex $(TARGET).elf eeprom.hex
  
  upload: $(TARGET).hex
  	stty -F $(TERM) hupcl # reset
  	$(DUDE) $(PGMERISP) -U flash:w:$(TARGET).hex
  	make clean