2015-07-10 06:01:56 -07:00
|
|
|
##############################################################################
|
|
|
|
# Build global options
|
|
|
|
# NOTE: Can be overridden externally.
|
|
|
|
#
|
|
|
|
|
2019-09-21 14:11:32 -07:00
|
|
|
#
|
|
|
|
# As of Sep 2019, this is known to compile on Linux
|
|
|
|
# in my case I had to
|
|
|
|
# sudo apt-get install gcc-multilib g++-multilib
|
|
|
|
#
|
|
|
|
# todo: automatically execute that command same as we automatically fetch submodules?
|
|
|
|
#
|
|
|
|
|
|
|
|
|
2018-12-22 22:54:14 -08:00
|
|
|
|
2019-03-20 05:45:15 -07:00
|
|
|
CHIBIOS = ../firmware/ChibiOS
|
2018-12-22 22:54:14 -08:00
|
|
|
RULESPATH = $(CHIBIOS)/os/common/startup/SIMIA32/compilers/GCC
|
|
|
|
RULESFILE = $(RULESPATH)/rules.mk
|
|
|
|
|
|
|
|
include ../firmware/rusefi.mk
|
2018-12-13 18:32:50 -08:00
|
|
|
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
# Compiler options here.
|
|
|
|
ifeq ($(USE_OPT),)
|
2017-03-29 15:29:36 -07:00
|
|
|
# this config if debugging is needed, but the binary is about 50M
|
2017-03-29 20:21:04 -07:00
|
|
|
# USE_OPT = -Wall -ggdb -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 -Wno-error=write-strings -Wno-error=strict-aliasing
|
2019-02-11 21:18:15 -08:00
|
|
|
# USE_OPT = -Wall -O0 -ggdb -g3 -Wno-error=implicit-fallthrough -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 -Wno-error=write-strings
|
2017-03-29 15:29:36 -07:00
|
|
|
# this config producec a smaller binary file
|
2018-11-16 05:42:13 -08:00
|
|
|
# 7.3 compiler would want -Wno-error=implicit-fallthrough while 6.4 does not know about it
|
|
|
|
# see https://github.com/rusefi/rusefi/issues/517
|
2019-04-14 15:35:39 -07:00
|
|
|
USE_OPT = -Wall -O2 -Wno-error=implicit-fallthrough -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 -Werror=missing-field-initializers -Wno-error=write-strings -Wno-error=strict-aliasing
|
2017-03-29 15:29:36 -07:00
|
|
|
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
else
|
|
|
|
USE_OPT += -m32
|
|
|
|
endif
|
2015-07-10 06:01:56 -07:00
|
|
|
endif
|
|
|
|
|
2019-04-20 18:57:00 -07:00
|
|
|
ifeq ($(CCACHE_DIR),)
|
|
|
|
$(info No CCACHE_DIR)
|
|
|
|
else
|
|
|
|
$(info CCACHE_DIR is ${CCACHE_DIR})
|
|
|
|
CCPREFIX=ccache
|
|
|
|
endif
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
# C specific options here (added to USE_OPT).
|
|
|
|
ifeq ($(USE_COPT),)
|
2018-01-30 20:22:07 -08:00
|
|
|
USE_COPT = -std=gnu99
|
2015-07-10 06:01:56 -07:00
|
|
|
endif
|
|
|
|
|
|
|
|
# C++ specific options here (added to USE_OPT).
|
|
|
|
ifeq ($(USE_CPPOPT),)
|
2019-01-06 18:47:40 -08:00
|
|
|
USE_CPPOPT = -std=c++17 -Wno-register -fno-rtti
|
2017-03-23 17:59:14 -07:00
|
|
|
endif
|
2016-05-30 16:02:00 -07:00
|
|
|
|
2017-03-29 14:17:39 -07:00
|
|
|
# Enable this if you want the linker to remove unused code and data.
|
2015-07-10 06:01:56 -07:00
|
|
|
ifeq ($(USE_LINK_GC),)
|
|
|
|
USE_LINK_GC = yes
|
|
|
|
endif
|
|
|
|
|
2017-03-29 14:17:39 -07:00
|
|
|
# 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
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
# Enable this if you want to see the full log while compiling.
|
|
|
|
ifeq ($(USE_VERBOSE_COMPILE),)
|
2017-03-29 14:17:39 -07:00
|
|
|
USE_VERBOSE_COMPILE = no
|
|
|
|
endif
|
|
|
|
|
|
|
|
# If enabled, this option makes the build process faster by not compiling
|
|
|
|
# modules not used in the current configuration.
|
|
|
|
ifeq ($(USE_SMART_BUILD),)
|
|
|
|
USE_SMART_BUILD = yes
|
2015-07-10 06:01:56 -07:00
|
|
|
endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build global options
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Architecture or project specific options
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Architecture or project specific options
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Project, sources and paths
|
|
|
|
#
|
2017-03-29 14:17:39 -07:00
|
|
|
|
2017-03-23 17:59:14 -07:00
|
|
|
# Define project name here
|
2015-07-10 06:01:56 -07:00
|
|
|
PROJECT = rusefi_simulator
|
2017-03-23 17:59:14 -07:00
|
|
|
PROJECT_DIR = ../firmware
|
2017-03-29 14:17:39 -07:00
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
# Imported source files and paths
|
2017-03-29 14:17:39 -07:00
|
|
|
|
|
|
|
# Startup files.
|
|
|
|
# HAL-OSAL files (optional).
|
2017-03-23 17:59:14 -07:00
|
|
|
include $(CHIBIOS)/os/hal/hal.mk
|
2017-03-29 14:17:39 -07:00
|
|
|
include $(CHIBIOS)/os/hal/boards/simulator/board.mk
|
2017-03-23 17:59:14 -07:00
|
|
|
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
|
2017-03-29 14:17:39 -07:00
|
|
|
# RTOS files (optional).
|
2017-03-23 17:59:14 -07:00
|
|
|
include $(CHIBIOS)/os/rt/rt.mk
|
2018-01-23 18:17:30 -08:00
|
|
|
include $(CHIBIOS)/os/common/ports/SIMIA32/compilers/GCC/port.mk
|
2017-03-29 14:17:39 -07:00
|
|
|
# Other files (optional).
|
2017-03-23 17:59:14 -07:00
|
|
|
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
include ${CHIBIOS}/os/hal/ports/simulator/win32/platform.mk
|
|
|
|
else
|
2017-03-31 01:36:51 -07:00
|
|
|
include ${CHIBIOS}/os/hal/ports/simulator/posix/platform.mk
|
2017-03-23 17:59:14 -07:00
|
|
|
endif
|
|
|
|
|
2019-11-19 17:05:12 -08:00
|
|
|
include $(PROJECT_DIR)/console/binary/tunerstudio.mk
|
|
|
|
include $(PROJECT_DIR)/console/console.mk
|
2015-07-10 06:01:56 -07:00
|
|
|
include $(PROJECT_DIR)/config/engines/engines.mk
|
2018-10-30 05:42:36 -07:00
|
|
|
include $(PROJECT_DIR)/controllers/controllers.mk
|
2015-07-10 06:01:56 -07:00
|
|
|
include $(PROJECT_DIR)/controllers/algo/algo.mk
|
|
|
|
include $(PROJECT_DIR)/controllers/core/core.mk
|
|
|
|
include $(PROJECT_DIR)/controllers/math/math.mk
|
|
|
|
include $(PROJECT_DIR)/controllers/sensors/sensors.mk
|
|
|
|
include $(PROJECT_DIR)/controllers/trigger/trigger.mk
|
|
|
|
include $(PROJECT_DIR)/controllers/system/system.mk
|
|
|
|
include $(PROJECT_DIR)/development/development.mk
|
2017-04-21 10:35:06 -07:00
|
|
|
include $(PROJECT_DIR)/hw_layer/hw_layer.mk
|
2019-04-02 20:19:21 -07:00
|
|
|
include $(PROJECT_DIR)/hw_layer/sensors/sensors.mk
|
2019-11-19 17:05:12 -08:00
|
|
|
include $(PROJECT_DIR)/init/init.mk
|
|
|
|
include $(PROJECT_DIR)/util/util.mk
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
# C sources that can be compiled in ARM or THUMB mode depending on the global
|
|
|
|
# setting.
|
2017-03-23 17:59:14 -07:00
|
|
|
CSRC = ${PORTSRC} \
|
|
|
|
${KERNSRC} \
|
|
|
|
${HALSRC} \
|
|
|
|
${PLATFORMSRC} \
|
|
|
|
$(SYSTEMSRC) \
|
|
|
|
$(CONSOLESRC) \
|
|
|
|
$(CONTROLLERS_ALGO_SRC) \
|
|
|
|
$(CONTROLLERS_CORE_SRC) \
|
|
|
|
$(CONTROLLERS_SENSORS_SRC) \
|
|
|
|
$(ENGINES_SRC) \
|
|
|
|
$(BOARDSRC) \
|
|
|
|
$(CHIBIOS)/os/hal/lib/streams/memstreams.c \
|
|
|
|
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \
|
|
|
|
$(UTILSRC) \
|
|
|
|
main.c
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
|
|
|
# setting.
|
|
|
|
CPPSRC = $(UTILSRC_CPP) \
|
|
|
|
$(CONTROLLERS_ALGO_SRC_CPP) \
|
2018-10-30 05:42:36 -07:00
|
|
|
$(CONTROLLERS_SRC_CPP) \
|
2015-07-10 06:01:56 -07:00
|
|
|
$(PROJECT_DIR)/development/sensor_chart.cpp \
|
2017-06-05 19:44:42 -07:00
|
|
|
$(PROJECT_DIR)/development/trigger_emulator.cpp \
|
2019-01-03 21:16:08 -08:00
|
|
|
$(HW_LAYER_EMS_CPP) \
|
2019-03-29 06:40:43 -07:00
|
|
|
$(PROJECT_DIR)/hw_layer/sensors/cj125.cpp \
|
2015-07-10 06:01:56 -07:00
|
|
|
$(TRIGGER_SRC_CPP) \
|
|
|
|
$(TRIGGER_DECODERS_SRC_CPP) \
|
|
|
|
$(SYSTEMSRC_CPP) \
|
|
|
|
$(TUNERSTUDIO_SRC_CPP) \
|
|
|
|
$(CONSOLE_SRC_CPP) \
|
2019-09-21 12:33:13 -07:00
|
|
|
$(INIT_SRC_CPP) \
|
2015-07-10 06:01:56 -07:00
|
|
|
$(CONTROLLERS_SENSORS_SRC_CPP) \
|
|
|
|
$(CONTROLLERS_CORE_SRC_CPP) \
|
|
|
|
$(CONTROLLERS_MATH_SRC_CPP) \
|
|
|
|
$(DEV_SIMULATOR_SRC_CPP) \
|
|
|
|
$(ENGINES_SRC_CPP) \
|
2017-03-23 17:59:14 -07:00
|
|
|
simulator/rusEfiFunctionalTest.cpp \
|
|
|
|
simulator/framework.cpp \
|
|
|
|
simulator/boards.cpp \
|
2015-07-10 06:01:56 -07:00
|
|
|
$(TEST_SRC_CPP)
|
2017-03-23 17:59:14 -07:00
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
# List ASM source files here
|
|
|
|
ASMSRC = $(PORTASM)
|
|
|
|
|
|
|
|
INCDIR = . \
|
2018-01-23 18:17:30 -08:00
|
|
|
$(CHIBIOS)/os/license \
|
2017-03-23 17:59:14 -07:00
|
|
|
$(PORTINC) \
|
|
|
|
$(KERNINC) \
|
|
|
|
$(OSALINC) \
|
|
|
|
$(HALINC) \
|
|
|
|
$(PLATFORMINC) \
|
|
|
|
$(BOARDINC) \
|
2019-03-31 13:33:16 -07:00
|
|
|
$(UTIL_INC) \
|
2019-09-21 12:33:13 -07:00
|
|
|
$(PROJECT_DIR)/init \
|
2017-03-23 17:59:14 -07:00
|
|
|
$(PROJECT_DIR)/console \
|
|
|
|
$(PROJECT_DIR)/console/binary \
|
|
|
|
$(PROJECT_DIR)/console/fl_binary \
|
|
|
|
$(PROJECT_DIR)/config/engines \
|
|
|
|
$(PROJECT_DIR)/ext_algo \
|
|
|
|
$(PROJECT_DIR)/controllers \
|
2019-04-13 08:22:40 -07:00
|
|
|
$(HW_LAYER_DRIVERS_INC) \
|
2017-07-22 17:19:41 -07:00
|
|
|
$(PROJECT_DIR)/hw_layer \
|
2017-03-23 17:59:14 -07:00
|
|
|
$(PROJECT_DIR)/hw_layer/algo \
|
2019-04-02 20:19:21 -07:00
|
|
|
$(HW_SENSORS_INC) \
|
2019-11-19 17:05:12 -08:00
|
|
|
$(CONTROLLERS_INC) \
|
|
|
|
$(DEVELOPMENT_DIR) \
|
|
|
|
$(PROJECT_DIR)/controllers/sensors \
|
|
|
|
$(PROJECT_DIR)/controllers/sensors/converters \
|
2017-03-23 17:59:14 -07:00
|
|
|
${CHIBIOS}/os/various \
|
|
|
|
$(CHIBIOS)/os/hal/lib/streams \
|
|
|
|
simulator
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2017-03-29 14:17:39 -07:00
|
|
|
# List ASM source files here
|
|
|
|
ASMSRC =
|
|
|
|
ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
#
|
|
|
|
# Project, sources and paths
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Compiler settings
|
|
|
|
#
|
|
|
|
|
|
|
|
ifeq ($(OS),Windows_NT)
|
2019-08-26 18:56:10 -07:00
|
|
|
# ChibiOS seem to require 32 bit compiler at least on Windows
|
2017-03-31 18:44:56 -07:00
|
|
|
# base 32-bit Cygwin is needed with mingw64 32-bit version
|
2017-03-31 10:28:52 -07:00
|
|
|
# Cygwin64 would not debug if used with mingw64 32-bit version
|
2019-02-11 21:18:15 -08:00
|
|
|
# 32 bit GDB available at http://www.equation.com/servlet/equation.cmd?fa=gdb
|
2016-07-04 20:03:06 -07:00
|
|
|
|
|
|
|
TRGT = i686-w64-mingw32-
|
2015-07-10 06:01:56 -07:00
|
|
|
else
|
|
|
|
TRGT =
|
|
|
|
endif
|
|
|
|
|
2019-04-20 18:57:00 -07:00
|
|
|
CC = $(CCPREFIX) $(TRGT)gcc
|
|
|
|
CPPC = $(CCPREFIX) $(TRGT)g++
|
2015-07-10 06:01:56 -07:00
|
|
|
# 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.
|
2017-03-29 20:59:59 -07:00
|
|
|
#LD = $(TRGT)gcc
|
|
|
|
LD = $(TRGT)g++
|
2015-07-10 06:01:56 -07:00
|
|
|
CP = $(TRGT)objcopy
|
|
|
|
AS = $(TRGT)gcc -x assembler-with-cpp
|
2017-03-29 14:17:39 -07:00
|
|
|
AR = $(TRGT)ar
|
2015-07-10 06:01:56 -07:00
|
|
|
OD = $(TRGT)objdump
|
2017-03-29 14:17:39 -07:00
|
|
|
SZ = $(TRGT)size
|
2015-07-10 06:01:56 -07:00
|
|
|
BIN = $(CP) -O binary
|
2017-03-29 14:17:39 -07:00
|
|
|
COV = gcov
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
# Define C warning options here
|
2017-03-29 14:17:39 -07:00
|
|
|
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
# Define C++ warning options here
|
2017-03-29 14:17:39 -07:00
|
|
|
CPPWARN = -Wall -Wextra -Wundef
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#
|
|
|
|
# Compiler settings
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Start of user section
|
|
|
|
#
|
|
|
|
|
|
|
|
# List all user C define here, like -D_DEBUG=1
|
2017-03-23 17:59:14 -07:00
|
|
|
UDEFS = -DSIMULATOR
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
# Define ASM defines here
|
|
|
|
UADEFS =
|
|
|
|
|
|
|
|
# List all user directories here
|
|
|
|
UINCDIR =
|
|
|
|
|
|
|
|
# List the user directory to look for the libraries here
|
|
|
|
ULIBDIR =
|
|
|
|
|
|
|
|
# List all user libraries here
|
2017-03-31 01:36:51 -07:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2017-03-31 06:32:47 -07:00
|
|
|
ULIBS = -lws2_32 -static
|
2017-03-31 01:36:51 -07:00
|
|
|
else
|
|
|
|
ULIBS =
|
|
|
|
endif
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#
|
|
|
|
# End of user defines
|
|
|
|
##############################################################################
|
|
|
|
|
2017-03-29 14:17:39 -07:00
|
|
|
include $(RULESPATH)/rules.mk
|