2
# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!
4
##############################################################################################
8
# make all = Create project
10
# make clean = Clean project files.
12
# To rebuild project do "make clean" and "make all".
15
##############################################################################################
16
# Start of default section
22
AS = $(TRGT)gcc -x assembler-with-cpp
27
# List all default C defines here, like -D_DEBUG=1
30
# List all default ASM defines here, like -D_DEBUG=1
33
# List all default directories to look for include files here
36
# List the default directory to look for the libraries here
39
# List all default libraries here
43
# End of default section
44
##############################################################################################
46
##############################################################################################
47
# Start of user section
50
# Define project name here
53
# Define linker script file here
54
LDSCRIPT_RAM = ./prj/str912_ram.ld
55
LDSCRIPT_ROM = ./prj/str912_rom.ld
57
# List all user C define here, like -D_DEBUG=1
60
# Define ASM defines here
63
# List C source files here
66
# List ASM source files here
67
ASRC = ./src/startup.s
69
# List all user directories here
72
# List the user directory to look for the libraries here
75
# List all user libraries here
78
# Define optimisation level here
83
##############################################################################################
86
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
87
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
88
DEFS = $(DDEFS) $(UDEFS)
89
ADEFS = $(DADEFS) $(UADEFS)
90
OBJS = $(ASRC:.s=.o) $(SRC:.c=.o)
91
LIBS = $(DLIBS) $(ULIBS)
92
MCFLAGS = -mcpu=$(MCU)
94
ASFLAGS = $(MCFLAGS) -g -gdwarf-2 -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
95
CPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
96
LDFLAGS_RAM = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT_RAM) -Wl,-Map=$(PROJECT)_ram.map,--cref,--no-warn-mismatch $(LIBDIR)
97
LDFLAGS_ROM = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT_ROM) -Wl,-Map=$(PROJECT)_rom.map,--cref,--no-warn-mismatch $(LIBDIR)
99
# Generate dependency information
100
CPFLAGS += -MD -MP -MF .dep/$(@F).d
108
RAM: $(OBJS) $(PROJECT)_ram.elf $(PROJECT)_ram.hex
110
ROM: $(OBJS) $(PROJECT)_rom.elf $(PROJECT)_rom.hex
113
$(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
116
$(AS) -c $(ASFLAGS) $< -o $@
119
$(CC) $(OBJS) $(LDFLAGS_RAM) $(LIBS) -o $@
122
$(CC) $(OBJS) $(LDFLAGS_ROM) $(LIBS) -o $@
129
-rm -f $(PROJECT)_ram.elf
130
-rm -f $(PROJECT)_ram.map
131
-rm -f $(PROJECT)_ram.hex
132
-rm -f $(PROJECT)_rom.elf
133
-rm -f $(PROJECT)_rom.map
134
-rm -f $(PROJECT)_rom.hex
135
-rm -f $(SRC:.c=.c.bak)
136
-rm -f $(SRC:.c=.lst)
137
-rm -f $(ASRC:.s=.s.bak)
138
-rm -f $(ASRC:.s=.lst)
142
# Include the dependency files, should be the last of the makefile
144
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
b'\\ No newline at end of file'