Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 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 | # Enable this if you really want to use the STM FWLib. |
||
| 45 | ifeq ($(USE_FWLIB),) |
||
| 46 | USE_FWLIB = no |
||
| 47 | endif |
||
| 48 | |||
| 49 | # |
||
| 50 | # Architecture or project specific options |
||
| 51 | ############################################################################## |
||
| 52 | |||
| 53 | ############################################################################## |
||
| 54 | # Project, sources and paths |
||
| 55 | # |
||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | # Define project name here |
||
| 60 | PROJECT = ch |
||
| 61 | #define board |
||
| 62 | BOARD = ST_bluePillF103 |
||
| 63 | |||
| 64 | # Imported source files and paths |
||
| 65 | CHIBIOS = ../chibios |
||
| 66 | include $(CHIBIOS)/boards/$(BOARD)/board.mk |
||
| 67 | include $(CHIBIOS)/os/hal/platforms/STM32F1xx/platform.mk |
||
| 68 | include $(CHIBIOS)/os/hal/hal.mk |
||
| 69 | include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F1xx/port.mk |
||
| 70 | include $(CHIBIOS)/os/kernel/kernel.mk |
||
| 71 | include $(CHIBIOS)/test/test.mk |
||
| 72 | #include $(CHIBIOS)/ext/fatfs/fatfs.mk |
||
| 73 | |||
| 74 | # Define linker script file here |
||
| 75 | LDSCRIPT= $(PORTLD)/STM32F103xB.ld |
||
| 76 | |||
| 77 | |||
| 78 | IGNSRC = src/hardware.c |
||
| 79 | IGNINC = inc |
||
| 80 | |||
| 81 | # C sources that can be compiled in ARM or THUMB mode depending on the global |
||
| 82 | # setting. |
||
| 83 | CSRC = $(PORTSRC) \ |
||
| 84 | $(KERNSRC) \ |
||
| 85 | $(TESTSRC) \ |
||
| 86 | $(HALSRC) \ |
||
| 87 | $(PLATFORMSRC) \ |
||
| 88 | $(BOARDSRC) \ |
||
| 89 | $(CHIBIOS)/os/various/shell.c \ |
||
| 90 | $(CHIBIOS)/os/various/syscalls.c \ |
||
| 91 | $(CHIBIOS)/os/various/chprintf.c \ |
||
| 92 | $(IGNSRC) \ |
||
| 93 | main.c |
||
| 94 | |||
| 95 | # C++ sources that can be compiled in ARM or THUMB mode depending on the global |
||
| 96 | # setting. |
||
| 97 | CPPSRC = |
||
| 98 | |||
| 99 | # C sources to be compiled in ARM mode regardless of the global setting. |
||
| 100 | # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
||
| 101 | # option that results in lower performance and larger code size. |
||
| 102 | ACSRC = |
||
| 103 | |||
| 104 | # C++ sources to be compiled in ARM mode regardless of the global setting. |
||
| 105 | # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
||
| 106 | # option that results in lower performance and larger code size. |
||
| 107 | ACPPSRC = |
||
| 108 | |||
| 109 | # C sources to be compiled in THUMB mode regardless of the global setting. |
||
| 110 | # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
||
| 111 | # option that results in lower performance and larger code size. |
||
| 112 | TCSRC = |
||
| 113 | |||
| 114 | # C sources to be compiled in THUMB mode regardless of the global setting. |
||
| 115 | # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
||
| 116 | # option that results in lower performance and larger code size. |
||
| 117 | TCPPSRC = |
||
| 118 | |||
| 119 | # List ASM source files here |
||
| 120 | ASMSRC = $(PORTASM) |
||
| 121 | |||
| 122 | INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \ |
||
| 123 | $(HALINC) $(PLATFORMINC) $(BOARDINC) \ |
||
| 124 | $(IGNINC) \ |
||
| 125 | $(CHIBIOS)/os/various |
||
| 126 | |||
| 127 | # |
||
| 128 | # Project, sources and paths |
||
| 129 | ############################################################################## |
||
| 130 | |||
| 131 | ############################################################################## |
||
| 132 | # Compiler settings |
||
| 133 | # |
||
| 134 | |||
| 135 | MCU = cortex-m3 |
||
| 136 | |||
| 137 | #TRGT = arm-elf- |
||
| 138 | TRGT = arm-none-eabi- |
||
| 139 | CC = $(TRGT)gcc |
||
| 140 | CPPC = $(TRGT)g++ |
||
| 141 | # Enable loading with g++ only if you need C++ runtime support. |
||
| 142 | # NOTE: You can use C++ even without C++ support if you are careful. C++ |
||
| 143 | # runtime support makes code size explode. |
||
| 144 | LD = $(TRGT)gcc |
||
| 145 | #LD = $(TRGT)g++ |
||
| 146 | CP = $(TRGT)objcopy |
||
| 147 | AS = $(TRGT)gcc -x assembler-with-cpp |
||
| 148 | OD = $(TRGT)objdump |
||
| 149 | HEX = $(CP) -O ihex |
||
| 150 | BIN = $(CP) -O binary |
||
| 151 | |||
| 152 | # ARM-specific options here |
||
| 153 | AOPT = |
||
| 154 | |||
| 155 | # THUMB-specific options here |
||
| 156 | TOPT = -mthumb -DTHUMB |
||
| 157 | |||
| 158 | # Define C warning options here |
||
| 159 | CWARN = -Wall -Wextra -Wstrict-prototypes |
||
| 160 | |||
| 161 | # Define C++ warning options here |
||
| 162 | CPPWARN = -Wall -Wextra |
||
| 163 | |||
| 164 | # |
||
| 165 | # Compiler settings |
||
| 166 | ############################################################################## |
||
| 167 | |||
| 168 | ############################################################################## |
||
| 169 | # Start of default section |
||
| 170 | # |
||
| 171 | |||
| 172 | # List all default C defines here, like -D_DEBUG=1 |
||
| 173 | DDEFS = -DSTDOUT_SD=SD2 -DSTDIN_SD=SD2 |
||
| 174 | |||
| 175 | # List all default ASM defines here, like -D_DEBUG=1 |
||
| 176 | DADEFS = |
||
| 177 | |||
| 178 | # List all default directories to look for include files here |
||
| 179 | DINCDIR = |
||
| 180 | |||
| 181 | # List the default directory to look for the libraries here |
||
| 182 | DLIBDIR = |
||
| 183 | |||
| 184 | # List all default libraries here |
||
| 185 | DLIBS = |
||
| 186 | |||
| 187 | # |
||
| 188 | # End of default section |
||
| 189 | ############################################################################## |
||
| 190 | |||
| 191 | ############################################################################## |
||
| 192 | # Start of user section |
||
| 193 | # |
||
| 194 | |||
| 195 | # List all user C define here, like -D_DEBUG=1 |
||
| 196 | UDEFS = |
||
| 197 | |||
| 198 | # Define ASM defines here |
||
| 199 | UADEFS = |
||
| 200 | |||
| 201 | # List all user directories here |
||
| 202 | UINCDIR = |
||
| 203 | |||
| 204 | # List the user directory to look for the libraries here |
||
| 205 | ULIBDIR = |
||
| 206 | |||
| 207 | # List all user libraries here |
||
| 208 | ULIBS = |
||
| 209 | |||
| 210 | # |
||
| 211 | # End of user defines |
||
| 212 | ############################################################################## |
||
| 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 |