Revision 732a4657 modules/STM32F407G-DISC1/Makefile

View differences:

modules/STM32F407G-DISC1/Makefile
43 43
  USE_CPPOPT = -fno-rtti -std=c++17
44 44
endif
45 45

  
46
# Enable this if you want the linker to remove unused code and data
46
# Enable this if you want the linker to remove unused code and data.
47 47
ifeq ($(USE_LINK_GC),)
48 48
  USE_LINK_GC = yes
49 49
endif
......
53 53
  USE_LDOPT =
54 54
endif
55 55

  
56
# Enable this if you want link time optimizations (LTO)
56
# Enable this if you want link time optimizations (LTO).
57 57
ifeq ($(USE_LTO),)
58 58
  USE_LTO = yes
59 59
endif
60 60

  
61
# If enabled, this option allows to compile the application in THUMB mode.
62
ifeq ($(USE_THUMB),)
63
  USE_THUMB = yes
64
endif
65

  
66 61
# Enable this if you want to see the full log while compiling.
67 62
ifeq ($(USE_VERBOSE_COMPILE),)
68 63
  USE_VERBOSE_COMPILE = no
......
94 89
  USE_EXCEPTIONS_STACKSIZE = 0x400
95 90
endif
96 91

  
97
# Enables the use of FPU on Cortex-M4.
92
# Enables the use of FPU.
98 93
# Possible selections are:
99 94
#   no     - no FPU is used (probably equals 'soft')
100 95
#   soft   - does not use the FPU, thus all floating point operations are emulated
......
104 99
  USE_FPU = softfp
105 100
endif
106 101

  
102
# FPU-related options.
103
ifeq ($(USE_FPU_OPT),)
104
  USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
105
endif
106

  
107 107
#                                                                              #
108 108
# Architecture or project specific options                                     #
109 109
################################################################################
110 110

  
111 111
################################################################################
112
# Project, sources and paths                                                   #
112
# Project, target, sources and paths                                           #
113 113
#                                                                              #
114 114

  
115 115
# Define project name here
116 116
PROJECT := $(patsubst $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))..)/%,%,$(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))))
117 117

  
118
# Imported source files and paths
118
# Target settings.
119
MCU = cortex-m4
120

  
121
# Imported source files and paths.
119 122
include ../../kernel/kernel.mk
120
CHIBIOS := $(AMIROOS_KERNEL)
121
AMIROOS = ../..
122
# Licensing files
123
CHIBIOS    := $(AMIROOS_KERNEL)
124
CONFDIR    := .
125
ifeq ($(BUILDDIR),)
126
  BUILDDIR := ./build
127
endif
128
DEPDIR     := $(dir $(BUILDDIR)).dep
129
AMIROOS    := ../..
130
# Licensing files.
123 131
include $(CHIBIOS)/os/license/license.mk
124
# Startup files
132
# Startup files.
125 133
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
126
# HAL-OSAL files
134
# HAL-OSAL files (optional).
127 135
include $(CHIBIOS)/os/hal/hal.mk
128 136
include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
129 137
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
130
# RTOS files
138
# RTOS files (optional).
131 139
include $(CHIBIOS)/os/rt/rt.mk
132 140
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
141
# Auto-build files in ./source recursively.
142
include $(CHIBIOS)/tools/mk/autobuild.mk
133 143
# Other files (optional).
134 144
include $(CHIBIOS)/test/lib/test.mk
135 145
include $(CHIBIOS)/test/rt/rt_test.mk
......
148 158

  
149 159
# C sources that can be compiled in ARM or THUMB mode depending on the global
150 160
# setting.
151
CSRC = $(LICSRC) \
152
       $(STARTUPSRC) \
153
       $(KERNSRC) \
154
       $(PORTSRC) \
155
       $(OSALSRC) \
156
       $(HALSRC) \
157
       $(PLATFORMSRC) \
158
       $(MODULESCSRC) \
161
CSRC = $(ALLCSRC) \
159 162
       $(TESTSRC) \
160
       $(PERIPHERYLLDCSRC) \
161
       $(AMIROOSCORECSRC) \
162
       $(UNITTESTSCSRC) \
163 163
       $(CHIBIOS)/os/various/evtimer.c \
164 164
       $(CHIBIOS)/os/various/syscalls.c \
165 165
       $(CHIBIOS)/os/hal/lib/streams/chprintf.c \
166 166
       board.c \
167
       $(PERIPHERYLLDCSRC) \
168
       $(UNITTESTSCSRC) \
169
       $(AMIROOSCORECSRC) \
170
       $(MODULESCSRC) \
167 171
       module.c \
168 172
       $(APPSCSRC)
169 173

  
170 174
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
171 175
# setting.
172
CPPSRC = $(AMIROOSCORECPPSRC) \
176
CPPSRC = $(ALLCPPSRC) \
173 177
         $(CHIBIOS)/os/various/cpp_wrappers/syscalls_cpp.cpp \
178
         $(AMIROOSCORECPPSRC) \
174 179
         $(APPSCPPSRC)
