############################################################################### Build global options# NOTE: Can be overridden externally.## Compiler options here.ifeq ($(USE_OPT),)USE_OPT = -O2 -ggdb -fomit-frame-pointerendif# C specific options here (added to USE_OPT).ifeq ($(USE_COPT),)USE_COPT =endif# C++ specific options here (added to USE_OPT).ifeq ($(USE_CPPOPT),)USE_CPPOPT = -fno-rttiendif# Enable this if you want the linker to remove unused code and dataifeq ($(USE_LINK_GC),)USE_LINK_GC = yesendif# If enabled, this option allows to compile the application in THUMB mode.ifeq ($(USE_THUMB),)USE_THUMB = yesendif# Enable this if you want to see the full log while compiling.ifeq ($(USE_VERBOSE_COMPILE),)USE_VERBOSE_COMPILE = noendif## Build global options############################################################################################################################################################# Architecture or project specific options## Enable this if you really want to use the STM FWLib.ifeq ($(USE_FWLIB),)USE_FWLIB = noendif## Architecture or project specific options############################################################################################################################################################# Project, sources and paths## Define project name herePROJECT = ch# Imported source files and pathsCHIBIOS = ../..include $(CHIBIOS)/boards/ST_STM32L_DISCOVERY/board.mkinclude $(CHIBIOS)/os/hal/platforms/STM32L1xx/platform.mkinclude $(CHIBIOS)/os/hal/hal.mkinclude $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32L1xx/port.mkinclude $(CHIBIOS)/os/kernel/kernel.mkinclude $(CHIBIOS)/test/test.mk# Define linker script file hereLDSCRIPT= $(PORTLD)/STM32L152xB.ld# C sources that can be compiled in ARM or THUMB mode depending on the global# setting.CSRC = $(PORTSRC) \$(KERNSRC) \$(TESTSRC) \$(HALSRC) \$(PLATFORMSRC) \$(BOARDSRC) \$(CHIBIOS)/os/various/evtimer.c \$(CHIBIOS)/os/various/syscalls.c \main.c# C++ sources that can be compiled in ARM or THUMB mode depending on the global# setting.CPPSRC =# C sources to be compiled in ARM mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.ACSRC =# C++ sources to be compiled in ARM mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.ACPPSRC =# C sources to be compiled in THUMB mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.TCSRC =# C sources to be compiled in THUMB mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.TCPPSRC =# List ASM source files hereASMSRC = $(PORTASM)INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \$(HALINC) $(PLATFORMINC) $(BOARDINC) \$(CHIBIOS)/os/various## Project, sources and paths############################################################################################################################################################# Compiler settings#MCU = cortex-m3#TRGT = arm-elf-TRGT = arm-none-eabi-CC = $(TRGT)gccCPPC = $(TRGT)g++# Enable loading with g++ only if you need C++ runtime support.# NOTE: You can use C++ even without C++ support if you are careful. C++# runtime support makes code size explode.LD = $(TRGT)gcc#LD = $(TRGT)g++CP = $(TRGT)objcopyAS = $(TRGT)gcc -x assembler-with-cppOD = $(TRGT)objdumpHEX = $(CP) -O ihexBIN = $(CP) -O binary# ARM-specific options hereAOPT =# THUMB-specific options hereTOPT = -mthumb -DTHUMB# Define C warning options hereCWARN = -Wall -Wextra -Wstrict-prototypes# Define C++ warning options hereCPPWARN = -Wall -Wextra## Compiler settings############################################################################################################################################################# Start of default section## List all default C defines here, like -D_DEBUG=1DDEFS =# List all default ASM defines here, like -D_DEBUG=1DADEFS =# List all default directories to look for include files hereDINCDIR =# List the default directory to look for the libraries hereDLIBDIR =# List all default libraries hereDLIBS =## End of default section############################################################################################################################################################# Start of user section## List all user C define here, like -D_DEBUG=1UDEFS =# Define ASM defines hereUADEFS =# List all user directories hereUINCDIR =# List the user directory to look for the libraries hereULIBDIR =# List all user libraries hereULIBS =## End of user defines##############################################################################ifeq ($(USE_FWLIB),yes)include $(CHIBIOS)/ext/stm32lib/stm32lib.mkCSRC += $(STM32SRC)INCDIR += $(STM32INC)USE_OPT += -DUSE_STDPERIPH_DRIVERendifinclude $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk