2 # WinARM template makefile
\r
7 # make all = Make software.
\r
9 # make clean = Clean out built project files.
\r
11 # make program = Upload load-image to the device
\r
13 # make filename.s = Just compile filename.c into the assembler code only
\r
15 # make filename.o = Create object filename.o from filename.c (using CFLAGS)
\r
17 # To rebuild project do "make clean" then "make all".
\r
20 # This should work with just CS G++ lite installed (Win32 cmd as shell, cs-make, cs-rm)
\r
22 # - CS G++ 2009-Q1 (cs-make 3.81, cs-rm, cmd.exe), no MinGW or Cygwin tools in the $PATH
\r
23 # - Cygwin (make 3.81, rm, bash 3.2.39)
\r
24 # - MSYS/MinGW tools in $(PATH) (WinAVR\utils\bin)
\r
27 # Toolchain prefix (i.e arm-elf- -> arm-elf-gcc.exe)
\r
28 #TCHAIN_PREFIX = arm-eabi-
\r
29 #TCHAIN_PREFIX = arm-elf-
\r
30 TCHAIN_PREFIX = arm-none-eabi-
\r
34 #FLASH_TOOL = OPENOCD
\r
35 #FLASH_TOOL = LPC21ISP
\r
36 #FLASH_TOOL = UVISION
\r
38 # YES enables -mthumb option to flags for source-files listed
\r
39 # in SRC and CPPSRC and -mthumb-interwork option for all source
\r
40 USE_THUMB_MODE = YES
\r
41 #USE_THUMB_MODE = NO
\r
43 # MCU name, submodel and board
\r
44 # - MCU used for compiler-option (-mcpu)
\r
45 # - SUBMDL used for linker-script name (-T) and passed as define
\r
46 # - BOARD just passed as define (optional)
\r
48 CHIP = STM32F10x_64k_20k
\r
49 BOARD = JYE109-13800-00A
\r
51 SYSCLOCK_CL = SYSCLK_FREQ_72MHz=72000000
\r
53 # *** This example only supports "FLASH_RUN" ***
\r
54 # RUN_MODE is passed as define and used for the linker-script filename,
\r
55 # the user has to implement the necessary operations for
\r
56 # the used mode(s) (i.e. no copy of .data, remapping)
\r
57 # Create FLASH-Image
\r
62 # Exception-vectors placement option is just passed as define,
\r
63 # the user has to implement the necessary operations (i.e. remapping)
\r
64 # Exception vectors in FLASH:
\r
65 ifeq ($(RUN_MODE),RAM_RUN)
\r
66 VECTOR_TABLE_LOCATION=VECT_TAB_RAM
\r
68 VECTOR_TABLE_LOCATION=VECT_TAB_FLASH
\r
71 #VECTOR_TABLE_LOCATION=VECT_TAB_FLASH
\r
72 # Exception vectors in RAM:
\r
73 #VECTOR_TABLE_LOCATION=VECT_TAB_RAM
\r
75 # Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
\r
76 OUTDIR = $(RUN_MODE)
\r
78 # Target file name (without extension).
\r
79 TARGET = 113-13801-037
\r
81 # Pathes to libraries
\r
82 APPLIBDIR = ./Libraries
\r
83 STMLIBDIR = $(APPLIBDIR)
\r
84 STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver
\r
85 STMSPDSRCDIR = $(STMSPDDIR)/src
\r
86 STMSPDINCDIR = $(STMSPDDIR)/inc
\r
87 CMSISDIR = $(STMLIBDIR)/CMSIS/CM3/CoreSupport
\r
89 # List C source files here. (C dependencies are automatically generated.)
\r
90 # use file-extension c for "c-only"-files
\r
91 ## Demo-Application:
\r
92 SRC = 113-13801.c Board.c Common.c Screen.c Command.c stm32f10x_it.c Eeprom.c
\r
94 ## compiler-specific sources
\r
95 #SRC += startup_stm32f10x_md_mthomas.c
\r
97 SRC += $(CMSISDIR)/core_cm3.c
\r
98 SRC += $(CMSISDIR)/system_stm32f10x.c
\r
99 ## used parts of the STM-Library
\r
100 SRC += $(STMSPDSRCDIR)/misc.c
\r
101 SRC += $(STMSPDSRCDIR)/stm32f10x_gpio.c
\r
102 SRC += $(STMSPDSRCDIR)/stm32f10x_usart.c
\r
103 SRC += $(STMSPDSRCDIR)/stm32f10x_rcc.c
\r
104 SRC += $(STMSPDSRCDIR)/stm32f10x_flash.c
\r
105 #SRC += $(STMSPDSRCDIR)/stm32f10x_spi.c
\r
106 #SRC += $(STMSPDSRCDIR)/stm32f10x_rtc.c
\r
107 #SRC += $(STMSPDSRCDIR)/stm32f10x_bkp.c
\r
108 #SRC += $(STMSPDSRCDIR)/stm32f10x_pwr.c
\r
109 SRC += $(STMSPDSRCDIR)/stm32f10x_dma.c
\r
110 SRC += $(STMSPDSRCDIR)/stm32f10x_tim.c
\r
111 #SRC += $(STMSPDSRCDIR)/stm32f10x_fsmc.c
\r
113 # List C source files here which must be compiled in ARM-Mode (no -mthumb).
\r
114 # use file-extension c for "c-only"-files
\r
117 # List C++ source files here.
\r
118 # use file-extension .cpp for C++-files (not .C)
\r
119 #CPPSRC = main.cpp myclasses.cpp
\r
120 #CPPSRC += mini_cpp.cpp
\r
122 # List C++ source files here which must be compiled in ARM-Mode.
\r
123 # use file-extension .cpp for C++-files (not .C)
\r
124 #CPPSRCARM = $(TARGET).cpp
\r
126 # List Assembler source files here.
\r
127 # Make them always end in a capital .S. Files ending in a lowercase .s
\r
128 # will not be considered source files but generated files (assembler
\r
129 # output from the compiler), and will be deleted upon "make clean"!
\r
130 # Even though the DOS/Win* filesystem matches both .s and .S the same,
\r
131 # it will preserve the spelling of the filenames, and gcc itself does
\r
132 # care about how the name is spelled on its command-line.
\r
133 ASRC = startup_stm32f10x_md.S
\r
135 # List Assembler source files here which must be assembled in ARM-Mode..
\r
138 # List any extra directories to look for include files here.
\r
139 # Each directory must be seperated by a space.
\r
140 EXTRAINCDIRS = $(STMSPDINCDIR) $(CMSISDIR) $(FATSDDIR) $(MININIDIR) $(STMEEEMULINCDIR)
\r
141 EXTRAINCDIRS += $(APPLIBDIR) $(SWIMSRCDIR)
\r
142 EXTRAINCDIRS += C:\Engineering\CodeSourcery G++ Lite\arm-none-eabi\include
\r
145 # Each library-name must be seperated by a space.
\r
146 # i.e. to link with libxyz.a, libabc.a and libefsl.a:
\r
147 # EXTRA_LIBS = xyz abc efsl
\r
148 # for newlib-lpc (file: libnewlibc-lpc.a):
\r
149 # EXTRA_LIBS = newlib-lpc
\r
150 EXTRA_LIBS = dso138
\r
152 # Path to Linker-Scripts
\r
153 LINKERSCRIPTPATH = .
\r
154 LINKERSCRIPTINC = .
\r
156 # List any extra directories to look for library files here.
\r
157 # Also add directories where the linker should search for
\r
158 # includes from linker-script to the list
\r
159 # Each directory must be seperated by a space.
\r
160 EXTRA_LIBDIRS = $(LINKERSCRIPTINC)
\r
162 # Optimization level, can be [0, 1, 2, 3, s].
\r
163 # 0 = turn off optimization. s = optimize for size.
\r
164 # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
\r
170 # Output format. (can be ihex or binary or both)
\r
171 # binary to create a load-image in raw-binary format i.e. for SAM-BA,
\r
172 # ihex to create a load-image in Intel hex format i.e. for lpc21isp
\r
174 #LOADFORMAT = binary
\r
177 # Using the Atmel AT91_lib produces warnings with
\r
178 # the default warning-levels.
\r
179 # yes - disable these warnings
\r
180 # no - keep default settings
\r
181 #AT91LIBNOWARN = yes
\r
184 # Debugging format.
\r
189 # Place project-specific -D (define) and/or
\r
190 # -U options for C here.
\r
191 CDEFS = -DSTM32F10X_MD
\r
192 CDEFS += -DHSE_VALUE=$(F_XTAL)UL
\r
193 CDEFS += -D$(SYSCLOCK_CL)
\r
194 CDEFS += -DUSE_STDPERIPH_DRIVER
\r
195 CDEFS += -DUSE_$(BOARD)
\r
196 CDEFS += -DSTM32_SD_USE_DMA
\r
197 CDEFS += -DSTARTUP_DELAY
\r
198 # enable modifications in STM's libraries
\r
199 CDEFS += -DMOD_MTHOMAS_STMLIB
\r
200 # enable parameter-checking in STM's library
\r
201 CDEFS += -DUSE_FULL_ASSERT
\r
203 # Place project-specific -D and/or -U options for
\r
204 # Assembler with preprocessor here.
\r
205 #ADEFS = -DUSE_IRQ_ASM_WRAPPER
\r
206 ADEFS = -D__ASSEMBLY__
\r
208 # Compiler flag to set the C Standard level.
\r
210 # gnu89 - c89 plus GCC extensions
\r
211 # c99 - ISO C99 standard (not yet fully implemented)
\r
212 # gnu99 - c99 plus GCC extensions
\r
213 CSTANDARD = -std=gnu99
\r
217 ifdef VECTOR_TABLE_LOCATION
\r
218 CDEFS += -D$(VECTOR_TABLE_LOCATION)
\r
219 ADEFS += -D$(VECTOR_TABLE_LOCATION)
\r
222 CDEFS += -D$(RUN_MODE) -D$(CHIP)
\r
223 ADEFS += -D$(RUN_MODE) -D$(CHIP)
\r
228 ifeq ($(USE_THUMB_MODE),YES)
\r
230 THUMB_IW = -mthumb-interwork
\r
236 # -g*: generate debugging information
\r
237 # -O*: optimization level
\r
238 # -f...: tuning, see GCC manual and avr-libc documentation
\r
239 # -Wall...: warning level
\r
240 # -Wa,...: tell GCC to pass this to the assembler.
\r
241 # -adhlns...: create assembler listing
\r
243 # Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
\r
244 CFLAGS = -g$(DEBUG)
\r
246 CFLAGS += -mcpu=$(MCU) $(THUMB_IW)
\r
248 CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
\r
249 # when using ".ramfunc"s without longcall:
\r
250 CFLAGS += -mlong-calls
\r
251 # -mapcs-frame is important if gcc's interrupt attributes are used
\r
252 # (at least from my eabi tests), not needed if assembler-wrapper is used
\r
253 #CFLAGS += -mapcs-frame
\r
254 #CFLAGS += -fomit-frame-pointer
\r
255 CFLAGS += -ffunction-sections -fdata-sections
\r
256 CFLAGS += -fpromote-loop-indices
\r
257 CFLAGS += -Wall -Wextra
\r
258 CFLAGS += -Wimplicit -Wcast-align -Wpointer-arith
\r
259 CFLAGS += -Wredundant-decls -Wshadow -Wcast-qual -Wcast-align
\r
260 #CFLAGS += -pedantic
\r
261 CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
\r
262 # Compiler flags to generate dependency files:
\r
263 CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d
\r
266 CONLYFLAGS += -Wnested-externs
\r
267 CONLYFLAGS += $(CSTANDARD)
\r
269 # flags only for C++ (arm-*-g++)
\r
270 CPPFLAGS = -fno-rtti -fno-exceptions
\r
274 # -Wa,...: tell GCC to pass this to the assembler.
\r
275 # -ahlns: create listing
\r
276 # -g$(DEBUG): have the assembler create line number information
\r
277 ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp
\r
278 ASFLAGS += $(ADEFS)
\r
279 ASFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
\r
280 ASFLAGS += -Wa,-g$(DEBUG)
\r
281 ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
\r
285 # Link with the GNU C++ stdlib.
\r
286 CPLUSPLUS_LIB = -lstdc++
\r
287 #CPLUSPLUS_LIB += -lsupc++
\r
290 # -Wl,...: tell GCC to pass this to linker.
\r
291 # -Map: create map file
\r
292 # --cref: add cross reference to map file
\r
293 LDFLAGS = -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
\r
295 #LDFLAGS += -nostartfiles
\r
297 LDFLAGS += $(MATH_LIB)
\r
298 LDFLAGS += -lc -lgcc
\r
299 LDFLAGS += $(CPLUSPLUS_LIB)
\r
300 LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
\r
301 LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
\r
303 #LDFLAGS += -u TIM1_CC_IRQHandler -u ADC1_2_IRQHandler -u DMA1_Channel1_IRQHandler
\r
305 # Set linker-script name depending on selected run-mode and submodel name
\r
306 ifeq ($(RUN_MODE),RAM_RUN)
\r
307 LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(CHIP)_ram.ld
\r
308 ##LDFLAGS +=-T$(LINKERSCRIPTPATH)/sram.lds
\r
310 LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(CHIP)_flash.ld
\r
311 #LDFLAGS +=-T$(LINKERSCRIPTPATH)/stm32_flash.ld
\r
312 #LDFLAGS +=-T$(LINKERSCRIPTPATH)/stm32f10x_flash_offset_1.ld
\r
313 ##LDFLAGS +=-T$(LINKERSCRIPTPATH)/flash.lds
\r
316 # ---------------------------------------------------------------------------
\r
317 # Options for OpenOCD flash-programming
\r
318 # see openocd.pdf/openocd.texi for further information
\r
320 OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf
\r
321 # if OpenOCD is in the $PATH just set OPENOCDEXE=openocd
\r
322 OOCD_EXE=./OpenOCD/bin/openocd
\r
326 # interface and board/target settings (using the OOCD target-library here)
\r
327 ## OOCD_CL+=-f interface/jtagkey2.cfg -f target/stm32.cfg
\r
328 OOCD_CL+=-f interface/jtagkey.cfg -f target/stm32.cfg
\r
331 # enable "fast mode" - can be disabled for tests
\r
332 OOCD_CL+=-c "fast enable"
\r
334 OOCD_CL+=-c targets
\r
335 # commands to prepare flash-write
\r
336 OOCD_CL+= -c "reset halt"
\r
337 # increase JTAG frequency a little bit - can be disabled for tests
\r
338 OOCD_CL+= -c "jtag_khz 1200"
\r
339 # flash-write and -verify
\r
340 OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE)" -c "verify_image $(OOCD_LOADFILE)"
\r
342 OOCD_CL+=-c "reset run"
\r
343 # terminate OOCD after programming
\r
344 OOCD_CL+=-c shutdown
\r
345 # ---------------------------------------------------------------------------
\r
347 # Define programs and commands.
\r
348 CC = $(TCHAIN_PREFIX)gcc
\r
349 CPP = $(TCHAIN_PREFIX)g++
\r
350 AR = $(TCHAIN_PREFIX)ar
\r
351 OBJCOPY = $(TCHAIN_PREFIX)objcopy
\r
352 OBJDUMP = $(TCHAIN_PREFIX)objdump
\r
353 SIZE = $(TCHAIN_PREFIX)size
\r
354 NM = $(TCHAIN_PREFIX)nm
\r
355 REMOVE = $(REMOVE_CMD) -f
\r
358 ifneq ($(or $(COMSPEC), $(ComSpec)),)
\r
359 $(info COMSPEC detected $(COMSPEC) $(ComSpec))
\r
360 ifeq ($(findstring cygdrive,$(shell env)),)
\r
361 SHELL:=$(or $(COMSPEC),$(ComSpec))
\r
364 $(info cygwin detected)
\r
367 $(info SHELL is $(SHELL))
\r
371 MSG_ERRORS_NONE = Errors: none
\r
372 MSG_BEGIN = -------- begin, mode: $(RUN_MODE) --------
\r
373 MSG_END = -------- end --------
\r
374 MSG_SIZE_BEFORE = Size before:
\r
375 MSG_SIZE_AFTER = Size after build:
\r
376 MSG_LOAD_FILE = Creating load file:
\r
377 MSG_EXTENDED_LISTING = Creating Extended Listing/Disassembly:
\r
378 MSG_SYMBOL_TABLE = Creating Symbol Table:
\r
379 MSG_LINKING = ---- Linking :
\r
380 MSG_COMPILING = ---- Compiling C :
\r
381 MSG_COMPILING_ARM = ---- Compiling C ARM-only:
\r
382 MSG_COMPILINGCPP = ---- Compiling C++ :
\r
383 MSG_COMPILINGCPP_ARM = ---- Compiling C++ ARM-only:
\r
384 MSG_ASSEMBLING = ---- Assembling:
\r
385 MSG_ASSEMBLING_ARM = ---- Assembling ARM-only:
\r
386 MSG_CLEANING = Cleaning project:
\r
387 MSG_FORMATERROR = Can not handle output-format
\r
388 MSG_LPC21_RESETREMINDER = You may have to bring the target in bootloader-mode now.
\r
389 MSG_ASMFROMC = "Creating asm-File from C-Source:"
\r
390 MSG_ASMFROMC_ARM = "Creating asm-File from C-Source (ARM-only):"
\r
392 # List of all source files.
\r
393 ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC)
\r
394 # List of all source files without directory and file-extension.
\r
395 ALLSRCBASE = $(notdir $(basename $(ALLSRC)))
\r
397 # Define all object files.
\r
398 ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE)))
\r
400 # Define all listing files (used for make clean).
\r
401 LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE)))
\r
402 # Define all depedency-files (used for make clean).
\r
403 DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE)))
\r
406 #all: begin gccversion sizebefore build sizeafter finished end
\r
407 all: begin createdirs gccversion build sizeafter finished end
\r
409 elf: $(OUTDIR)/$(TARGET).elf
\r
410 lss: $(OUTDIR)/$(TARGET).lss
\r
411 sym: $(OUTDIR)/$(TARGET).sym
\r
412 hex: $(OUTDIR)/$(TARGET).hex
\r
413 bin: $(OUTDIR)/$(TARGET).bin
\r
416 ifeq ($(LOADFORMAT),ihex)
\r
417 build: elf hex lss sym
\r
419 ifeq ($(LOADFORMAT),binary)
\r
420 build: elf bin lss sym
\r
422 ifeq ($(LOADFORMAT),both)
\r
423 build: elf hex bin lss sym
\r
425 $(error "$(MSG_FORMATERROR) $(FORMAT)")
\r
430 # Create output directories.
\r
431 ifdef SHELL_IS_WIN32
\r
433 -@md $(OUTDIR) >NUL 2>&1 || echo "" >NUL
\r
434 -@md $(OUTDIR)\dep >NUL 2>&1 || echo "" >NUL
\r
437 -@mkdir $(OUTDIR) 2>/dev/null || echo "" >/dev/null
\r
438 -@mkdir $(OUTDIR)/dep 2>/dev/null || echo "" >/dev/null
\r
446 ## @echo $(MSG_ERRORS_NONE)
\r
451 # Display sizes of sections.
\r
452 ELFSIZE = $(SIZE) -A $(OUTDIR)/$(TARGET).elf
\r
453 ##ELFSIZE = $(SIZE) --format=Berkeley --common $(OUTDIR)/$(TARGET).elf
\r
455 # @if [ -f $(OUTDIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
\r
458 # @if [ -f $(OUTDIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
\r
459 @echo $(MSG_SIZE_AFTER)
\r
462 # Display compiler version information.
\r
467 # Program the device.
\r
468 ifeq ($(FLASH_TOOL),UVISION)
\r
469 # Program the device with Keil's uVision (needs configured uVision-workspace).
\r
470 program: $(OUTDIR)/$(TARGET).hex
\r
471 @echo "Programming with uVision"
\r
472 C:\Keil\uv3\Uv3.exe -f uvisionflash.Uv2 -ouvisionflash.txt
\r
474 ifeq ($(FLASH_TOOL),OPENOCD)
\r
475 # Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
\r
476 program: $(OUTDIR)/$(TARGET).elf
\r
477 @echo "Programming with OPENOCD"
\r
478 ifdef SHELL_IS_WIN32
\r
479 $(subst /,\,$(OOCD_EXE)) $(OOCD_CL)
\r
481 $(OOCD_EXE) $(OOCD_CL)
\r
484 # Program the device using lpc21isp (for NXP2k and ADuC UART bootloader)
\r
485 program: $(OUTDIR)/$(TARGET).hex
\r
486 @echo $(MSG_LPC21_RESETREMINDER)
\r
487 -$(LPC21ISP) $(LPC21ISP_OPTIONS) $(LPC21ISP_FLASHFILE) $(LPC21ISP_PORT) $(LPC21ISP_BAUD) $(LPC21ISP_XTAL)
\r
491 # Create final output file (.hex) from ELF output file.
\r
493 @echo $(MSG_LOAD_FILE) $@
\r
494 $(OBJCOPY) -O ihex $< $@
\r
496 # Create final output file (.bin) from ELF output file.
\r
498 @echo $(MSG_LOAD_FILE) $@
\r
499 $(OBJCOPY) -O binary $< $@
\r
501 # Create extended listing file/disassambly from ELF output file.
\r
502 # using objdump testing: option -C
\r
504 @echo $(MSG_EXTENDED_LISTING) $@
\r
505 $(OBJDUMP) -h -S -C -r $< > $@
\r
506 # $(OBJDUMP) -x -S $< > $@
\r
508 # Create a symbol table from ELF output file.
\r
510 @echo $(MSG_SYMBOL_TABLE) $@
\r
513 # Link: create ELF output file from object files.
\r
514 .SECONDARY : $(TARGET).elf
\r
515 .PRECIOUS : $(ALLOBJ)
\r
517 @echo $(MSG_LINKING) $@
\r
518 # use $(CC) for C-only projects or $(CPP) for C++-projects:
\r
519 ifeq "$(strip $(CPPSRC)$(CPPARM))" ""
\r
520 $(CC) $(THUMB) $(CFLAGS) $(ALLOBJ) --output $@ -nostartfiles $(LDFLAGS)
\r
522 $(CPP) $(THUMB) $(CFLAGS) $(ALLOBJ) --output $@ $(LDFLAGS)
\r
526 # Assemble: create object files from assembler source files.
\r
527 define ASSEMBLE_TEMPLATE
\r
528 $(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
\r
530 @echo $(MSG_ASSEMBLING) $$< to $$@
\r
531 $(CC) -c $(THUMB) $$(ASFLAGS) $$< -o $$@
\r
533 $(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src))))
\r
535 # Assemble: create object files from assembler source files. ARM-only
\r
536 define ASSEMBLE_ARM_TEMPLATE
\r
537 $(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
\r
538 @echo $(MSG_ASSEMBLING_ARM) $$< to $$@
\r
539 $(CC) -c $$(ASFLAGS) $$< -o $$@
\r
541 $(foreach src, $(ASRCARM), $(eval $(call ASSEMBLE_ARM_TEMPLATE, $(src))))
\r
544 # Compile: create object files from C source files.
\r
545 define COMPILE_C_TEMPLATE
\r
546 $(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
\r
547 @echo $(MSG_COMPILING) $$< to $$@
\r
548 $(CC) -c $(THUMB) $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
\r
550 $(foreach src, $(SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src))))
\r
552 # Compile: create object files from C source files. ARM-only
\r
553 define COMPILE_C_ARM_TEMPLATE
\r
554 $(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
\r
555 @echo $(MSG_COMPILING_ARM) $$< to $$@
\r
556 $(CC) -c $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
\r
558 $(foreach src, $(SRCARM), $(eval $(call COMPILE_C_ARM_TEMPLATE, $(src))))
\r
561 # Compile: create object files from C++ source files.
\r
562 define COMPILE_CPP_TEMPLATE
\r
563 $(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
\r
564 @echo $(MSG_COMPILINGCPP) $$< to $$@
\r
565 $(CC) -c $(THUMB) $$(CFLAGS) $$(CPPFLAGS) $$< -o $$@
\r
567 $(foreach src, $(CPPSRC), $(eval $(call COMPILE_CPP_TEMPLATE, $(src))))
\r
569 # Compile: create object files from C++ source files. ARM-only
\r
570 define COMPILE_CPP_ARM_TEMPLATE
\r
571 $(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
\r
572 @echo $(MSG_COMPILINGCPP_ARM) $$< to $$@
\r
573 $(CC) -c $$(CFLAGS) $$(CPPFLAGS) $$< -o $$@
\r
575 $(foreach src, $(CPPSRCARM), $(eval $(call COMPILE_CPP_ARM_TEMPLATE, $(src))))
\r
578 # Compile: create assembler files from C source files. ARM/Thumb
\r
579 $(SRC:.c=.s) : %.s : %.c
\r
580 @echo $(MSG_ASMFROMC) $< to $@
\r
581 $(CC) $(THUMB) -S $(CFLAGS) $(CONLYFLAGS) $< -o $@
\r
583 # Compile: create assembler files from C source files. ARM only
\r
584 $(SRCARM:.c=.s) : %.s : %.c
\r
585 @echo $(MSG_ASMFROMC_ARM) $< to $@
\r
586 $(CC) -S $(CFLAGS) $(CONLYFLAGS) $< -o $@
\r
588 # Target: clean project.
\r
589 clean: begin clean_list finished end
\r
592 @echo $(MSG_CLEANING)
\r
593 $(REMOVE) $(OUTDIR)/$(TARGET).map
\r
594 $(REMOVE) $(OUTDIR)/$(TARGET).elf
\r
595 $(REMOVE) $(OUTDIR)/$(TARGET).hex
\r
596 $(REMOVE) $(OUTDIR)/$(TARGET).bin
\r
597 $(REMOVE) $(OUTDIR)/$(TARGET).sym
\r
598 $(REMOVE) $(OUTDIR)/$(TARGET).lss
\r
599 $(REMOVE) $(ALLOBJ)
\r
600 $(REMOVE) $(LSTFILES)
\r
601 $(REMOVE) $(DEPFILES)
\r
602 $(REMOVE) $(SRC:.c=.s)
\r
603 $(REMOVE) $(SRCARM:.c=.s)
\r
604 $(REMOVE) $(CPPSRC:.cpp=.s)
\r
605 $(REMOVE) $(CPPSRCARM:.cpp=.s)
\r
607 ## Create object files directory - now done if special make target
\r
608 ##$(shell mkdir $(OBJDIR) 2>/dev/null)
\r
610 # Include the dependency files.
\r
611 ##-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
\r
612 -include $(wildcard dep/*)
\r
614 # Listing of phony targets.
\r
615 .PHONY : all begin finish end sizebefore sizeafter gccversion \
\r
616 build elf hex bin lss sym clean clean_list program createdirs
\r