413
|
1 |
###############################################################################
|
|
2 |
# Makefile for the project SlaveAVR
|
|
3 |
###############################################################################
|
|
4 |
|
|
5 |
## General Flags
|
|
6 |
PROJECT = SlaveAVR
|
|
7 |
MCU = at90can128
|
|
8 |
TARGET = SlaveAVR.elf
|
|
9 |
CC = avr-gcc.exe
|
|
10 |
|
|
11 |
## Options common to compile, link and assembly rules
|
|
12 |
COMMON = -mmcu=$(MCU)
|
|
13 |
|
|
14 |
## Compile options common for all C compilation units.
|
|
15 |
CFLAGS = $(COMMON)
|
|
16 |
CFLAGS += -Wall -gdwarf-2 -Os -fsigned-char -fpack-struct
|
|
17 |
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
|
|
18 |
|
|
19 |
## Assembly specific flags
|
|
20 |
ASMFLAGS = $(COMMON)
|
|
21 |
ASMFLAGS += $(CFLAGS)
|
|
22 |
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2
|
|
23 |
|
|
24 |
## Linker flags
|
|
25 |
LDFLAGS = $(COMMON)
|
|
26 |
LDFLAGS += -Wl,-Map=SlaveAVR.map
|
|
27 |
|
|
28 |
|
|
29 |
## Intel Hex file production flags
|
|
30 |
HEX_FLASH_FLAGS = -R .eeprom
|
|
31 |
|
|
32 |
HEX_EEPROM_FLAGS = -j .eeprom
|
|
33 |
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
|
|
34 |
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings
|
|
35 |
|
|
36 |
|
|
37 |
## Include Directories
|
|
38 |
INCLUDES = -I"I:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\Slave\AVR-Studio\..\..\..\..\include" -I"I:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\Slave\AVR-Studio\..\..\..\..\include\AVR" -I"I:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\Slave\AVR-Studio\."
|
|
39 |
|
|
40 |
## Objects that must be built in order to link
|
|
41 |
OBJECTS = can_AVR.o dcf.o timer.o emcy.o lifegrd.o lss.o nmtMaster.o nmtSlave.o objacces.o pdo.o sdo.o states.o sync.o timer_AVR.o ObjDict.o main.o ds401.o
|
|
42 |
|
|
43 |
## Objects explicitly added by the user
|
|
44 |
LINKONLYOBJECTS =
|
|
45 |
|
|
46 |
## Build
|
|
47 |
all: $(TARGET) SlaveAVR.hex SlaveAVR.eep SlaveAVR.lss size
|
|
48 |
|
|
49 |
## Compile
|
|
50 |
can_AVR.o: ../../../../../drivers/AVR/can_AVR.c
|
|
51 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
52 |
|
|
53 |
dcf.o: ../../../../../src/dcf.c
|
|
54 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
55 |
|
|
56 |
timer.o: ../../../../../src/timer.c
|
|
57 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
58 |
|
|
59 |
emcy.o: ../../../../../src/emcy.c
|
|
60 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
61 |
|
|
62 |
lifegrd.o: ../../../../../src/lifegrd.c
|
|
63 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
64 |
|
|
65 |
lss.o: ../../../../../src/lss.c
|
|
66 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
67 |
|
|
68 |
nmtMaster.o: ../../../../../src/nmtMaster.c
|
|
69 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
70 |
|
|
71 |
nmtSlave.o: ../../../../../src/nmtSlave.c
|
|
72 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
73 |
|
|
74 |
objacces.o: ../../../../../src/objacces.c
|
|
75 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
76 |
|
|
77 |
pdo.o: ../../../../../src/pdo.c
|
|
78 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
79 |
|
|
80 |
sdo.o: ../../../../../src/sdo.c
|
|
81 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
82 |
|
|
83 |
states.o: ../../../../../src/states.c
|
|
84 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
85 |
|
|
86 |
sync.o: ../../../../../src/sync.c
|
|
87 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
88 |
|
|
89 |
timer_AVR.o: ../../../../../drivers/AVR/timer_AVR.c
|
|
90 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
91 |
|
|
92 |
ObjDict.o: ../../ObjDict.c
|
|
93 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
94 |
|
|
95 |
main.o: ../../main.c
|
|
96 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
97 |
|
|
98 |
ds401.o: ../../ds401.c
|
|
99 |
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
|
100 |
|
|
101 |
##Link
|
|
102 |
$(TARGET): $(OBJECTS)
|
|
103 |
$(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)
|
|
104 |
|
|
105 |
%.hex: $(TARGET)
|
|
106 |
avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@
|
|
107 |
|
|
108 |
%.eep: $(TARGET)
|
|
109 |
-avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0
|
|
110 |
|
|
111 |
%.lss: $(TARGET)
|
|
112 |
avr-objdump -h -S $< > $@
|
|
113 |
|
|
114 |
size: ${TARGET}
|
|
115 |
@echo
|
|
116 |
@avr-size -C --mcu=${MCU} ${TARGET}
|
|
117 |
|
|
118 |
## Clean target
|
|
119 |
.PHONY: clean
|
|
120 |
clean:
|
|
121 |
-rm -rf $(OBJECTS) SlaveAVR.elf dep/* SlaveAVR.hex SlaveAVR.eep SlaveAVR.lss SlaveAVR.map
|
|
122 |
|
|
123 |
|
|
124 |
## Other dependencies
|
|
125 |
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
|
|
126 |
|