1 ##############################################################################################
2 # Start of default section
8 AS = $(TRGT)gcc -x assembler-with-cpp
11 OBJDUMP = $(TRGT)objdump
15 # List all default C defines here, like -D_DEBUG=1
18 # List all default ASM defines here, like -D_DEBUG=1
21 # List all default directories to look for include files here
24 # List the default directory to look for the libraries here
27 # List all default libraries here
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
47 # Define ASM defines here
50 # List C source files here
51 SRC = main.c dcc.c samflash.c
53 # List ASM source files here
56 # List all user directories here
59 # List the user directory to look for the libraries here
62 # List all user libraries here
65 # Define optimisation level here
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
92 all: $(OBJS) $(PROJECT).elf $(PROJECT).hex $(PROJECT).bin $(PROJECT).lst
95 $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
98 $(AS) -c $(ASFLAGS) $< -o $@
101 $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
110 $(OBJDUMP) -h -S $< > $@
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)
126 # Include the dependency files, should be the last of the makefile
128 #-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)