auto-sync
This commit is contained in:
parent
cd5af013ca
commit
94e91a821b
|
@ -4,17 +4,18 @@
|
|||
#
|
||||
|
||||
PROJECT_DIR = .
|
||||
CHIBIOS = chibios
|
||||
|
||||
|
||||
# Compiler options here.
|
||||
ifeq ($(USE_OPT),)
|
||||
# USE_OPT = -O2 -ggdb -std=gnu99 -fomit-frame-pointer -falign-functions=16
|
||||
# USE_OPT = $(RFLAGS) -O1 -fgnu89-inline -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers
|
||||
USE_OPT = $(RFLAGS) -O1 -fgnu89-inline -fomit-frame-pointer -falign-functions=16 -std=gnu99 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers -Werror=type-limits
|
||||
USE_OPT = $(RFLAGS) -O2 -fomit-frame-pointer -falign-functions=16 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers -Werror=type-limits -Wno-error=strict-aliasing -Wno-error=attributes
|
||||
endif
|
||||
|
||||
# C specific options here (added to USE_OPT).
|
||||
ifeq ($(USE_COPT),)
|
||||
USE_COPT =
|
||||
USE_COPT = -fgnu89-inline -std=gnu99
|
||||
endif
|
||||
|
||||
# C++ specific options here (added to USE_OPT).
|
||||
|
@ -27,6 +28,16 @@ ifeq ($(USE_LINK_GC),)
|
|||
USE_LINK_GC = yes
|
||||
endif
|
||||
|
||||
# Linker extra options here.
|
||||
ifeq ($(USE_LDOPT),)
|
||||
USE_LDOPT =
|
||||
endif
|
||||
|
||||
# Enable this if you want link time optimizations (LTO)
|
||||
ifeq ($(USE_LTO),)
|
||||
USE_LTO = no
|
||||
endif
|
||||
|
||||
# If enabled, this option allows to compile the application in THUMB mode.
|
||||
ifeq ($(USE_THUMB),)
|
||||
USE_THUMB = yes
|
||||
|
@ -45,22 +56,13 @@ endif
|
|||
# Architecture or project specific options
|
||||
#
|
||||
|
||||
USE_FPU = yes
|
||||
USE_FPU = softfp
|
||||
|
||||
# Enables the use of FPU on Cortex-M4.
|
||||
# Enable this if you really want to use the STM FWLib.
|
||||
# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
|
||||
ifeq ($(USE_FPU),)
|
||||
USE_FPU = no
|
||||
endif
|
||||
|
||||
# Enable this if you really want to use the STM FWLib.
|
||||
ifeq ($(USE_FWLIB),)
|
||||
USE_FWLIB = no
|
||||
endif
|
||||
|
||||
# List all default C defines here, like -D_DEBUG=1
|
||||
DDEFS =
|
||||
|
||||
#
|
||||
# Architecture or project specific options
|
||||
##############################################################################
|
||||
|
@ -72,19 +74,24 @@ DDEFS =
|
|||
# Define project name here
|
||||
PROJECT = rusefi
|
||||
|
||||
# Imported source files and paths
|
||||
CHIBIOS = chibios
|
||||
#include $(CHIBIOS)/test/test.mk
|
||||
|
||||
#PROJECT_BOARD = OLIMEX_STM32_E407
|
||||
ifneq ($(PROJECT_BOARD),OLIMEX_STM32_E407)
|
||||
PROJECT_BOARD = ST_STM32F4_DISCOVERY
|
||||
endif
|
||||
DDEFS += -D$(PROJECT_BOARD)
|
||||
|
||||
|
||||
# Imported source files and paths
|
||||
include $(CHIBIOS)/boards/$(PROJECT_BOARD)/board.mk
|
||||
include $(CHIBIOS)/os/hal/platforms/STM32F4xx/platform.mk
|
||||
include $(CHIBIOS)/os/hal/hal.mk
|
||||
include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F4xx/port.mk
|
||||
include $(CHIBIOS)/os/kernel/kernel.mk
|
||||
include $(CHIBIOS)/os/various/cpp_wrappers/kernel.mk
|
||||
#include $(CHIBIOS)/os/various/cpp_wrappers/kernel.mk
|
||||
|
||||
include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk
|
||||
include console/tunerstudio/tunerstudio.mk
|
||||
|
@ -206,7 +213,6 @@ INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
|
|||
controllers/core \
|
||||
controllers/math \
|
||||
controllers/trigger
|
||||
|
||||
|
||||
#
|
||||
# Project, sources and paths
|
||||
|
@ -225,11 +231,12 @@ CPPC = $(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++
|
||||
LD = $(TRGT)gcc
|
||||
#LD = $(TRGT)g++
|
||||
CP = $(TRGT)objcopy
|
||||
AS = $(TRGT)gcc -x assembler-with-cpp
|
||||
OD = $(TRGT)objdump
|
||||
SZ = $(TRGT)size
|
||||
HEX = $(CP) -O ihex
|
||||
BIN = $(CP) -O binary
|
||||
|
||||
|
@ -253,6 +260,9 @@ CPPWARN = -Wall -Wextra
|
|||
# Start of default section
|
||||
#
|
||||
|
||||
# List all default C defines here, like -D_DEBUG=1
|
||||
DDEFS =
|
||||
|
||||
# List all default ASM defines here, like -D_DEBUG=1
|
||||
DADEFS =
|
||||
|
||||
|
@ -292,19 +302,5 @@ ULIBS = -lm
|
|||
# End of user defines
|
||||
##############################################################################
|
||||
|
||||
ifeq ($(USE_FPU),yes)
|
||||
USE_OPT += -mfloat-abi=softfp -mfpu=fpv4-sp-d16
|
||||
USE_CPPOPT += -mfloat-abi=softfp -mfpu=fpv4-sp-d16
|
||||
DDEFS += -DCORTEX_USE_FPU=TRUE
|
||||
else
|
||||
DDEFS += -DCORTEX_USE_FPU=FALSE
|
||||
endif
|
||||
|
||||
ifeq ($(USE_FWLIB),yes)
|
||||
include $(CHIBIOS)/ext/stm32lib/stm32lib.mk
|
||||
CSRC += $(STM32SRC)
|
||||
INCDIR += $(STM32INC)
|
||||
USE_OPT += -DUSE_STDPERIPH_DRIVER
|
||||
endif
|
||||
|
||||
include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk
|
||||
RULESPATH = $(CHIBIOS)/os/ports/GCC/ARMCMx
|
||||
include $(RULESPATH)/rules.mk
|
||||
|
|
|
@ -1,5 +1,45 @@
|
|||
# ARM Cortex-Mx common makefile scripts and rules.
|
||||
|
||||
##############################################################################
|
||||
# Processing options coming from the upper Makefile.
|
||||
#
|
||||
|
||||
# Compiler options
|
||||
OPT = $(USE_OPT)
|
||||
COPT = $(USE_COPT)
|
||||
CPPOPT = $(USE_CPPOPT)
|
||||
|
||||
# Garbage collection
|
||||
ifeq ($(USE_LINK_GC),yes)
|
||||
OPT += -ffunction-sections -fdata-sections -fno-common
|
||||
LDOPT := ,--gc-sections
|
||||
else
|
||||
LDOPT :=
|
||||
endif
|
||||
|
||||
# Linker extra options
|
||||
ifneq ($(USE_LDOPT),)
|
||||
LDOPT := $(LDOPT),$(USE_LDOPT)
|
||||
endif
|
||||
|
||||
# Link time optimizations
|
||||
ifeq ($(USE_LTO),yes)
|
||||
OPT += -flto
|
||||
endif
|
||||
|
||||
# FPU-related options
|
||||
ifeq ($(USE_FPU),)
|
||||
USE_FPU = no
|
||||
endif
|
||||
ifneq ($(USE_FPU),no)
|
||||
OPT += -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 -fsingle-precision-constant
|
||||
DDEFS += -DCORTEX_USE_FPU=TRUE
|
||||
DADEFS += -DCORTEX_USE_FPU=TRUE
|
||||
else
|
||||
DDEFS += -DCORTEX_USE_FPU=FALSE
|
||||
DADEFS += -DCORTEX_USE_FPU=FALSE
|
||||
endif
|
||||
|
||||
# Output directory and files
|
||||
ifeq ($(BUILDDIR),)
|
||||
BUILDDIR = build
|
||||
|
@ -10,14 +50,6 @@ endif
|
|||
OUTFILES = $(BUILDDIR)/$(PROJECT).elf $(BUILDDIR)/$(PROJECT).hex \
|
||||
$(BUILDDIR)/$(PROJECT).bin $(BUILDDIR)/$(PROJECT).dmp
|
||||
|
||||
# Automatic compiler options
|
||||
OPT = $(USE_OPT)
|
||||
COPT = $(USE_COPT)
|
||||
CPPOPT = $(USE_CPPOPT)
|
||||
ifeq ($(USE_LINK_GC),yes)
|
||||
OPT += -ffunction-sections -fdata-sections -fno-common
|
||||
endif
|
||||
|
||||
# Source files groups and paths
|
||||
ifeq ($(USE_THUMB),yes)
|
||||
TCSRC += $(CSRC)
|
||||
|
@ -60,12 +92,8 @@ ODFLAGS = -x --syms
|
|||
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
|
||||
ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS)
|
||||
CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS)
|
||||
CPPFLAGS = $(MCFLAGS) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
|
||||
ifeq ($(USE_LINK_GC),yes)
|
||||
LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR)
|
||||
else
|
||||
LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR)
|
||||
endif
|
||||
CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
|
||||
LDFLAGS = $(MCFLAGS) $(OPT) -nostartfiles $(LLIBDIR) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--library-path=$(RULESPATH),--script=$(LDSCRIPT)$(LDOPT)
|
||||
|
||||
# Thumb interwork enabled only if needed because it kills performance.
|
||||
ifneq ($(TSRC),)
|
||||
|
@ -94,6 +122,7 @@ else
|
|||
endif
|
||||
|
||||
# Generate dependency information
|
||||
ASFLAGS += -MD -MP -MF .dep/$(@F).d
|
||||
CFLAGS += -MD -MP -MF .dep/$(@F).d
|
||||
CPPFLAGS += -MD -MP -MF .dep/$(@F).d
|
||||
|
||||
|
@ -113,7 +142,7 @@ $(OBJS): | $(BUILDDIR)
|
|||
$(BUILDDIR) $(OBJDIR) $(LSTDIR):
|
||||
ifneq ($(USE_VERBOSE_COMPILE),yes)
|
||||
@echo Compiler Options
|
||||
@echo $(CPPC) -c $(CPPFLAGS) -I. $(IINCDIR) main.cpp -o main.o -llibstd++
|
||||
@echo $(CC) -c $(CFLAGS) -I. $(IINCDIR) main.c -o main.o
|
||||
@echo
|
||||
endif
|
||||
mkdir -p $(OBJDIR)
|
||||
|
@ -166,7 +195,7 @@ endif
|
|||
|
||||
$(ASMXOBJS) : $(OBJDIR)/%.o : %.S Makefile
|
||||
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
||||
@echo
|
||||
@echo
|
||||
$(CC) -c $(ASXFLAGS) $(TOPT) -I. $(IINCDIR) $< -o $@
|
||||
else
|
||||
@echo Compiling $(<F)
|
||||
|
@ -204,12 +233,16 @@ ifeq ($(USE_VERBOSE_COMPILE),yes)
|
|||
else
|
||||
@echo Creating $@
|
||||
@$(OD) $(ODFLAGS) $< > $@
|
||||
@echo
|
||||
@$(SZ) $<
|
||||
@echo
|
||||
@echo Done
|
||||
endif
|
||||
|
||||
clean:
|
||||
@echo Cleaning
|
||||
-rm -fR .dep $(BUILDDIR)
|
||||
@echo
|
||||
@echo Done
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue