-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
543 lines (465 loc) · 14.4 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
#################################################
# MAKEFILE For STM32F4xxx Devices #
# (c) 20120630 Nemui Trinomius #
# http://nemuisan.blog.bai.ne.jp #
#################################################
# Environment Dependent!!! This Environment assure under WINDOWS !!
# Throw path into YOUR environments for each Operation Systems.
ifneq (,$(filter $(shell uname),Darwin Linux))
else
export PATH = %SYSTEMROOT%;$(TOOLDIR)/bin;$(OCDIR);$(DFUDIR);$(MAKEDIR)
endif
# Toolchain prefix (i.e arm-none-eabi -> arm-none-eabi-gcc.exe)
ifneq (,$(filter $(shell uname),Darwin Linux))
TCHAIN = /usr/local/arm-cs-tools/bin/arm-none-eabi
else
TCHAIN = "$(GNU_ARM_PATH)/bin/arm-none-eabi"
endif
# OpenOCD prefix
OCD = openocd
# Select OpenOCD Transport
OCDMODE = SWD
#OCDMODE = JTAG
# Select SWD Debug Adapter
#DBG_ADAPTER = STLINKV2
DBG_ADAPTER = STLINKV2_1
#DBG_ADAPTER = JTAGKEY2_SWD
#DBG_ADAPTER = CMSIS-DAP
#DBG_ADAPTER = VERSALOON
# OpenOCD For FT2232 Devices Special Setting
# If u use WinUSB as Device Driver,uncomment this!
MPSSE = ftdi
#MPSSE =
# Development Tools based on GNU Compiler Collection
DEVTOOL = LAUNCHPAD
#DEVTOOL = BLEEDING_EDGE
#DEVTOOL = YAGARTO
#DEVTOOL = DEVKITARM
#DEVTOOL = SOURCERY
# Check BuildTools
ifeq ($(DEVTOOL),LAUNCHPAD)
TOOLDIR = C:/Devz/ARM/Launchpad
NANOLIB = --specs=nano.specs
NANOLIB += -u _printf_float
NANOLIB += -u _scanf_float
REMOVAL = rm
else ifeq ($(DEVTOOL),BLEEDING_EDGE)
TOOLDIR = C:/Devz/ARM/Bleeding-edge
REMOVAL = rm
else ifeq ($(DEVTOOL),DEVKITARM)
TOOLDIR = C:/Devz/ARM/devkitARM
REMOVAL = rm
else ifeq ($(DEVTOOL),YAGARTO)
TOOLDIR = C:/Devz/ARM/Yagarto
REMOVAL = rm
else ifeq ($(DEVTOOL),SOURCERY)
TOOLDIR = C:/Devz/ARM/Sourcery
REMOVAL = rm
else
$(error SET BUILD-TOOLS AT FIRST!!)
endif
# Set UNIX-Like Tools(CoreUtils) Directory
MAKEDIR = C:/Devz/Coreutils/bin
# Set Flasher and Debugger
ifneq (,$(filter $(shell uname),Darwin Linux))
OCDIR = /usr/local/openocd
else
OCDIR = C:\openocd
endif
#OCD_DBG = -c "debug_level 3"
ifeq ($(OCDMODE),SWD)
ifeq ($(DBG_ADAPTER),VERSALOON)
OCD_ARG = -s $(OCDIR)/tcl \
-f interface/vsllink_swd.cfg \
-f target/stm32f4x_flash.cfg
else ifeq ($(DBG_ADAPTER),CMSIS-DAP)
OCD_ARG = -s $(OCDIR)/tcl \
-f interface/cmsis-dap.cfg \
-f target/stm32f4x_flash.cfg
else ifeq ($(DBG_ADAPTER),STLINKV2_1)
OCD_ARG = -s $(OCDIR)/tcl \
-f target/nucleo-f4_flash.cfg
else
OCD_ARG = -s $(OCDIR)/tcl \
-f target/stm32f4discovery_flash.cfg
# -f target/stm32f429discovery_flash.cfg
endif
else
OCD_ARG = -s $(OCDIR)/tcl \
-f interface/$(MPSSE)/jtagkey2.cfg \
-f target/stm32f4x_flash.cfg
endif
OCD_CMD = $(OCD_DBG) $(OCD_ARG)
#Set DFUse Directory
DFUDIR = C:/Devz/ARM/ST/DFUse/BIN
#Set Shell Definitions
WSHELL = cmd
MSGECHO = echo
#Set GDB/Insight Directory
GDBDIR = C:/Devz/ARM/insight/bin
INSIGHT = $(GDBDIR)/arm-none-eabi-insight
# Environment Dependent!!!
# OPTIMIZE Definition
#OPTIMIZE = fast
OPTIMIZE = 2
# FPU Definition
ifeq ($(DEVTOOL),LAUNCHPAD)
# Launchpad has hard-float library in free!
USING_FPU = -mfloat-abi=hard -mfpu=fpv4-sp-d16
#USING_FPU = -mfloat-abi=softfp -mfpu=fpv4-sp-d16
#USING_FPU = -mfloat-abi=soft
else ifeq ($(DEVTOOL),BLEEDING_EDGE)
# Bleeding-edge has hard-float library in free!
USING_FPU = -mfloat-abi=hard -mfpu=fpv4-sp-d16
#USING_FPU = -mfloat-abi=softfp -mfpu=fpv4-sp-d16
#USING_FPU = -mfloat-abi=soft
else
USING_FPU = -mfloat-abi=softfp -mfpu=fpv4-sp-d16
#USING_FPU = -mfloat-abi=soft
endif
# GCC LTO Specific Option
ifneq ($(OPTIMIZE),0)
USE_LTO = -flto-partition=none -fipa-sra
#USE_LTO = -flto -fipa-sra
endif
# GCC Version Specific Options
ALIGNED_ACCESS = -mno-unaligned-access
#FPREC_CONST = -fsingle-precision-constant
#ARMV7M_BOOST = -mslow-flash-data
# Semihosting Definition
#USING_HOSTAGE = USE_SEMIHOSTING
ifeq ($(USING_HOSTAGE),USE_SEMIHOSTING)
SEMIHOST_LIB = --specs=rdimon.specs -lrdimon
else
START_LIB = -nostartfiles
endif
# Apprication Version
APP_VER = W.I.P
# Board and MPU Definitions
#EVAL_BOARD = USE_MAIN_V2
EVAL_BOARD = USE_MAIN_V3
#EVAL_BOARD = USE_STM32F4DISCOVERY
#EVAL_BOARD = USE_32F429IDISCOVERY
ifeq ($(EVAL_BOARD),USE_MAIN_V2)
MPU_CLASS = STM32F4XX
MPU_MODEL = STM32F40_41xxx
SUBMODEL = STM32F407VGT6
HSE_CLOCK = 25000000
USE_EXT_SRAM =
USE_TOUCH_SENCE =
USE_FATFS_HAL = USE_SDIO_AS_SDCARD
STM32PLUS_Fn = STM32PLUS_F407
DEBUG_PORT = Usart1
else ifeq ($(EVAL_BOARD),USE_MAIN_V3)
MPU_CLASS = STM32F4XX
MPU_MODEL = STM32F40_41xxx
SUBMODEL = STM32F407VGT6
HSE_CLOCK = 25000000
USE_EXT_SRAM =
USE_TOUCH_SENCE =
USE_FATFS_HAL = USE_SDIO_AS_SDCARD
STM32PLUS_Fn = STM32PLUS_F407
#FT232
DEBUG_PORT = Usart2_Remap1
#XBee
#DEBUG_PORT = Usart1_Remap1
else ifeq ($(EVAL_BOARD),USE_STM32F4DISCOVERY)
MPU_CLASS = STM32F4XX
MPU_MODEL = STM32F40_41xxx
SUBMODEL = STM32F407VGT6
HSE_CLOCK = 8000000
USE_EXT_SRAM =
USE_TOUCH_SENCE =
USE_FATFS_HAL = USE_SPI_AS_MMC
STM32PLUS_Fn = STM32PLUS_F407
else ifeq ($(EVAL_BOARD),USE_32F429IDISCOVERY)
MPU_CLASS = STM32F4XX
MPU_MODEL = STM32F429_439xx
SUBMODEL = STM32F429ZIT6
HSE_CLOCK = 8000000
USE_EXT_SDRAM = EXT_SDRAM_SUPPORT
USE_TOUCH_SENCE = USE_STMPE811_I2C
USE_FATFS_HAL = USE_SPI_AS_MMC
STM32PLUS_Fn = STM32PLUS_F429
else
$(error TARGET BOARD IS NOT DEFINED!!)
endif
PERIF_DRIVER = USE_STDPERIPH_DRIVER
# Use FreeRTOS?
OS_SUPPORT = BARE_METAL
#OS_SUPPORT = USE_FREERTOS
STM32PLUS_DIR = ../stm32plus
ROSLIB_DIR = ./lib/ros_lib
FWLIB = $(STM32PLUS_DIR)/fwlib/f4/stdperiph
ifeq ($(STM32PLUS_Fn),STM32PLUS_F407)
STM32PLUS_LIB_DIR = $(STM32PLUS_DIR)/build/small-f4-$(HSE_CLOCK)-hard
STATIC_LIB = -lstm32plus-small-f4-$(HSE_CLOCK)-hard
else
ifeq ($(STM32PLUS_Fn),STM32PLUS_F429)
STM32PLUS_LIB_DIR = $(STM32PLUS_DIR)/build/small-f429-$(HSE_CLOCK)-hard
STATIC_LIB = -lstm32plus-small-f429-$(HSE_CLOCK)-hard
endif
endif
# Synthesis makefile Defines
DEFZ = $(MPU_CLASS) $(SUBMODEL) $(EVAL_BOARD) $(PERIF_DRIVER) $(VECTOR_START) \
$(USING_HOSTAGE) $(OS_SUPPORT) $(USE_EXT_SRAM) $(USE_EXT_SDRAM) $(USE_EXT_HEAP) $(UART_DEBUG)
DEFZ += $(STM32PLUS_Fn)
SYNTHESIS_DEFS = $(addprefix -D,$(DEFZ)) \
-DARM_MATH_CM4 \
-DPACK_STRUCT_END=__attribute\(\(packed\)\) \
-DALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\) \
-DMPU_SUBMODEL=\"$(SUBMODEL)\" \
-DAPP_VERSION=\"$(APP_VER)\" \
-DHSE_VALUE=$(HSE_CLOCK)UL
ifdef DEBUG_PORT
SYNTHESIS_DEFS += -DDEBUG_PORT=$(DEBUG_PORT)
endif
# TARGET definition
TARGET = main
TARGET_ELF = $(TARGET).elf
TARGET_SREC = $(TARGET).s19
TARGET_HEX = $(TARGET).hex
TARGET_BIN = $(TARGET).bin
TARGET_LSS = $(TARGET).lss
TARGET_DFU = $(TARGET).dfu
TARGET_SYM = $(TARGET).sym
# define CMSIS LIBRARY PATH
CMSISLIB = ./lib/CMSIS
CMSIS_DEVICE = $(CMSISLIB)/Device/ST/STM32F4xx
#CMSIS_CORE = $(CMSISLIB)/Include
#CMSIS_DEVICE_INC = $(CMSISLIB)/Device/ST/STM32F4xx/Include
CMSIS_CORE = $(STM32PLUS_DIR)/fwlib/f4/cmsis/Include
CMSIS_DEVICE_INC = $(STM32PLUS_DIR)/fwlib/f4/cmsis/Device/ST/STM32F4xx/Include
# include PATH
INCPATHS = ./ \
./inc \
$(FWLIB)/inc \
$(CMSIS_DEVICE_INC) \
$(CMSIS_CORE) \
$(LIBINCDIRS) \
$(STM32PLUS_DIR) \
$(STM32PLUS_DIR)/include \
$(STM32PLUS_DIR)/include/stl\
$(ROSLIB_DIR)
INCLUDES = $(addprefix -I ,$(INCPATHS))
# Set library PATH
LIBPATHS = $(FWLIB) $(USBLIB) $(STM32PLUS_LIB_DIR)
LIBRARY_DIRS = $(addprefix -L,$(LIBPATHS))
# if you use math-library, put "-lm"
MATH_LIB = -lm
# LinkerScript PATH
LINKER_PATH = ./lib/linker
LINKER_DIRS = $(addprefix -L,$(LINKER_PATH))
# Object definition
OBJS = $(CFILES:%.c=$(OUTDIR)/%.o) $(CPPFILES:%.cpp=$(OUTDIR)/%.o) $(SFILES:%.s=$(OUTDIR)/%.o)
# C code PATH
SOURCE = ./src
CFILES = $(wildcard $(SOURCE)/*.c) $(wildcard $(SOURCE)/utils/*.c) $(wildcard $(SOURCE)/hardware/*.c)
# CPP code PATH
CPPFILES = $(wildcard $(SOURCE)/*.cpp) $(wildcard $(SOURCE)/utils/*.cpp) $(wildcard $(SOURCE)/hardware/*.cpp)
CPPFILES += $(ROSLIB_DIR)/time.cpp $(ROSLIB_DIR)/duration.cpp
#/*----- FatFs library PATH -----*/
FATFS = ./lib/ff
LIBINCDIRS += $(FATFS)
CFILES += \
$(FATFS)/ff.c \
$(FATFS)/ff_rtc_if.c \
$(FATFS)/option/unicode.c \
$(FATFS)/option/syscall.c
ifeq ($(USE_FATFS_HAL),USE_SPI_AS_MMC)
CFILES += \
$(FATFS)/mmc_stm32f4.c
else ifeq ($(USE_FATFS_HAL),USE_SDIO_AS_SDCARD)
CFILES += \
$(FATFS)/sdio_stm32f4.c
else
$(error MUST Select Hardware Abstraction Layer )
endif
#/*----- STARTUP code PATH -----*/
STARTUP_DIR = ./lib/startup
ifeq ($(OS_SUPPORT),USE_FREERTOS)
SFILES += \
$(SOURCE)/startup_$(shell echo $(MPU_MODEL)|tr "[:upper:]" "[:lower:]")_rtos.s
else
SFILES += \
$(STARTUP_DIR)/startup_$(shell echo $(MPU_MODEL)|tr "[:upper:]" "[:lower:]").s
endif
#/*----- STM32 Debug library -----*/
ifeq ($(OPTIMIZE),0)
CFILES += \
./lib/IOView/stm32f4xx_io_view.c
else
endif
OUTDIR := Build
DEPS:= $(CFILES:%.c=$(OUTDIR)/%.d) $(CPPFILES:%.cpp=$(OUTDIR)/%.d)
# TOOLCHAIN SETTING
CC = $(TCHAIN)-gcc
CPP = $(TCHAIN)-g++
OBJCOPY = $(TCHAIN)-objcopy
OBJDUMP = $(TCHAIN)-objdump
SIZE = $(TCHAIN)-size
AR = $(TCHAIN)-ar
LD = $(TCHAIN)-g++
NM = $(TCHAIN)-nm
REMOVE = $(REMOVAL) -f
REMOVEDIR = $(REMOVAL) -rf
# C and ASM FLAGS
C_CXXFLAGS = -MMD -MP -mcpu=cortex-m4 -march=armv7e-m -mtune=cortex-m4
C_CXXFLAGS += -mthumb -mlittle-endian $(ALIGNED_ACCESS) $(ARMV7M_BOOST) $(FPREC_CONST)
C_CXXFLAGS += -mapcs-frame -mno-sched-prolog $(USING_FPU)
C_CXXFLAGS += -gdwarf-2 -O$(OPTIMIZE) $(USE_LTO) $(NANOLIB) $(SEMIHOST_LIB)
C_CXXFLAGS += -fno-strict-aliasing -fsigned-char
C_CXXFLAGS += -ffunction-sections -fdata-sections
C_CXXFLAGS += -fno-schedule-insns2
C_CXXFLAGS += --param max-inline-insns-single=1000
C_CXXFLAGS += -fno-common
C_CXXFLAGS += -Wall -Wno-array-bounds -Wno-unused-but-set-variable
#C_CXXFLAGS += -Wdouble-promotion
#C_CXXFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused
C_CXXFLAGS += -Wa,-adhlns=$(OUTDIR)/$(subst $(suffix $<),.lst,$<)
C_CXXFLAGS += $(SYNTHESIS_DEFS)
C_CXXFLAGS += -g3
CFLAGS = -lstdc++ -std=gnu99
CXXFLAGS = -std=gnu++11 -fpermissive -fsigned-char -fno-rtti -fexceptions -fmessage-length=0
# Linker FLAGS
LDFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mthumb
LDFLAGS += -u g_pfnVectors -Wl,-static -Wl,--gc-sections,-cref $(START_LIB)
LDFLAGS += -Wl,-Map=$(TARGET).map
LDFLAGS += $(LIBRARY_DIRS) $(LINKER_DIRS) $(MATH_LIB)
LDFLAGS +=-T$(LINKER_PATH)/$(SUBMODEL).ld
# Object Copy and dfu generation FLAGS
OBJCPFLAGS = -O
OBJDUMPFLAGS = -h -S -C
DFU = hex2dfu
DFLAGS = -w
# Build Object
all: gccversion build buildinform sizeafter
build: $(TARGET_ELF) $(TARGET_LSS) $(TARGET_SYM) $(TARGET_HEX) $(TARGET_SREC) $(TARGET_BIN)
.SUFFIXES: .o .c .cpp .s
$(TARGET_LSS): $(TARGET_ELF)
@$(MSGECHO)
@$(MSGECHO) Disassemble: $@
$(OBJDUMP) $(OBJDUMPFLAGS) $< > $@
$(TARGET_SYM): $(TARGET_ELF)
@$(MSGECHO)
@$(MSGECHO) Symbol: $@
$(NM) -n $< > $@
$(TARGET).hex: $(TARGET).elf
@$(MSGECHO)
@$(MSGECHO) Objcopy: $@
$(OBJCOPY) $(OBJCPFLAGS) ihex $^ $@
$(TARGET).s19: $(TARGET).elf
@$(MSGECHO)
@$(MSGECHO) Objcopy: $@
$(OBJCOPY) $(OBJCPFLAGS) srec $^ $@
$(TARGET).bin: $(TARGET).elf
@$(MSGECHO)
@$(MSGECHO) Objcopy: $@
$(OBJCOPY) $(OBJCPFLAGS) binary $< $@
$(TARGET).dfu: $(TARGET).hex
@$(MSGECHO)
@$(MSGECHO) Make STM32 dfu: $@
$(DFU) $(DFLAGS) $< $@
@$(MSGECHO)
$(TARGET).elf: $(OBJS)
@$(MSGECHO) Link: $@
$(LD) $(C_CXXFLAGS) $(LDFLAGS) $^ -o $@ $(STATIC_LIB)
@$(MSGECHO)
$(OUTDIR)/%.o:%.c
ifneq (,$(filter $(shell uname),Darwin Linux))
@if [ ! -e `/usr/bin/dirname $@` ]; then /bin/mkdir -p `/usr/bin/dirname $@`; fi
else
@if [ ! -e `dirname $@` ]; then mkdir -p `dirname $@`; fi
endif
@$(MSGECHO) Compile: $<
$(CC) -c $(CFLAGS) $(C_CXXFLAGS) $(INCLUDES) $< -o $@
@$(MSGECHO)
$(OUTDIR)/%.o:%.cpp
ifneq (,$(filter $(shell uname),Darwin Linux))
@if [ ! -e `/usr/bin/dirname $@` ]; then /bin/mkdir -p `/usr/bin/dirname $@`; fi
else
@if [ ! -e `dirname $@` ]; then mkdir -p `dirname $@`; fi
endif
@$(MSGECHO) Compile: $<
$(CPP) -c $(C_CXXFLAGS) $(CXXFLAGS) $(INCLUDES) $< -o $@
@$(MSGECHO)
$(OUTDIR)/%.o:%.s
ifneq (,$(filter $(shell uname),Darwin Linux))
@if [ ! -e `/usr/bin/dirname $@` ]; then /bin/mkdir -p `/usr/bin/dirname $@`; fi
else
@if [ ! -e `dirname $@` ]; then mkdir -p `dirname $@`; fi
endif
@$(MSGECHO) Assemble: $<
$(CC) -c $(C_CXXFLAGS) $(INCLUDES) $< -o $@
@$(MSGECHO)
# Object Size Informations
sizeafter: $(TARGET).elf $(TARGET).hex buildinform
@$(MSGECHO)
@$(MSGECHO) Built Object Informations:
@$(MSGECHO) === Total Binary Size ===
@$(SIZE) $(TARGET).hex
@$(MSGECHO) === Verbose ELF Size ===
@$(SIZE) $(TARGET).elf
@$(SIZE) -A -x $(TARGET).elf
# Display compiler version information.
gccversion :
@$(CC) --version
@$(MSGECHO)
buildinform :
@$(MSGECHO)
@$(MSGECHO)
@$(MSGECHO) Built Informations:
@$(MSGECHO) TCHAIN_PATH = $(TCHAIN)
@$(MSGECHO) EVAL_BOARD = $(EVAL_BOARD)
@$(MSGECHO) MPU_CLASS = $(MPU_CLASS)
@$(MSGECHO) MPU_MODEL = $(MPU_MODEL)
@$(MSGECHO) SUBMODEL = $(SUBMODEL)
@$(MSGECHO) HSE_CLOCK = $(HSE_CLOCK)
@$(MSGECHO) USING_FPU = $(USING_FPU)
@$(MSGECHO) USING_SYSTEM = $(OS_SUPPORT)
# Flash and Debug Program
debug :
$(WSHELL) /c start /B $(INSIGHT) $(TARGET).elf
$(OCD) $(OCD_CMD) -c "reset halt" -c"arm semihosting enable"
program :
ifneq (,$(filter $(shell uname),Darwin Linux))
# @cp $(TARGET).elf $(OCDIR)
# @cd $(OCDIR) && ./$(OCD) $(OCD_CMD) -c "mt_flash $(TARGET).elf"
@$(OCDIR)/bin/$(OCD) $(OCD_CMD) -c "mt_flash_bin $(TARGET).bin 0x08000000"
else
$(OCD) $(OCD_CMD) -c "mt_flash $(TARGET).elf"
# $(OCD) $(OCD_CMD) -c "eraser"
# $(OCD) $(OCD_CMD) -c "mt_flash_bin $(TARGET).bin 0x08000000"
endif
ifndef STM32_ST_LINK_Utility_PATH
STM32_ST_LINK_Utility_PATH = C:/ST-LINK_Utility
endif
flash :
ifneq (,$(filter $(shell uname),Darwin Linux))
@echo "Writing $(TARGET).bin"
@st-flash --reset write $(TARGET).bin 0x08000000
else
@"$(STLINK_PATH)/ST-LINK_CLI.exe" -c SWD UR -P $(TARGET).hex 0x08000000
@"$(STLINK_PATH)/ST-LINK_CLI.exe" -c SWD UR -Rst
endif
# Drop files into dust-shoot
.PHONY clean:
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).bin
$(REMOVE) $(TARGET).obj
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).s19
$(REMOVE) $(TARGET).a90
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lnk
$(REMOVE) $(TARGET).lss
$(REMOVE) $(TARGET).dfu
$(REMOVE) $(wildcard *.stackdump)
$(REMOVEDIR) .dep
$(REMOVEDIR) $(OUTDIR)
@$(MSGECHO)
-include $(DEPS)
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex bin lss sym clean clean_list program