1 ##############################################################################
3 # NOTE: Can be overridden externally.
6 # Compiler options here.
8 USE_OPT
= -O2
-ggdb
-fomit-frame-pointer
-falign-functions
=16
11 # C specific options here (added to USE_OPT).
16 # C++ specific options here (added to USE_OPT).
18 USE_CPPOPT
= -fno-rtti
21 # Enable this if you want the linker to remove unused code and data
22 ifeq ($(USE_LINK_GC
),)
26 # Linker extra options here.
31 # Enable this if you want link time optimizations (LTO)
36 # If enabled, this option allows to compile the application in THUMB mode.
41 # Enable this if you want to see the full log while compiling.
42 ifeq ($(USE_VERBOSE_COMPILE
),)
43 USE_VERBOSE_COMPILE
= no
46 # If enabled, this option makes the build process faster by not compiling
47 # modules not used in the current configuration.
48 ifeq ($(USE_SMART_BUILD
),)
53 # Build global options
54 ##############################################################################
56 ##############################################################################
57 # Architecture or project specific options
60 # Stack size to be allocated to the Cortex-M process stack. This stack is
61 # the stack used by the main() thread.
62 ifeq ($(USE_PROCESS_STACKSIZE
),)
63 USE_PROCESS_STACKSIZE
= 0x400
66 # Stack size to the allocated to the Cortex-M main/exceptions stack. This
67 # stack is used for processing interrupts and exceptions.
68 ifeq ($(USE_EXCEPTIONS_STACKSIZE
),)
69 USE_EXCEPTIONS_STACKSIZE
= 0x400
72 # Enables the use of FPU (no, softfp, hard).
77 # FPU-related options.
78 ifeq ($(USE_FPU_OPT
),)
79 USE_FPU_OPT
= -mfloat-abi
=$(USE_FPU
) -mfpu
=fpv5-d16
83 # Architecture or project specific options
84 ##############################################################################
86 ##############################################################################
87 # Project, sources and paths
90 # Define project name here
93 # Imported source files and paths
96 include $(CHIBIOS
)/os
/common
/startup
/ARMCMx
/compilers
/GCC
/mk
/startup_stm32f7xx.mk
97 # HAL-OSAL files (optional).
98 include $(CHIBIOS
)/os
/hal
/hal.mk
99 include $(CHIBIOS
)/os
/hal
/ports
/STM32
/STM32F7xx
/platform.mk
100 include $(CHIBIOS
)/os
/hal
/boards
/ST_NUCLEO144_F767ZI
/board.mk
101 include $(CHIBIOS
)/os
/hal
/osal
/rt
/osal.mk
102 # RTOS files (optional).
103 include $(CHIBIOS
)/os
/rt
/rt.mk
104 include $(CHIBIOS
)/os
/common
/ports
/ARMCMx
/compilers
/GCC
/mk
/port_v7m.mk
105 # Other files (optional).
106 include $(CHIBIOS
)/test/rt
/test.mk
108 # Define linker script file here
109 LDSCRIPT
= $(STARTUPLD
)/STM32F76xxI.
ld
111 # C sources that can be compiled in ARM or THUMB mode depending on the global
113 CSRC
= $(STARTUPSRC
) \
121 $(CHIBIOS
)/os
/hal
/lib
/streams
/memstreams.c \
122 $(CHIBIOS
)/os
/hal
/lib
/streams
/chprintf.c
124 # C++ sources that can be compiled in ARM or THUMB mode depending on the global
128 # C sources to be compiled in ARM mode regardless of the global setting.
129 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
130 # option that results in lower performance and larger code size.
133 # C++ sources to be compiled in ARM mode regardless of the global setting.
134 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
135 # option that results in lower performance and larger code size.
138 # C sources to be compiled in THUMB mode regardless of the global setting.
139 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
140 # option that results in lower performance and larger code size.
143 # C sources to be compiled in THUMB mode regardless of the global setting.
144 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
145 # option that results in lower performance and larger code size.
148 # List ASM source files here
150 ASMXSRC
= $(STARTUPASM
) $(PORTASM
) $(OSALASM
)
152 INCDIR
= $(CHIBIOS
)/os
/license \
153 $(STARTUPINC
) $(KERNINC
) $(PORTINC
) $(OSALINC
) \
154 $(HALINC
) $(PLATFORMINC
) $(BOARDINC
) $(TESTINC
) \
155 $(CHIBIOS
)/os
/various
158 # Project, sources and paths
159 ##############################################################################
161 ##############################################################################
168 TRGT
= arm-none-eabi-
171 # Enable loading with g++ only if you need C++ runtime support.
172 # NOTE: You can use C++ even without C++ support if you are careful. C++
173 # runtime support makes code size explode.
177 AS
= $(TRGT
)gcc
-x assembler-with-cpp
182 BIN
= $(CP
) -O binary
184 # ARM-specific options here
187 # THUMB-specific options here
188 TOPT
= -mthumb
-DTHUMB
190 # Define C warning options here
191 CWARN
= -Wall
-Wextra
-Wundef
-Wstrict-prototypes
-Werror
193 # Define C++ warning options here
194 CPPWARN
= -Wall
-Wextra
-Wundef
198 ##############################################################################
200 ##############################################################################
201 # Start of user section
204 # List all user C define here, like -D_DEBUG=1
205 UDEFS
= -DSTM
#-DDEBUG
207 # Define ASM defines here
210 # List all user directories here
213 # List the user directory to look for the libraries here
216 # List all user libraries here
219 # End of user defines
220 ##############################################################################
222 RULESPATH
= $(CHIBIOS
)/os
/common
/startup
/ARMCMx
/compilers
/GCC
223 include $(RULESPATH
)/rules.mk
225 flash
: build
/$(PROJECT
).bin
226 sudo
`which openocd` \
227 -f interface
/stlink-v2-1.cfg\
228 -c
"transport select hla_swd"\
229 -f target
/stm32f7x.cfg \
232 -c
"flash write_image erase "$<" 0x08000000"\