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