1
|
# Hey Emacs, this is a -*- makefile -*-
|
2
|
#
|
3
|
# WinARM makefile for the FreeRTOS-demo on LPC2138
|
4
|
# based in information from the FreeRTOS LPC2106 example
|
5
|
#
|
6
|
# by Martin Thomas, Kaiserslautern, Germany
|
7
|
# <eversmith@heizung-thomas.de>
|
8
|
#
|
9
|
# based on the WinAVR makefile written by Eric B. Weddington, J?rg Wunsch, et al.
|
10
|
# Released to the Public Domain
|
11
|
# Please read the make user manual!
|
12
|
#
|
13
|
#
|
14
|
# On command line:
|
15
|
#
|
16
|
# make all = Make software.
|
17
|
#
|
18
|
# make clean = Clean out built project files.
|
19
|
#
|
20
|
# make program = Download the hex file to the device
|
21
|
#
|
22
|
# (TODO: make filename.s = Just compile filename.c into the assembler code only)
|
23
|
#
|
24
|
# To rebuild project do "make clean" then "make all".
|
25
|
#
|
26
|
# Changelog:
|
27
|
# - 17. Feb. 2005 - added thumb-interwork support (mth)
|
28
|
# - 28. Apr. 2005 - added C++ support (mth)
|
29
|
# - 29. Arp. 2005 - changed handling for lst-Filename (mth)
|
30
|
# - 1. Nov. 2005 - exception-vector placement options (mth)
|
31
|
# - 15. Nov. 2005 - added library-search-path (EXTRA_LIB...) (mth)
|
32
|
# - 2. Dec. 2005 - fixed ihex and binary file extensions (mth)
|
33
|
# - 22. Feb. 2006 - added AT91LIBNOWARN setting (mth)
|
34
|
# - 19. Apr. 2006 - option FLASH_TOOL (default lpc21isp); variable IMGEXT (mth)
|
35
|
# - 19. Mai. 2006 - USE_THUMB_MODE switch, ROM_RUN->RUN_FROM_ROM RAM_RUN->RUN_FROM_RAM
|
36
|
|
37
|
|
38
|
FLASH_TOOL = AT91FLASH
|
39
|
#FLASH_TOOL = UVISION
|
40
|
#FLASH_TOOL = OPENOCD
|
41
|
|
42
|
# MCU name and submodel
|
43
|
MCU = arm7tdmi
|
44
|
SUBMDL = AT91SAM7S64
|
45
|
#SUBMDL = AT91SAM7S256
|
46
|
|
47
|
USE_THUMB_MODE = NO
|
48
|
#USE_THUMB_MODE = YES
|
49
|
|
50
|
## Create ROM-Image (final)
|
51
|
RUN_MODE=RUN_FROM_ROM
|
52
|
## Create RAM-Image (debugging) - not used in this example
|
53
|
#RUN_MODE=RUN_FROM_RAM
|
54
|
|
55
|
## We want to produce a full-flash image, but including DFU
|
56
|
IMGTYPE=-sam7dfu-dfu
|
57
|
|
58
|
# with / at end
|
59
|
PATH_TO_LINKSCRIPTS=link/
|
60
|
|
61
|
#### not used in this example:
|
62
|
## Exception-Vector placement only supported for "ROM_RUN"
|
63
|
## (placement settings ignored when using "RAM_RUN")
|
64
|
## - Exception vectors in ROM:
|
65
|
#VECTOR_LOCATION=VECTORS_IN_ROM
|
66
|
## - Exception vectors in RAM:
|
67
|
#VECTOR_LOCATION=VECTORS_IN_RAM
|
68
|
|
69
|
# Target file name (without extension).
|
70
|
TARGET:=dfu
|
71
|
|
72
|
USBSTRINGS=src/picc/usb_strings_dfu.h src/pcd/usb_strings_dfu.h src/simtrace/usb_strings_dfu.h
|
73
|
|
74
|
# List C source files here. (C dependencies are automatically generated.)
|
75
|
# use file-extension c for "c-only"-files
|
76
|
SRC =
|
77
|
|
78
|
# List C source files here which must be compiled in ARM-Mode.
|
79
|
# use file-extension c for "c-only"-files
|
80
|
|
81
|
SRCARM = src/start/Cstartup_SAM7.c lib/lib_AT91SAM7.c \
|
82
|
src/dfu/dfu.c src/dfu/dbgu.c src/os/flash.c
|
83
|
|
84
|
# List C++ source files here.
|
85
|
# use file-extension cpp for C++-files (use extension .cpp)
|
86
|
CPPSRC =
|
87
|
|
88
|
# List C++ source files here which must be compiled in ARM-Mode.
|
89
|
# use file-extension cpp for C++-files (use extension .cpp)
|
90
|
#CPPSRCARM = $(TARGET).cpp
|
91
|
CPPSRCARM =
|
92
|
|
93
|
# List Assembler source files here.
|
94
|
# Make them always end in a capital .S. Files ending in a lowercase .s
|
95
|
# will not be considered source files but generated files (assembler
|
96
|
# output from the compiler), and will be deleted upon "make clean"!
|
97
|
# Even though the DOS/Win* filesystem matches both .s and .S the same,
|
98
|
# it will preserve the spelling of the filenames, and gcc itself does
|
99
|
# care about how the name is spelled on its command-line.
|
100
|
ASRC =
|
101
|
|
102
|
# List Assembler source files here which must be assembled in ARM-Mode..
|
103
|
ASRCARM = src/start/Cstartup.S
|
104
|
|
105
|
ifeq ($(DEBUG),1)
|
106
|
SRCARM += lib/vsprintf.c lib/ctype.c lib/string.c
|
107
|
ASRCARM += lib/div64.S
|
108
|
endif
|
109
|
|
110
|
## Output format. (can be ihex or binary)
|
111
|
## (binary i.e. for openocd and SAM-BA, hex i.e. for lpc21isp and uVision)
|
112
|
#FORMAT = ihex
|
113
|
FORMAT = binary
|
114
|
|
115
|
# Optimization level, can be [0, 1, 2, 3, s].
|
116
|
# 0 = turn off optimization. s = optimize for size.
|
117
|
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
118
|
OPT = s
|
119
|
#OPT = 0
|
120
|
|
121
|
# Debugging format.
|
122
|
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
|
123
|
# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
|
124
|
#DEBUGF = stabs
|
125
|
DEBUGF = dwarf-2
|
126
|
|
127
|
# List any extra directories to look for include files here.
|
128
|
# Each directory must be seperated by a space.
|
129
|
#### FreeRTOS
|
130
|
EXTRAINCDIRS =
|
131
|
|
132
|
# List any extra directories to look for library files here.
|
133
|
# Each directory must be seperated by a space.
|
134
|
#EXTRA_LIBDIRS = ../arm7_efsl_0_2_4
|
135
|
EXTRA_LIBDIRS =
|
136
|
|
137
|
## Using the Atmel AT91_lib produces warning with
|
138
|
## the default warning-levels.
|
139
|
## yes - disable these warnings; no - keep default settings
|
140
|
AT91LIBNOWARN = yes
|
141
|
#AT91LIBNOWARN = no
|
142
|
|
143
|
# Compiler flag to set the C Standard level.
|
144
|
# c89 - "ANSI" C
|
145
|
# gnu89 - c89 plus GCC extensions
|
146
|
# c99 - ISO C99 standard (not yet fully implemented)
|
147
|
# gnu99 - c99 plus GCC extensions
|
148
|
CSTANDARD = -std=gnu99
|
149
|
|
150
|
# Place -D or -U options for C here
|
151
|
CDEFS = -D$(RUN_MODE) -D__MS_types__ -D__LIBRFID__
|
152
|
|
153
|
ifdef DEBUG
|
154
|
CDEFS += -DDEBUG
|
155
|
ADEFS += -DDEBUG
|
156
|
endif
|
157
|
|
158
|
ifeq ($(BOARD),OLIMEX)
|
159
|
CDEFS += -DOLIMEX
|
160
|
ADEFS += -DOLIMEX
|
161
|
CINCS = -Isrc/simtrace
|
162
|
endif
|
163
|
|
164
|
ifeq ($(BOARD),PICC)
|
165
|
CDEFS += -DPICC
|
166
|
ADEFS += -DPICC
|
167
|
CINCS = -Isrc/picc
|
168
|
endif
|
169
|
|
170
|
ifeq ($(BOARD),PCD)
|
171
|
SUBMDL = AT91SAM7S128
|
172
|
CDEFS += -DPCD
|
173
|
ADEFS += -DPCD
|
174
|
CINCS = -Isrc/pcd
|
175
|
endif
|
176
|
|
177
|
ifeq ($(BOARD),SIMTRACE)
|
178
|
SUBMDL = AT91SAM7S128
|
179
|
CDEFS += -DSIMTRACE
|
180
|
ADEFS += -DSIMTRACE
|
181
|
CINCS = -Isrc/simtrace
|
182
|
endif
|
183
|
|
184
|
|
185
|
# Place -I options here
|
186
|
CINCS += -Iinclude -Isrc
|
187
|
|
188
|
# Place -D or -U options for ASM here
|
189
|
ADEFS += -D$(RUN_MODE)
|
190
|
|
191
|
ifdef VECTOR_LOCATION
|
192
|
CDEFS += -D$(VECTOR_LOCATION)
|
193
|
ADEFS += -D$(VECTOR_LOCATION)
|
194
|
endif
|
195
|
|
196
|
CDEFS += -D__$(SUBMDL)__
|
197
|
ADEFS += -D__$(SUBMDL)__
|
198
|
|
199
|
|
200
|
# Compiler flags.
|
201
|
# -g*: generate debugging information
|
202
|
# -O*: optimization level
|
203
|
# -f...: tuning, see GCC manual and avr-libc documentation
|
204
|
# -Wall...: warning level
|
205
|
# -Wa,...: tell GCC to pass this to the assembler.
|
206
|
# -adhlns...: create assembler listing
|
207
|
#
|
208
|
# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
|
209
|
CFLAGS += -g$(DEBUGF) -DBOARD=$(BOARD)
|
210
|
CFLAGS += $(CDEFS) $(CINCS)
|
211
|
CFLAGS += -O$(OPT)
|
212
|
CFLAGS += -Wall -Wextra -Wcast-align -Wimplicit -Wunused
|
213
|
CFLAGS += -Wpointer-arith -Wswitch
|
214
|
CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow
|
215
|
CFLAGS += -Wbad-function-cast -Wsign-compare -Waggregate-return
|
216
|
CFLAGS += -Wa,-adhlns=$(subst $(suffix $<),.lst,$<)
|
217
|
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
218
|
#CFLAGS += -ffunction-sections -fdata-sections
|
219
|
|
220
|
# flags only for C
|
221
|
CONLYFLAGS += -Wnested-externs
|
222
|
CONLYFLAGS += $(CSTANDARD)
|
223
|
|
224
|
ifneq ($(AT91LIBNOWARN),yes)
|
225
|
#AT91-lib warnings with:
|
226
|
CFLAGS += -Wcast-qual
|
227
|
CONLYFLAGS += -Wmissing-prototypes
|
228
|
CONLYFLAGS += -Wstrict-prototypes
|
229
|
CONLYFLAGS += -Wmissing-declarations
|
230
|
endif
|
231
|
|
232
|
# flags only for C++ (arm-elf-g++)
|
233
|
# CPPFLAGS = -fno-rtti -fno-exceptions
|
234
|
CPPFLAGS =
|
235
|
|
236
|
# Assembler flags.
|
237
|
# -Wa,...: tell GCC to pass this to the assembler.
|
238
|
# -ahlns: create listing
|
239
|
# -g$(DEBUGF): have the assembler create line number information
|
240
|
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:.S=.lst),--g$(DEBUGF) -Iinclude/ -D__ASSEMBLY__
|
241
|
|
242
|
|
243
|
#Additional libraries.
|
244
|
|
245
|
# Extra libraries
|
246
|
# Each library-name must be seperated by a space.
|
247
|
# To add libxyz.a, libabc.a and libefsl.a:
|
248
|
# EXTRA_LIBS = xyz abc efsl
|
249
|
#EXTRA_LIBS = efsl
|
250
|
EXTRA_LIBS =
|
251
|
|
252
|
#Support for newlibc-lpc (file: libnewlibc-lpc.a)
|
253
|
#NEWLIBLPC = -lnewlib-lpc
|
254
|
|
255
|
MATH_LIB = #-lm
|
256
|
|
257
|
# CPLUSPLUS_LIB = -lstdc++
|
258
|
|
259
|
|
260
|
# Linker flags.
|
261
|
# -Wl,...: tell GCC to pass this to linker.
|
262
|
# -Map: create map file
|
263
|
# --cref: add cross reference to map file
|
264
|
LDFLAGS = -nostartfiles -Wl,-Map=$(TARGET).map,--cref
|
265
|
LDFLAGS += $(NEWLIBLPC) $(MATH_LIB)
|
266
|
LDFLAGS += -lc -lgcc
|
267
|
LDFLAGS += $(CPLUSPLUS_LIB)
|
268
|
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
|
269
|
LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
|
270
|
#LDFLAGS += --gc-sections
|
271
|
|
272
|
# Set Linker-Script Depending On Selected Memory and Controller
|
273
|
ifeq ($(RUN_MODE),RUN_FROM_RAM)
|
274
|
LDFLAGS +=-T$(PATH_TO_LINKSCRIPTS)$(SUBMDL)-RAM.ld
|
275
|
else
|
276
|
LDFLAGS +=-T$(PATH_TO_LINKSCRIPTS)$(SUBMDL)-ROM$(IMGTYPE).ld
|
277
|
endif
|
278
|
|
279
|
|
280
|
# ---------------------------------------------------------------------------
|
281
|
# Flash-Programming support using lpc21isp by Martin Maurer
|
282
|
# only for Philips LPC and Analog ADuC ARMs
|
283
|
#
|
284
|
# Settings and variables:
|
285
|
#LPC21ISP = lpc21isp
|
286
|
LPC21ISP = lpc21isp
|
287
|
LPC21ISP_PORT = com1
|
288
|
LPC21ISP_BAUD = 38400
|
289
|
LPC21ISP_XTAL = 12000
|
290
|
LPC21ISP_FLASHFILE = $(TARGET).hex
|
291
|
# verbose output:
|
292
|
#LPC21ISP_DEBUG = -debug
|
293
|
# enter bootloader via RS232 DTR/RTS (only if hardware supports this
|
294
|
# feature - see Philips AppNote):
|
295
|
LPC21ISP_CONTROL = -control
|
296
|
# ---------------------------------------------------------------------------
|
297
|
|
298
|
|
299
|
# Define directories, if needed.
|
300
|
## DIRARM = c:/WinARM/
|
301
|
## DIRARMBIN = $(DIRAVR)/bin/
|
302
|
## DIRAVRUTILS = $(DIRAVR)/utils/bin/
|
303
|
|
304
|
# Define programs and commands.
|
305
|
SHELL = sh
|
306
|
CROSS_COMPILE ?= arm-elf-
|
307
|
CC = $(CROSS_COMPILE)gcc
|
308
|
CPP = $(CROSS_COMPILE)g++
|
309
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
310
|
OBJDUMP = $(CROSS_COMPILE)objdump
|
311
|
SIZE = $(CROSS_COMPILE)size
|
312
|
NM = $(CROSS_COMPILE)nm
|
313
|
REMOVE = rm -f
|
314
|
COPY = cp
|
315
|
|
316
|
# Define Messages
|
317
|
# English
|
318
|
MSG_ERRORS_NONE = Errors: none
|
319
|
MSG_BEGIN = "-------- begin (mode: $(RUN_MODE)) --------"
|
320
|
MSG_END = -------- end --------
|
321
|
MSG_SIZE_BEFORE = Size before:
|
322
|
MSG_SIZE_AFTER = Size after:
|
323
|
MSG_FLASH = Creating load file for Flash:
|
324
|
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
325
|
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
326
|
MSG_LINKING = Linking:
|
327
|
MSG_COMPILING = Compiling C:
|
328
|
MSG_COMPILING_ARM = "Compiling C (ARM-only):"
|
329
|
MSG_COMPILINGCPP = Compiling C++:
|
330
|
MSG_COMPILINGCPP_ARM = "Compiling C++ (ARM-only):"
|
331
|
MSG_ASSEMBLING = Assembling:
|
332
|
MSG_ASSEMBLING_ARM = "Assembling (ARM-only):"
|
333
|
MSG_CLEANING = Cleaning project:
|
334
|
MSG_FORMATERROR = Can not handle output-format
|
335
|
MSG_LPC21_RESETREMINDER = You may have to bring the target in bootloader-mode now.
|
336
|
|
337
|
# Define all object files.
|
338
|
COBJ = $(SRC:.c=.o)
|
339
|
AOBJ = $(ASRC:.S=.o)
|
340
|
COBJARM = $(SRCARM:.c=.o)
|
341
|
AOBJARM = $(ASRCARM:.S=.o)
|
342
|
CPPOBJ = $(CPPSRC:.cpp=.o)
|
343
|
CPPOBJARM = $(CPPSRCARM:.cpp=.o)
|
344
|
|
345
|
# Define all listing files.
|
346
|
LST = $(ASRC:.S=.lst) $(ASRCARM:.S=.lst) $(SRC:.c=.lst) $(SRCARM:.c=.lst)
|
347
|
LST += $(CPPSRC:.cpp=.lst) $(CPPSRCARM:.cpp=.lst)
|
348
|
|
349
|
# Compiler flags to generate dependency files.
|
350
|
### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
|
351
|
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
|
352
|
|
353
|
# Combine all necessary flags and optional flags.
|
354
|
# Add target processor to flags.
|
355
|
ALL_CFLAGS = -mcpu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
|
356
|
ALL_ASFLAGS = -mcpu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
|
357
|
|
358
|
|
359
|
# Default target.
|
360
|
all: begin gccversion sizebefore build sizeafter finished end
|
361
|
|
362
|
ifeq ($(FORMAT),ihex)
|
363
|
build: elf hex lss sym
|
364
|
hex: $(TARGET).hex
|
365
|
IMGEXT=hex
|
366
|
else
|
367
|
ifeq ($(FORMAT),binary)
|
368
|
build: elf bin lss sym
|
369
|
bin: $(TARGET).bin
|
370
|
IMGEXT=bin
|
371
|
else
|
372
|
$(error "$(MSG_FORMATERROR) $(FORMAT)")
|
373
|
endif
|
374
|
endif
|
375
|
|
376
|
elf: $(TARGET).elf
|
377
|
lss: $(TARGET).lss
|
378
|
sym: $(TARGET).sym
|
379
|
|
380
|
# Eye candy.
|
381
|
begin:
|
382
|
@echo
|
383
|
@echo $(MSG_BEGIN)
|
384
|
|
385
|
finished:
|
386
|
@echo $(MSG_ERRORS_NONE)
|
387
|
|
388
|
end:
|
389
|
@echo $(MSG_END)
|
390
|
@echo
|
391
|
|
392
|
|
393
|
# Display size of file.
|
394
|
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
395
|
ELFSIZE = $(SIZE) -A $(TARGET).elf
|
396
|
sizebefore:
|
397
|
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
|
398
|
|
399
|
sizeafter:
|
400
|
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
|
401
|
|
402
|
|
403
|
# Display compiler version information.
|
404
|
gccversion :
|
405
|
@$(CC) --version
|
406
|
|
407
|
|
408
|
# Program the device.
|
409
|
# Program the device by using our relais card robot over USB
|
410
|
ifeq ($(FLASH_TOOL),AT91FLASH)
|
411
|
program: $(TARGET).$(IMGEXT)
|
412
|
ls -l $(TARGET).$(IMGEXT)
|
413
|
at91flash $(TARGET).$(IMGEXT)
|
414
|
else
|
415
|
ifeq ($(FLASH_TOOL),UVISION)
|
416
|
# Program the device with Keil's uVision (needs configured uVision-Workspace).
|
417
|
program: $(TARGET).$(IMGEXT)
|
418
|
@echo
|
419
|
@echo "Programming with uVision"
|
420
|
C:\Keil\uv3\Uv3.exe -f uvisionflash.Uv2 -ouvisionflash.txt
|
421
|
else
|
422
|
ifeq ($(FLASH_TOOL),OPENOCD)
|
423
|
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
|
424
|
program: $(TARGET).$(IMGEXT)
|
425
|
@echo
|
426
|
@echo "Programming with OPENOCD"
|
427
|
C:\WinARM\utils\openocd\openocd_svn59\openocd.exe -f oocd_sam7_flash.cfg
|
428
|
else
|
429
|
# Program the device. - lpc21isp will not work for SAM7
|
430
|
program: $(TARGET).$(IMGEXT)
|
431
|
@echo
|
432
|
@echo $(MSG_LPC21_RESETREMINDER)
|
433
|
$(LPC21ISP) $(LPC21ISP_OPTIONS) $(LPC21ISP_DEBUG) $(LPC21ISP_FLASHFILE) $(LPC21ISP_PORT) $(LPC21ISP_BAUD) $(LPC21ISP_XTAL)
|
434
|
endif
|
435
|
endif
|
436
|
endif
|
437
|
|
438
|
|
439
|
# Create final output file (.hex) from ELF output file.
|
440
|
%.hex: %.elf
|
441
|
@echo
|
442
|
@echo $(MSG_FLASH) $@
|
443
|
$(OBJCOPY) -O $(FORMAT) $< $@
|
444
|
|
445
|
# Create final output file (.bin) from ELF output file.
|
446
|
%.bin: %.elf
|
447
|
@echo
|
448
|
@echo $(MSG_FLASH) $@
|
449
|
$(OBJCOPY) -O $(FORMAT) $< $@
|
450
|
|
451
|
|
452
|
# Create extended listing file from ELF output file.
|
453
|
# testing: option -C
|
454
|
%.lss: %.elf
|
455
|
@echo
|
456
|
@echo $(MSG_EXTENDED_LISTING) $@
|
457
|
$(OBJDUMP) -h -S -C $< > $@
|
458
|
|
459
|
|
460
|
# Create a symbol table from ELF output file.
|
461
|
%.sym: %.elf
|
462
|
@echo
|
463
|
@echo $(MSG_SYMBOL_TABLE) $@
|
464
|
$(NM) -n $< > $@
|
465
|
|
466
|
|
467
|
# Link: create ELF output file from object files.
|
468
|
.SECONDARY : $(TARGET).elf
|
469
|
.PRECIOUS : $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
|
470
|
%.elf: $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
|
471
|
@echo
|
472
|
@echo $(MSG_LINKING) $@
|
473
|
$(CC) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
|
474
|
|
475
|
# Compile: create object files from C source files. ARM/Thumb
|
476
|
$(COBJ) : %.o : %.c
|
477
|
@echo
|
478
|
@echo $(MSG_COMPILING) $<
|
479
|
$(CC) -c $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
|
480
|
|
481
|
# Compile: create object files from C source files. ARM-only
|
482
|
$(COBJARM) : %.o : %.c include/compile.h $(USBSTRINGS)
|
483
|
@echo
|
484
|
@echo $(MSG_COMPILING_ARM) $<
|
485
|
$(CC) -c $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
|
486
|
|
487
|
# Compile: create object files from C++ source files. ARM/Thumb
|
488
|
$(CPPOBJ) : %.o : %.cpp
|
489
|
@echo
|
490
|
@echo $(MSG_COMPILINGCPP) $<
|
491
|
$(CPP) -c $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
|
492
|
|
493
|
# Compile: create object files from C++ source files. ARM-only
|
494
|
$(CPPOBJARM) : %.o : %.cpp
|
495
|
@echo
|
496
|
@echo $(MSG_COMPILINGCPP_ARM) $<
|
497
|
$(CPP) -c $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
|
498
|
|
499
|
|
500
|
# Compile: create assembler files from C source files. ARM/Thumb
|
501
|
## does not work - TODO - hints welcome
|
502
|
##$(COBJ) : %.s : %.c
|
503
|
## $(CC) $(THUMB) -S $(ALL_CFLAGS) $< -o $@
|
504
|
|
505
|
|
506
|
# Assemble: create object files from assembler source files. ARM/Thumb
|
507
|
$(AOBJ) : %.o : %.S
|
508
|
@echo
|
509
|
@echo $(MSG_ASSEMBLING) $<
|
510
|
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
511
|
|
512
|
|
513
|
# Assemble: create object files from assembler source files. ARM-only
|
514
|
$(AOBJARM) : %.o : %.S
|
515
|
@echo
|
516
|
@echo $(MSG_ASSEMBLING_ARM) $<
|
517
|
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
518
|
|
519
|
|
520
|
# Target: clean project.
|
521
|
clean: begin clean_list finished end
|
522
|
|
523
|
|
524
|
clean_list :
|
525
|
@echo
|
526
|
@echo $(MSG_CLEANING)
|
527
|
$(REMOVE) $(TARGET).hex
|
528
|
$(REMOVE) $(TARGET).bin
|
529
|
$(REMOVE) $(TARGET).obj
|
530
|
$(REMOVE) $(TARGET).elf
|
531
|
$(REMOVE) $(TARGET).map
|
532
|
$(REMOVE) $(TARGET).obj
|
533
|
$(REMOVE) $(TARGET).a90
|
534
|
$(REMOVE) $(TARGET).sym
|
535
|
$(REMOVE) $(TARGET).lnk
|
536
|
$(REMOVE) $(TARGET).lss
|
537
|
$(REMOVE) $(COBJ)
|
538
|
$(REMOVE) $(CPPOBJ)
|
539
|
$(REMOVE) $(AOBJ)
|
540
|
$(REMOVE) $(COBJARM)
|
541
|
$(REMOVE) $(CPPOBJARM)
|
542
|
$(REMOVE) $(AOBJARM)
|
543
|
$(REMOVE) $(LST)
|
544
|
$(REMOVE) $(SRC:.c=.s)
|
545
|
$(REMOVE) $(SRC:.c=.d)
|
546
|
$(REMOVE) $(SRCARM:.c=.s)
|
547
|
$(REMOVE) $(SRCARM:.c=.d)
|
548
|
$(REMOVE) $(CPPSRC:.cpp=.s)
|
549
|
$(REMOVE) $(CPPSRC:.cpp=.d)
|
550
|
$(REMOVE) $(CPPSRCARM:.cpp=.s)
|
551
|
$(REMOVE) $(CPPSRCARM:.cpp=.d)
|
552
|
$(REMOVE) .dep/*
|
553
|
$(REMOVE) src/picc/usb_strings_dfu.h
|
554
|
$(REMOVE) src/dfu/usb_strings_dfu.h
|
555
|
$(REMOVE) scripts/usbstring
|
556
|
|
557
|
.PHONY: include/compile.h
|
558
|
include/compile.h:
|
559
|
scripts/mkcompile_h > $@
|
560
|
|
561
|
.PHONY:
|
562
|
$(USBSTRINGS): %.h : %.txt ./scripts/usbstring
|
563
|
cat $< | ./scripts/usbstring > $@
|
564
|
|
565
|
scripts/usbstring: scripts/usbstring.c
|
566
|
gcc $^ -o $@
|
567
|
|
568
|
|
569
|
# Include the dependency files.
|
570
|
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
571
|
|
572
|
|
573
|
# Listing of phony targets.
|
574
|
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
575
|
build elf hex bin lss sym clean clean_list program
|
576
|
|