fome-fw/simulator/Makefile

301 lines
7.5 KiB
Makefile
Raw Permalink Normal View History

2017-04-10 07:00:42 -07:00
##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#
#
# 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
2024-02-22 10:58:03 -08:00
#
# todo: automatically execute that command same as we automatically fetch submodules?
2024-02-22 10:58:03 -08:00
#
2018-12-22 22:54:14 -08:00
2019-03-20 05:45:15 -07:00
CHIBIOS = ../firmware/ChibiOS
2021-07-05 08:36:23 -07:00
CHIBIOS_CONTRIB= ../firmware/ChibiOS-Contrib
2018-12-22 22:54:14 -08:00
RULESPATH = $(CHIBIOS)/os/common/startup/SIMIA32/compilers/GCC
RULESFILE = $(RULESPATH)/rules.mk
PROJECT_CPU=simulator
GENERATED_DIR = $(PROJECT_DIR)/generated
2018-12-22 22:54:14 -08:00
include ../firmware/rusefi.mk
2023-11-01 16:42:12 -07:00
include ../firmware/rusefi_rules.mk
2019-12-02 07:26:16 -08:00
# Configure precompiled header
PCH_DIR = $(PROJECT_DIR)/pch
PCHSRC = $(PCH_DIR)/pch.h
PCHSUB = simulator
2020-09-07 09:09:39 -07:00
# used by USE_SMART_BUILD
CONFDIR = .
2018-12-13 18:32:50 -08:00
ifneq ($(OS),Windows_NT)
SANITIZE = yes
else
SANITIZE = no
endif
2018-12-13 18:32:50 -08:00
2017-04-10 07:00:42 -07:00
# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -Wall -Wno-error=implicit-fallthrough -Wno-error=write-strings -Wno-error=strict-aliasing
# If you would like to debug the simulator, swap which of these lines is commented. It's commented because debug info causes a 10-15x increase in binary size.
USE_OPT += -O2
# USE_OPT += -O0 -g
2017-04-10 07:00:42 -07:00
ifeq ($(OS),Windows_NT)
USE_OPT += -DEFI_SIM_IS_WINDOWS=1
else
USE_OPT += -m32 -DEFI_SIM_IS_WINDOWS=0
endif
2017-04-10 07:00:42 -07:00
endif
# See explanation in main firmware Makefile for these three defines
USE_OPT += $(RUSEFI_OPT) -DEFI_UNIT_TEST=0 -DEFI_PROD_CODE=0 -DEFI_SIMULATOR=1
2019-12-02 07:26:16 -08:00
2024-01-17 16:15:09 -08:00
# define hardwares, but we aren't any of them
USE_OPT += -DHW_MICRO_RUSEFI=0 -DHW_PROTEUS=0 -DHW_FRANKENSO=0 -DHW_HELLEN=0
2024-01-17 15:02:09 -08:00
# Enable address sanitizer, but not on Windows since x86_64-w64-mingw32-g++ doesn't support it.
ifeq ($(SANITIZE),yes)
USE_OPT += -fsanitize=address
endif
2017-04-10 07:00:42 -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
2017-04-10 07:00:42 -07:00
endif
# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -std=c++2a -Wno-register -fno-rtti
2017-04-10 07:00:42 -07:00
endif
2023-11-01 15:37:00 -07:00
USE_CPPOPT += $(RUSEFI_CPPOPT)
2017-04-10 07:00:42 -07:00
# Enable this if you want the linker to remove unused code and data.
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
# Linker extra options here.
ifeq ($(USE_LDOPT),)
2024-02-22 10:58:03 -08:00
USE_LDOPT =
2017-04-10 07:00:42 -07:00
endif
# Enable this if you want link time optimizations (LTO)
ifeq ($(USE_LTO),)
USE_LTO = no
endif
# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
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),)
2021-02-24 18:55:51 -08:00
USE_SMART_BUILD = no
2017-04-10 07:00:42 -07:00
endif
#
# Build global options
##############################################################################
##############################################################################
# Architecture or project specific options
#
#
# Architecture or project specific options
##############################################################################
##############################################################################
# Project, sources and paths
#
# Define project name here
Use github actions to build and upload bundles (#1583) * add env var to skip upload * remove checking from compile.bat * working on push.yaml * finish sorting * progress * rename push to builds * rename push to builds * Add skip upload env var * fix pull_request name * fixed typo and changed name * fixed indentation and runs-on * try different env var setup * add nucleos and switch to underscore * add quotes * remove boards that were commented * remove boards that were commented * fix project board name * fixed variable name * add ini-file and console-settings * try installing gcc-multilib first * Install g++-multilib as well * remove unnecessary export * fixed exit numbers * change to different env setup * add simulator and console compilation to board bundles * changed OS and added linux simulator build * add checkout and missing colon * add gcc-multilib installes * Install mingw * fixed install * remove mingw from linux sim and call compile directly * change directory * moved envs to command * debug ls * debug ls * set ftp vars * add makefile debug info * removed batchecks * redirect stdout to easier see orrs * change name * remove redirect, add file inpection * Add conditional project name * Try software upgrade * missing char * update ine files * try quotes * add escapes * add quotes * add escapes and quotes * remove quotes and escapes * remove software upgrade * ignore test 2 * update apt * like this then * forgot import * fix case * remove RUSEFI_SKIP_UPLOAD and check RUSEFI_FTP_SERVER instead * break workflow back apart * upload simulator artifact * fixed operator * update apt * change paths * Update build-firmware.yaml * move update bundle to artifacts * fix var name * Install ncftp * set env vars conditionally * remove check so zips are created * try things the github way and copy to primary * re-enable test * missing space
2020-07-08 08:10:24 -07:00
ifeq ($(OS),Windows_NT)
2023-03-15 22:26:49 -07:00
PROJECT = fome_simulator.exe
Use github actions to build and upload bundles (#1583) * add env var to skip upload * remove checking from compile.bat * working on push.yaml * finish sorting * progress * rename push to builds * rename push to builds * Add skip upload env var * fix pull_request name * fixed typo and changed name * fixed indentation and runs-on * try different env var setup * add nucleos and switch to underscore * add quotes * remove boards that were commented * remove boards that were commented * fix project board name * fixed variable name * add ini-file and console-settings * try installing gcc-multilib first * Install g++-multilib as well * remove unnecessary export * fixed exit numbers * change to different env setup * add simulator and console compilation to board bundles * changed OS and added linux simulator build * add checkout and missing colon * add gcc-multilib installes * Install mingw * fixed install * remove mingw from linux sim and call compile directly * change directory * moved envs to command * debug ls * debug ls * set ftp vars * add makefile debug info * removed batchecks * redirect stdout to easier see orrs * change name * remove redirect, add file inpection * Add conditional project name * Try software upgrade * missing char * update ine files * try quotes * add escapes * add quotes * add escapes and quotes * remove quotes and escapes * remove software upgrade * ignore test 2 * update apt * like this then * forgot import * fix case * remove RUSEFI_SKIP_UPLOAD and check RUSEFI_FTP_SERVER instead * break workflow back apart * upload simulator artifact * fixed operator * update apt * change paths * Update build-firmware.yaml * move update bundle to artifacts * fix var name * Install ncftp * set env vars conditionally * remove check so zips are created * try things the github way and copy to primary * re-enable test * missing space
2020-07-08 08:10:24 -07:00
else
2023-03-15 22:26:49 -07:00
PROJECT = fome_simulator
Use github actions to build and upload bundles (#1583) * add env var to skip upload * remove checking from compile.bat * working on push.yaml * finish sorting * progress * rename push to builds * rename push to builds * Add skip upload env var * fix pull_request name * fixed typo and changed name * fixed indentation and runs-on * try different env var setup * add nucleos and switch to underscore * add quotes * remove boards that were commented * remove boards that were commented * fix project board name * fixed variable name * add ini-file and console-settings * try installing gcc-multilib first * Install g++-multilib as well * remove unnecessary export * fixed exit numbers * change to different env setup * add simulator and console compilation to board bundles * changed OS and added linux simulator build * add checkout and missing colon * add gcc-multilib installes * Install mingw * fixed install * remove mingw from linux sim and call compile directly * change directory * moved envs to command * debug ls * debug ls * set ftp vars * add makefile debug info * removed batchecks * redirect stdout to easier see orrs * change name * remove redirect, add file inpection * Add conditional project name * Try software upgrade * missing char * update ine files * try quotes * add escapes * add quotes * add escapes and quotes * remove quotes and escapes * remove software upgrade * ignore test 2 * update apt * like this then * forgot import * fix case * remove RUSEFI_SKIP_UPLOAD and check RUSEFI_FTP_SERVER instead * break workflow back apart * upload simulator artifact * fixed operator * update apt * change paths * Update build-firmware.yaml * move update bundle to artifacts * fix var name * Install ncftp * set env vars conditionally * remove check so zips are created * try things the github way and copy to primary * re-enable test * missing space
2020-07-08 08:10:24 -07:00
endif
2017-04-10 07:00:42 -07:00
PROJECT_DIR = ../firmware
2024-01-17 15:48:42 -08:00
DDEFS += -DSHORT_BOARD_NAME=$(SHORT_BOARD_NAME)
2017-04-10 07:00:42 -07:00
# Imported source files and paths
# Configure libfirmware Paths/Includes
RUSEFI_LIB = $(PROJECT_DIR)/libfirmware
include $(RUSEFI_LIB)/util/util.mk
include $(RUSEFI_LIB)/pt2001/pt2001.mk
# Licensing files.
include $(CHIBIOS)/os/license/license.mk
2017-04-10 07:00:42 -07:00
# Startup files.
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/boards/simulator/board.mk
include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
2017-04-10 07:00:42 -07:00
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/SIMIA32/compilers/GCC/port.mk
2017-04-10 07:00:42 -07:00
# Other files (optional).
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
#include $(CHIBIOS)/os/various/cpp_wrappers/chcpp.mk
2017-04-10 07:00:42 -07:00
ifeq ($(OS),Windows_NT)
include ${CHIBIOS}/os/hal/ports/simulator/win32/platform.mk
else
include ${CHIBIOS}/os/hal/ports/simulator/posix/platform.mk
endif
include $(PROJECT_DIR)/console/binary/tunerstudio.mk
include $(PROJECT_DIR)/console/console.mk
2022-01-06 16:02:35 -08:00
include $(PROJECT_DIR)/common.mk
include $(PROJECT_DIR)/controllers/modules/modules.mk
2017-04-10 07:00:42 -07:00
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(ALLCSRC) \
$(RUSEFI_LIB_C)
2017-04-10 07:00:42 -07:00
2017-04-10 07:00:42 -07:00
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC = $(ALLCPPSRC) \
$(CHIBIOS)/os/various/cpp_wrappers/ch.cpp \
$(PROJECT_DIR)/development/sensor_chart.cpp \
$(HW_LAYER_DRIVERS_CPP) \
$(HW_LAYER_DRIVERS_CORE_CPP) \
$(CONSOLE_SRC_CPP) \
$(DEV_SIMULATOR_SRC_CPP) \
simulator/rusEfiFunctionalTest.cpp \
simulator/can/hal_can_lld.cpp \
simulator/framework.cpp \
simulator/system/signal_executor_sleep.cpp \
simulator/boards.cpp \
$(TEST_SRC_CPP) \
$(MODULES_CPPSRC) \
$(RUSEFI_LIB_CPP) \
main.cpp
2017-04-10 07:00:42 -07:00
# List ASM source files here
ASMSRC = $(PORTASM)
INCDIR = . \
$(PCH_DIR) \
$(ALLINC) \
$(MODULES_INC) \
$(CHIBIOS)/os/various/cpp_wrappers \
$(PROJECT_DIR)/hw_layer/drivers/can \
${CHIBIOS}/os/various \
$(CHIBIOS)/os/hal/lib/streams \
$(GENERATED_DIR) \
$(RUSEFI_LIB_INC) \
simulator/system \
simulator/can \
simulator
2017-04-10 07:00:42 -07:00
# List ASM source files here
ASMSRC =
ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
#
# Project, sources and paths
##############################################################################
##############################################################################
# Compiler settings
#
Use github actions to build and upload bundles (#1583) * add env var to skip upload * remove checking from compile.bat * working on push.yaml * finish sorting * progress * rename push to builds * rename push to builds * Add skip upload env var * fix pull_request name * fixed typo and changed name * fixed indentation and runs-on * try different env var setup * add nucleos and switch to underscore * add quotes * remove boards that were commented * remove boards that were commented * fix project board name * fixed variable name * add ini-file and console-settings * try installing gcc-multilib first * Install g++-multilib as well * remove unnecessary export * fixed exit numbers * change to different env setup * add simulator and console compilation to board bundles * changed OS and added linux simulator build * add checkout and missing colon * add gcc-multilib installes * Install mingw * fixed install * remove mingw from linux sim and call compile directly * change directory * moved envs to command * debug ls * debug ls * set ftp vars * add makefile debug info * removed batchecks * redirect stdout to easier see orrs * change name * remove redirect, add file inpection * Add conditional project name * Try software upgrade * missing char * update ine files * try quotes * add escapes * add quotes * add escapes and quotes * remove quotes and escapes * remove software upgrade * ignore test 2 * update apt * like this then * forgot import * fix case * remove RUSEFI_SKIP_UPLOAD and check RUSEFI_FTP_SERVER instead * break workflow back apart * upload simulator artifact * fixed operator * update apt * change paths * Update build-firmware.yaml * move update bundle to artifacts * fix var name * Install ncftp * set env vars conditionally * remove check so zips are created * try things the github way and copy to primary * re-enable test * missing space
2020-07-08 08:10:24 -07:00
$(info OS is [${OS}])
2017-04-10 07:00:42 -07:00
ifeq ($(OS),Windows_NT)
2019-08-26 18:56:10 -07:00
# ChibiOS seem to require 32 bit compiler at least on Windows
2024-02-22 10:58:03 -08:00
# base 32-bit Cygwin is needed with mingw64 32-bit version
2017-04-10 07:00:42 -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
2017-04-10 07:00:42 -07:00
TRGT = i686-w64-mingw32-
else
2024-02-22 10:58:03 -08:00
TRGT =
2017-04-10 07:00:42 -07:00
endif
2023-11-02 11:28:14 -07:00
CC = $(TRGT)gcc
CPPC = $(TRGT)g++
2017-04-10 07:00:42 -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.
#LD = $(CC)
LD = $(CPPC)
2017-04-10 07:00:42 -07:00
CP = $(TRGT)objcopy
AS = $(CC) -x assembler-with-cpp
2017-04-10 07:00:42 -07:00
AR = $(TRGT)ar
OD = $(TRGT)objdump
SZ = $(TRGT)size
BIN = $(CP) -O binary
COV = gcov
# Define C warning options here
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
# Define C++ warning options here
CPPWARN = -Wall -Wextra -Wundef
#
# Compiler settings
##############################################################################
##############################################################################
# Start of user section
#
# List all user C define here, like -D_DEBUG=1
UDEFS = -DSIMULATOR
2023-03-16 01:37:42 -07:00
DDEFS += -DFIRMWARE_ID=\"simulator\"
2017-04-10 07:00:42 -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
ifeq ($(OS),Windows_NT)
ULIBS = -lws2_32 -static
else
ULIBS =
endif
ifeq ($(SANITIZE),yes)
ULIBS += -fsanitize=address
endif
2017-04-10 07:00:42 -07:00
#
# End of user defines
##############################################################################
include $(RULESPATH)/rules.mk
# Enable precompiled header
include $(PROJECT_DIR)/rusefi_pch.mk
2024-02-22 10:58:03 -08:00
include $(PROJECT_DIR)/fome_generated.mk
include $(PROJECT_DIR)/gitversion.mk
include $(PROJECT_DIR)/controllers/modules/modules_header_gen.mk
2024-03-15 01:06:00 -07:00
.PHONY: CLEAN_RULE_HOOK CLEAN_PCH_HOOK CLEAN_BUNDLE_HOOK
CLEAN_RULE_HOOK: CLEAN_PCH_HOOK CLEAN_GENERATED_HOOK