|
| 1 | +############################################################################## |
| 2 | +# Build global options |
| 3 | +# NOTE: Can be overridden externally. |
| 4 | +# |
| 5 | + |
| 6 | +# Compiler options here. |
| 7 | +ifeq ($(USE_OPT),) |
| 8 | + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 |
| 9 | +endif |
| 10 | + |
| 11 | +# C specific options here (added to USE_OPT). |
| 12 | +ifeq ($(USE_COPT),) |
| 13 | + USE_COPT = |
| 14 | +endif |
| 15 | + |
| 16 | +# C++ specific options here (added to USE_OPT). |
| 17 | +ifeq ($(USE_CPPOPT),) |
| 18 | + USE_CPPOPT = -fno-rtti |
| 19 | +endif |
| 20 | + |
| 21 | +# Enable this if you want the linker to remove unused code and data |
| 22 | +ifeq ($(USE_LINK_GC),) |
| 23 | + USE_LINK_GC = yes |
| 24 | +endif |
| 25 | + |
| 26 | +# If enabled, this option allows to compile the application in THUMB mode. |
| 27 | +ifeq ($(USE_THUMB),) |
| 28 | + USE_THUMB = yes |
| 29 | +endif |
| 30 | + |
| 31 | +# Enable this if you want to see the full log while compiling. |
| 32 | +ifeq ($(USE_VERBOSE_COMPILE),) |
| 33 | + USE_VERBOSE_COMPILE = no |
| 34 | +endif |
| 35 | + |
| 36 | +# |
| 37 | +# Build global options |
| 38 | +############################################################################## |
| 39 | + |
| 40 | +############################################################################## |
| 41 | +# Architecture or project specific options |
| 42 | +# |
| 43 | + |
| 44 | +# Enables the use of FPU on Cortex-M4. |
| 45 | +ifeq ($(USE_FPU),) |
| 46 | + USE_FPU = no |
| 47 | +endif |
| 48 | + |
| 49 | +# Enable this if you really want to use the STM FWLib. |
| 50 | +ifeq ($(USE_FWLIB),) |
| 51 | + USE_FWLIB = no |
| 52 | +endif |
| 53 | + |
| 54 | +# |
| 55 | +# Architecture or project specific options |
| 56 | +############################################################################## |
| 57 | + |
| 58 | +############################################################################## |
| 59 | +# Project, sources and paths |
| 60 | +# |
| 61 | + |
| 62 | +# Define project name here |
| 63 | +PROJECT = ch |
| 64 | + |
| 65 | +# Imported source files and paths |
| 66 | +CHIBIOS = /home/texzk/ChibiStudio/chibios |
| 67 | +include $(CHIBIOS)/os/hal/platforms/STM32F4xx/platform.mk |
| 68 | +include $(CHIBIOS)/os/hal/hal.mk |
| 69 | +include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F4xx/port.mk |
| 70 | +include $(CHIBIOS)/os/kernel/kernel.mk |
| 71 | +include $(CHIBIOS)/test/test.mk |
| 72 | + |
| 73 | +# Define linker script file here |
| 74 | +LDSCRIPT= $(PORTLD)/STM32F407xG.ld |
| 75 | +#LDSCRIPT= $(PORTLD)/STM32F407xG_CCM.ld |
| 76 | + |
| 77 | +# C sources that can be compiled in ARM or THUMB mode depending on the global |
| 78 | +# setting. |
| 79 | +CSRC = $(PORTSRC) \ |
| 80 | + $(KERNSRC) \ |
| 81 | + $(TESTSRC) \ |
| 82 | + $(HALSRC) \ |
| 83 | + $(PLATFORMSRC) \ |
| 84 | + $(CHIBIOS)/os/various/shell.c \ |
| 85 | + $(CHIBIOS)/os/various/chprintf.c \ |
| 86 | + main.c board.c usbcfg.c |
| 87 | + |
| 88 | +# C++ sources that can be compiled in ARM or THUMB mode depending on the global |
| 89 | +# setting. |
| 90 | +CPPSRC = |
| 91 | + |
| 92 | +# C sources to be compiled in ARM mode regardless of the global setting. |
| 93 | +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
| 94 | +# option that results in lower performance and larger code size. |
| 95 | +ACSRC = |
| 96 | + |
| 97 | +# C++ sources to be compiled in ARM mode regardless of the global setting. |
| 98 | +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
| 99 | +# option that results in lower performance and larger code size. |
| 100 | +ACPPSRC = |
| 101 | + |
| 102 | +# C sources to be compiled in THUMB mode regardless of the global setting. |
| 103 | +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
| 104 | +# option that results in lower performance and larger code size. |
| 105 | +TCSRC = |
| 106 | + |
| 107 | +# C sources to be compiled in THUMB mode regardless of the global setting. |
| 108 | +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
| 109 | +# option that results in lower performance and larger code size. |
| 110 | +TCPPSRC = |
| 111 | + |
| 112 | +# List ASM source files here |
| 113 | +ASMSRC = $(PORTASM) |
| 114 | + |
| 115 | +INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \ |
| 116 | + $(HALINC) $(PLATFORMINC) $(BOARDINC) \ |
| 117 | + $(CHIBIOS)/os/various/devices_lib/accel \ |
| 118 | + $(CHIBIOS)/os/various |
| 119 | + |
| 120 | +# |
| 121 | +# Project, sources and paths |
| 122 | +############################################################################## |
| 123 | + |
| 124 | +############################################################################## |
| 125 | +# Compiler settings |
| 126 | +# |
| 127 | + |
| 128 | +MCU = cortex-m4 |
| 129 | + |
| 130 | +#TRGT = arm-elf- |
| 131 | +TRGT = arm-none-eabi- |
| 132 | +CC = $(TRGT)gcc |
| 133 | +CPPC = $(TRGT)g++ |
| 134 | +# Enable loading with g++ only if you need C++ runtime support. |
| 135 | +# NOTE: You can use C++ even without C++ support if you are careful. C++ |
| 136 | +# runtime support makes code size explode. |
| 137 | +LD = $(TRGT)gcc |
| 138 | +#LD = $(TRGT)g++ |
| 139 | +CP = $(TRGT)objcopy |
| 140 | +AS = $(TRGT)gcc -x assembler-with-cpp |
| 141 | +OD = $(TRGT)objdump |
| 142 | +HEX = $(CP) -O ihex |
| 143 | +BIN = $(CP) -O binary |
| 144 | + |
| 145 | +# ARM-specific options here |
| 146 | +AOPT = |
| 147 | + |
| 148 | +# THUMB-specific options here |
| 149 | +TOPT = -mthumb -DTHUMB |
| 150 | + |
| 151 | +# Define C warning options here |
| 152 | +CWARN = -Wall -Wextra -Wstrict-prototypes |
| 153 | + |
| 154 | +# Define C++ warning options here |
| 155 | +CPPWARN = -Wall -Wextra |
| 156 | + |
| 157 | +# |
| 158 | +# Compiler settings |
| 159 | +############################################################################## |
| 160 | + |
| 161 | +############################################################################## |
| 162 | +# Start of default section |
| 163 | +# |
| 164 | + |
| 165 | +# List all default C defines here, like -D_DEBUG=1 |
| 166 | +DDEFS = |
| 167 | + |
| 168 | +# List all default ASM defines here, like -D_DEBUG=1 |
| 169 | +DADEFS = |
| 170 | + |
| 171 | +# List all default directories to look for include files here |
| 172 | +DINCDIR = |
| 173 | + |
| 174 | +# List the default directory to look for the libraries here |
| 175 | +DLIBDIR = |
| 176 | + |
| 177 | +# List all default libraries here |
| 178 | +DLIBS = |
| 179 | + |
| 180 | +# |
| 181 | +# End of default section |
| 182 | +############################################################################## |
| 183 | + |
| 184 | +############################################################################## |
| 185 | +# Start of user section |
| 186 | +# |
| 187 | + |
| 188 | +# List all user C define here, like -D_DEBUG=1 |
| 189 | +UDEFS = |
| 190 | + |
| 191 | +# Define ASM defines here |
| 192 | +UADEFS = |
| 193 | + |
| 194 | +# List all user directories here |
| 195 | +UINCDIR = |
| 196 | + |
| 197 | +# List the user directory to look for the libraries here |
| 198 | +ULIBDIR = |
| 199 | + |
| 200 | +# List all user libraries here |
| 201 | +ULIBS = |
| 202 | + |
| 203 | +# |
| 204 | +# End of user defines |
| 205 | +############################################################################## |
| 206 | + |
| 207 | +ifeq ($(USE_FPU),yes) |
| 208 | + USE_OPT += -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fsingle-precision-constant |
| 209 | + DDEFS += -DCORTEX_USE_FPU=TRUE |
| 210 | +else |
| 211 | + DDEFS += -DCORTEX_USE_FPU=FALSE |
| 212 | +endif |
| 213 | + |
| 214 | +ifeq ($(USE_FWLIB),yes) |
| 215 | + include $(CHIBIOS)/ext/stm32lib/stm32lib.mk |
| 216 | + CSRC += $(STM32SRC) |
| 217 | + INCDIR += $(STM32INC) |
| 218 | + USE_OPT += -DUSE_STDPERIPH_DRIVER |
| 219 | +endif |
| 220 | + |
| 221 | +include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk |
0 commit comments