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