175 180

  
176
# C sources to be compiled in ARM mode regardless of the global setting.
177
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
178
#       option that results in lower performance and larger code size.
179
ACSRC = $(APPSACSRC)
180

  
181
# C++ sources to be compiled in ARM mode regardless of the global setting.
182
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
183
#       option that results in lower performance and larger code size.
184
ACPPSRC = $(APPSACPPSRC)
185

  
186
# C sources to be compiled in THUMB mode regardless of the global setting.
187
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
188
#       option that results in lower performance and larger code size.
189
TCSRC = $(APPSTCSRC)
190

  
191
# C sources to be compiled in THUMB mode regardless of the global setting.
192
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
193
#       option that results in lower performance and larger code size.
194
TCPPSRC = $(APPSTCPPSRC)
195

  
196
# List ASM source files here
197
ASMSRC = $(APPSASMSRC)
198
ASMXSRC = $(STARTUPASM) \
199
          $(PORTASM) \
200
          $(OSALASM) \
181
# List ASM source files here.
182
ASMSRC = $(ALLASMSRC) \
183
         $(APPSASMSRC)
184

  
185
# List ASM with preprocessor source files here.
186
ASMXSRC = $(ALLXASMSRC) \
201 187
          $(APPSASMXSRC)
202 188

  
203
INCDIR = $(LICINC) \
204
         $(STARTUPINC) \
205
         $(KERNINC) \
206
         $(PORTINC) \
207
         $(OSALINC) \
208
         $(HALINC) \
209
         $(PLATFORMINC) \
210
         $(MODULESINC) \
189
# Inclusion directories.
190
INCDIR = $(CONFDIR) \
191
         $(ALLINC) \
211 192
         $(TESTINC) \
212
         $(BOOTLOADERINC) \
213 193
         $(CHIBIOS)/os/hal/lib/streams \
194
         $(BOOTLOADERINC) \
214 195
         $(PERIPHERYLLDINC) \
215 196
         $(AMIROOS) \
216
         $(AMIROOSCOREINC) \
217 197
         $(UNITTESTSINC) \
198
         $(AMIROOSCOREINC) \
199
         $(MODULESINC) \
218 200
         $(APPSINC)
219 201

  
220
#                                                                              #
221
# Project, sources and paths                                                   #
222
################################################################################
223

  
224
################################################################################
225
# Compiler settings                                                            #
226
# NOTE: Some can be overridden externally.                                     #
227
#                                                                              #
228

  
229
MCU  = cortex-m4
230

  
231
#TRGT = arm-elf-
232
TRGT = arm-none-eabi-
233
CC   = $(TRGT)gcc
234
CPPC = $(TRGT)g++
235
# Enable loading with g++ only if you need C++ runtime support.
236
# NOTE: You can use C++ even without C++ support if you are careful. C++
237
#       runtime support makes code size explode.
238
LD   = $(TRGT)gcc
239
#LD   = $(TRGT)g++
240
CP   = $(TRGT)objcopy
241
AS   = $(TRGT)gcc -x assembler-with-cpp
242
AR   = $(TRGT)ar
243
OD   = $(TRGT)objdump
244
SZ   = $(TRGT)size
245
HEX  = $(CP) -O ihex
246
BIN  = $(CP) -O binary
247
SREC = $(CP) -O srec --srec-len=248
248

  
249
# ARM-specific options here
250
ifeq ($(AOPT),)
251
  AOPT =
252
endif
253

  
254
# THUMB-specific options here
255
ifeq ($(TOPT),)
256
  TOPT = -mthumb -DTHUMB
257
endif
258

  
259
# Define C warning options here
260
ifeq ($(CWARN),)
261
  CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
262
endif
202
# Define C warning options here.
203
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
263 204

  
264
# Define C++ warning options here
265
ifeq ($(CPPWARN),)
266
  CPPWARN = -Wall -Wextra -Wundef
267
endif
205
# Define C++ warning options here.
206
CPPWARN = -Wall -Wextra -Wundef
268 207

  
269 208
#                                                                              #
270
# Compiler settings                                                            #
209
# Project, target, sources and paths                                           #
271 210
################################################################################
272 211

  
273 212
################################################################################
......
290 229
ULIBS +=
291 230

  
292 231
#                                                                              #
293
# End of user defines                                                          #
232
# End of user section                                                          #
294 233
################################################################################
295 234

  
296 235
################################################################################
297
# Start of targets section                                                     #
236
# Common rules                                                                 #
298 237
#                                                                              #
299 238

  
300
# all and its dependencies
301
ifeq ($(BUILDDIR),)
302
	BUILDDIR = ./build
303
endif
304
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
239
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
240
include $(RULESPATH)/arm-none-eabi.mk
305 241
include $(RULESPATH)/rules.mk
306 242

  
307
# flash
308
include $(AMIROOS)/bootloader/bootloader.mk
243
#                                                                              #
244
# Common rules                                                                 #
245
################################################################################
246

  
247
################################################################################
248
# Custom rules                                                                 #
249
#                                                                              #
309 250

  
310 251
flash: $(BUILDDIR)/$(PROJECT).elf
311 252
	openocd -f interface/stlink-v2-1.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x.cfg -c "program build/$(PROJECT).elf verify reset exit"
312 253

  
313 254
#                                                                              #
314
# End of targets section                                                       #
255
# Custom rules                                                                 #
315 256
################################################################################
316 257

  

Also available in: Unified diff