AT91R40008/Ethernut 3 configuration
[openocd.git] / src / flash / ocl / at91sam7x / makefile
blobc3eaf126be6c72b9b3f322c21c14e5041011b6ba
1 ##############################################################################################
2 # Start of default section
5 TRGT = arm-elf-
6 CC = $(TRGT)gcc
7 CP = $(TRGT)objcopy
8 AS = $(TRGT)gcc -x assembler-with-cpp
9 HEX = $(CP) -O ihex
10 BIN = $(CP) -O binary
11 OBJDUMP = $(TRGT)objdump
13 MCU = arm7tdmi
15 # List all default C defines here, like -D_DEBUG=1
16 DDEFS =
18 # List all default ASM defines here, like -D_DEBUG=1
19 DADEFS =
21 # List all default directories to look for include files here
22 DINCDIR =
24 # List the default directory to look for the libraries here
25 DLIBDIR =
27 # List all default libraries here
28 DLIBS =
31 # End of default section
32 ##############################################################################################
34 ##############################################################################################
35 # Start of user section
38 # Define project name here
39 PROJECT = at91sam7x_ocl
41 # Define linker script file here
42 LDSCRIPT= at91sam7x_ram.ld
44 # List all user C define here, like -D_DEBUG=1
45 UDEFS =
47 # Define ASM defines here
48 UADEFS =
50 # List C source files here
51 SRC = main.c dcc.c samflash.c
53 # List ASM source files here
54 ASRC = crt.s
56 # List all user directories here
57 UINCDIR =
59 # List the user directory to look for the libraries here
60 ULIBDIR =
62 # List all user libraries here
63 ULIBS =
65 # Define optimisation level here
66 OPT = -O2
69 # End of user defines
70 ##############################################################################################
73 INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
74 LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
75 DEFS = $(DDEFS) $(UDEFS)
76 ADEFS = $(DADEFS) $(UADEFS)
77 OBJS = $(ASRC:.s=.o) $(SRC:.c=.o)
78 LIBS = $(DLIBS) $(ULIBS)
79 MCFLAGS = -mcpu=$(MCU)
81 ASFLAGS = $(MCFLAGS) -g -gdwarf-2 -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
82 CPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
83 LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
85 # Generate dependency information
86 #CPFLAGS += -MD -MP -MF .dep/$(@F).d
89 # makefile rules
92 all: $(OBJS) $(PROJECT).elf $(PROJECT).hex $(PROJECT).bin $(PROJECT).lst
94 %o : %c
95 $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
97 %o : %s
98 $(AS) -c $(ASFLAGS) $< -o $@
100 %elf: $(OBJS)
101 $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
103 %hex: %elf
104 $(HEX) $< $@
106 %bin: %elf
107 $(BIN) $< $@
109 %.lst: %.elf
110 $(OBJDUMP) -h -S $< > $@
112 clean:
113 -rm -f $(OBJS)
114 -rm -f $(PROJECT).elf
115 -rm -f $(PROJECT).map
116 -rm -f $(PROJECT).hex
117 -rm -f $(PROJECT).bin
118 -rm -f $(PROJECT).lst
119 -rm -f $(SRC:.c=.c.bak)
120 -rm -f $(SRC:.c=.lst)
121 -rm -f $(ASRC:.s=.s.bak)
122 -rm -f $(ASRC:.s=.lst)
123 -rm -fR .dep
126 # Include the dependency files, should be the last of the makefile
128 #-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
130 # *** EOF ***