examples/AT91/Master/Makefile
author JaFojtik
Fri, 03 Feb 2012 22:34:44 +0100
changeset 697 24a2aec61731
parent 521 731bbe1b67b4
permissions -rw-r--r--
ID: 3459307 - Async problem in drivers/win32/win32.c
521
peter
parents:
diff changeset
     1
###############################################################################
peter
parents:
diff changeset
     2
# Makefile for the project MasterAT91
peter
parents:
diff changeset
     3
###############################################################################
peter
parents:
diff changeset
     4
peter
parents:
diff changeset
     5
## General Flags
peter
parents:
diff changeset
     6
PROJECT = MasterAT91
peter
parents:
diff changeset
     7
MCU = arm7tdmi
peter
parents:
diff changeset
     8
TARGET = AT91
peter
parents:
diff changeset
     9
CC = arm-gcc.exe
peter
parents:
diff changeset
    10
SRC = ../../../src
peter
parents:
diff changeset
    11
DRV = ../../../drivers/AT91
peter
parents:
diff changeset
    12
INC = ../../../include
peter
parents:
diff changeset
    13
peter
parents:
diff changeset
    14
## Options common to compile, link and assembly rules
peter
parents:
diff changeset
    15
COMMON = -mmcu=$(MCU)
peter
parents:
diff changeset
    16
peter
parents:
diff changeset
    17
## Compile options common for all C compilation units.
peter
parents:
diff changeset
    18
CFLAGS = $(COMMON)
peter
parents:
diff changeset
    19
CFLAGS += -Wall -gdwarf-2 -Os -fsigned-char -fpack-struct
peter
parents:
diff changeset
    20
#CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d 
peter
parents:
diff changeset
    21
peter
parents:
diff changeset
    22
## Assembly specific flags
peter
parents:
diff changeset
    23
ASMFLAGS = $(COMMON)
peter
parents:
diff changeset
    24
ASMFLAGS += $(CFLAGS)
peter
parents:
diff changeset
    25
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2
peter
parents:
diff changeset
    26
peter
parents:
diff changeset
    27
## Linker flags
peter
parents:
diff changeset
    28
LDFLAGS = $(COMMON)
peter
parents:
diff changeset
    29
LDFLAGS +=  -Wl,-Map=$(PROJECT).map
peter
parents:
diff changeset
    30
peter
parents:
diff changeset
    31
## Intel Hex file production flags
peter
parents:
diff changeset
    32
HEX_FLASH_FLAGS = -R .eeprom
peter
parents:
diff changeset
    33
peter
parents:
diff changeset
    34
HEX_EEPROM_FLAGS = -j .eeprom
peter
parents:
diff changeset
    35
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
peter
parents:
diff changeset
    36
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings
peter
parents:
diff changeset
    37
peter
parents:
diff changeset
    38
## Include Directories
peter
parents:
diff changeset
    39
INCLUDES = -I$(INC) -I$(INC)/AT91
peter
parents:
diff changeset
    40
peter
parents:
diff changeset
    41
## Objects that must be built in order to link
peter
parents:
diff changeset
    42
OBJECTS = 	$(DRV)/can_AT91.o\
peter
parents:
diff changeset
    43
		$(DRV)/timer_AT91.o\
peter
parents:
diff changeset
    44
		$(SRC)/dcf.o\
peter
parents:
diff changeset
    45
		$(SRC)/timer.o\
peter
parents:
diff changeset
    46
		$(SRC)/emcy.o\
peter
parents:
diff changeset
    47
		$(SRC)/lifegrd.o\
peter
parents:
diff changeset
    48
		$(SRC)/lss.o\
peter
parents:
diff changeset
    49
		$(SRC)/nmtMaster.o\
peter
parents:
diff changeset
    50
		$(SRC)/nmtSlave.o\
peter
parents:
diff changeset
    51
		$(SRC)/objacces.o\
peter
parents:
diff changeset
    52
		$(SRC)/pdo.o\
peter
parents:
diff changeset
    53
		$(SRC)/sdo.o\
peter
parents:
diff changeset
    54
		$(SRC)/states.o\
peter
parents:
diff changeset
    55
		$(SRC)/sync.o\
peter
parents:
diff changeset
    56
		ObjDict.o\
peter
parents:
diff changeset
    57
		interrupt_timer.o\
peter
parents:
diff changeset
    58
		main.o
peter
parents:
diff changeset
    59
peter
parents:
diff changeset
    60
## Build
peter
parents:
diff changeset
    61
all: $(PROJECT).elf $(PROJECT).hex $(PROJECT).eep $(PROJECT).lss size
peter
parents:
diff changeset
    62
peter
parents:
diff changeset
    63
## Compile
peter
parents:
diff changeset
    64
%.o: %.c
peter
parents:
diff changeset
    65
#	@echo " "
peter
parents:
diff changeset
    66
	@echo "---------------------------------------------------------------------------"
peter
parents:
diff changeset
    67
	@echo "**Compiling $< -> $@"
peter
parents:
diff changeset
    68
#	@echo "*********************************************"
peter
parents:
diff changeset
    69
	$(CC) $(INCLUDES) $(CFLAGS) -c $<
peter
parents:
diff changeset
    70
#	$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $< 
peter
parents:
diff changeset
    71
peter
parents:
diff changeset
    72
peter
parents:
diff changeset
    73
##Link
peter
parents:
diff changeset
    74
$(PROJECT).elf: $(OBJECTS)
peter
parents:
diff changeset
    75
#	@echo " "
peter
parents:
diff changeset
    76
	@echo "---------------------------------------------------------------------------"
peter
parents:
diff changeset
    77
	@echo "**Linking :  $@"
peter
parents:
diff changeset
    78
#	@echo "*********************************************"
peter
parents:
diff changeset
    79
	$(CC) $(LDFLAGS) $(LIBDIRS) $(LIBS) $(^F) -o $@
peter
parents:
diff changeset
    80
peter
parents:
diff changeset
    81
%.hex: $(PROJECT).elf
peter
parents:
diff changeset
    82
	arm-elf-objcopy.exe -O ihex $(HEX_FLASH_FLAGS)  $< $@
peter
parents:
diff changeset
    83
peter
parents:
diff changeset
    84
%.eep: $(PROJECT).elf
peter
parents:
diff changeset
    85
	-arm-elf-objcopy.exe $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0
peter
parents:
diff changeset
    86
peter
parents:
diff changeset
    87
%.lss: $(PROJECT).elf
peter
parents:
diff changeset
    88
	arm-elf-objdump.exe -h -S $< > $@
peter
parents:
diff changeset
    89
peter
parents:
diff changeset
    90
size: $(PROJECT).elf
peter
parents:
diff changeset
    91
	@echo
peter
parents:
diff changeset
    92
	@arm-elf-size -C --mcu=${MCU} $(PROJECT).elf
peter
parents:
diff changeset
    93
peter
parents:
diff changeset
    94
## Clean target
peter
parents:
diff changeset
    95
.PHONY: clean
peter
parents:
diff changeset
    96
clean:
peter
parents:
diff changeset
    97
	-rm -rf *.o $(PROJECT).elf dep/* $(PROJECT).hex $(PROJECT).eep $(PROJECT).lss $(PROJECT).map
peter
parents:
diff changeset
    98
peter
parents:
diff changeset
    99
peter
parents:
diff changeset
   100
## Other dependencies
peter
parents:
diff changeset
   101
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
peter
parents:
diff changeset
   102