From fcca331773dba4d4219b7ef7a2420c6a94180afa Mon Sep 17 00:00:00 2001 From: Nathan Schulte <8540239+nmschulte@users.noreply.github.com> Date: Fri, 18 Nov 2022 20:53:02 -0600 Subject: [PATCH] Tweak firmware Makefile, scripting (#4796) * firmware: Makefile uses spaces ... * firmware: use CC and CPPC for LD * firmware: clean_compile_two_versions.sh passes arguments to make --- firmware/Makefile | 106 ++++++++++++------------- firmware/clean_compile_two_versions.sh | 8 +- 2 files changed, 58 insertions(+), 56 deletions(-) diff --git a/firmware/Makefile b/firmware/Makefile index 5878ab934c..cc6c3d0d84 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -47,10 +47,10 @@ endif ifeq ($(CCACHE_DIR),) - $(info No CCACHE_DIR) + $(info No CCACHE_DIR) else - $(info CCACHE_DIR is ${CCACHE_DIR}) - CCPREFIX=ccache + $(info CCACHE_DIR is ${CCACHE_DIR}) + CCPREFIX=ccache endif @@ -182,25 +182,25 @@ include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk # EX files (optional). ifneq ($(USE_LIS302),no) -include $(CHIBIOS)/os/ex/devices/ST/lis302dl.mk + include $(CHIBIOS)/os/ex/devices/ST/lis302dl.mk endif include $(CHIBIOS)/os/hal/lib/streams/streams.mk include $(CHIBIOS)/os/various/cpp_wrappers/chcpp.mk ifeq ($(LWIP),yes) - include $(CHIBIOS)/os/various/lwip_bindings/lwip.mk + include $(CHIBIOS)/os/various/lwip_bindings/lwip.mk endif include $(CHIBIOS)/os/hal/lib/complex/mfs/hal_mfs.mk ifeq ($(USE_FATFS),yes) -include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk + include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk endif #Now include RusEFI mk files include console/binary/tunerstudio.mk ifeq ($(USE_FATFS),yes) -include $(PROJECT_DIR)/ext/FatFS/fatfs.mk + include $(PROJECT_DIR)/ext/FatFS/fatfs.mk endif include $(PROJECT_DIR)/hw_layer/mass_storage/mass_storage.mk @@ -212,7 +212,7 @@ ifeq ($(BOOTLOADERINC),) endif ifeq ($(USE_BOOTLOADER),yes) -include $(PROJECT_DIR)/bootloader/bootloader.mk + include $(PROJECT_DIR)/bootloader/bootloader.mk endif ifeq ($(USE_OPENBLT),yes) @@ -230,31 +230,31 @@ $(info LDSCRIPT: $(LDSCRIPT)) # setting. # check.c goes first to throw error as soon as possible CSRC = check.c \ - $(ALLCSRC) \ - $(BOARDSRC) \ - $(CHIBIOS_CONTRIB)/os/various/ramdisk.c \ - $(CHIBIOS)/os/various/evtimer.c \ - $(DEV_SRC) \ - $(BOOTLOADERSRC) \ - ${HW_MASS_STORAGE_SRC_C} \ - $(HW_LAYER_EMS) \ - $(HW_LAYER_DRIVERS_CORE) \ - $(HW_LAYER_DRIVERS) \ - $(RUSEFI_LIB_C) \ - main_hardfault.c + $(ALLCSRC) \ + $(BOARDSRC) \ + $(CHIBIOS_CONTRIB)/os/various/ramdisk.c \ + $(CHIBIOS)/os/various/evtimer.c \ + $(DEV_SRC) \ + $(BOOTLOADERSRC) \ + ${HW_MASS_STORAGE_SRC_C} \ + $(HW_LAYER_EMS) \ + $(HW_LAYER_DRIVERS_CORE) \ + $(HW_LAYER_DRIVERS) \ + $(RUSEFI_LIB_C) \ + main_hardfault.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. CPPSRC = \ - $(ALLCPPSRC) \ - $(BOARDCPPSRC) \ - $(DEV_SRC_CPP) \ - $(HW_LAYER_DRIVERS_CORE_CPP) \ - $(HW_LAYER_DRIVERS_CPP) \ - $(CONSOLE_SRC_CPP) \ - $(RUSEFI_LIB_CPP) \ - rusefi.cpp \ - main.cpp + $(ALLCPPSRC) \ + $(BOARDCPPSRC) \ + $(DEV_SRC_CPP) \ + $(HW_LAYER_DRIVERS_CORE_CPP) \ + $(HW_LAYER_DRIVERS_CPP) \ + $(CONSOLE_SRC_CPP) \ + $(RUSEFI_LIB_CPP) \ + rusefi.cpp \ + main.cpp # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -278,32 +278,32 @@ TCPPSRC = # List ASM source files here ASMXSRC = $(ALLXASMSRC) \ - $(RUSEFIASM) \ - main_hardfault_asm.S + $(RUSEFIASM) \ + main_hardfault_asm.S # # WARNING! order of variables is important here - for instance cypress own folders should go before default folders # INCDIR = \ - $(PCH_DIR) \ - $(BOARDINC) \ - $(ALLINC) \ - $(TESTINC) \ - $(BOOTLOADERINC) \ - $(CHIBIOS)/os/various \ - $(CHIBIOS)/os/hal/lib/peripherals/sensors \ - $(RUSEFI_LIB_INC) \ - $(CONFDIR) \ - ext/FatFS \ - $(PROJECT_DIR)/hw_layer/mass_storage \ - $(PROJECT_DIR)/hw_layer/serial_over_usb \ - $(PROJECT_DIR)/hw_layer/lcd \ - $(PROJECT_DIR)/hw_layer/mass_storage \ - $(HW_INC) \ - development/hw_layer \ - development/test \ - $(CHIBIOS_CONTRIB)/os/various - # contrib/os/various must go at the end because it also contains pid.h which conflicts with our pid.h + $(PCH_DIR) \ + $(BOARDINC) \ + $(ALLINC) \ + $(TESTINC) \ + $(BOOTLOADERINC) \ + $(CHIBIOS)/os/various \ + $(CHIBIOS)/os/hal/lib/peripherals/sensors \ + $(RUSEFI_LIB_INC) \ + $(CONFDIR) \ + ext/FatFS \ + $(PROJECT_DIR)/hw_layer/mass_storage \ + $(PROJECT_DIR)/hw_layer/serial_over_usb \ + $(PROJECT_DIR)/hw_layer/lcd \ + $(PROJECT_DIR)/hw_layer/mass_storage \ + $(HW_INC) \ + development/hw_layer \ + development/test \ + $(CHIBIOS_CONTRIB)/os/various +# contrib/os/various must go at the end because it also contains pid.h which conflicts with our pid.h # # Project, sources and paths @@ -323,10 +323,10 @@ CPPC = $(CCPREFIX) $(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 = $(CC) +#LD = $(CPPC) CP = $(TRGT)objcopy -AS = $(TRGT)gcc -x assembler-with-cpp +AS = $(CC) -x assembler-with-cpp AR = $(TRGT)ar OD = $(TRGT)objdump SZ = $(TRGT)size diff --git a/firmware/clean_compile_two_versions.sh b/firmware/clean_compile_two_versions.sh index 04da7154c8..8b249ec3b1 100755 --- a/firmware/clean_compile_two_versions.sh +++ b/firmware/clean_compile_two_versions.sh @@ -1,4 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash + +set -e echo "Compiler gcc version" arm-none-eabi-gcc -v @@ -10,7 +12,7 @@ mkdir deliver #echo "TIMESTAMP $(date "+%D %T.%2N")" #EXTRA_PARAMS="-DDUMMY -DFIRMWARE_ID=\\\"default_no_assert\\\" -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE" -#make -j$(nproc) DEBUG_LEVEL_OPT='-O2' +#make -j$(nproc) DEBUG_LEVEL_OPT='-O2' $@ #EXTRA_PARAMS="" # mv build/rusefi.elf deliver/rusefi_no_asserts.elf @@ -25,7 +27,7 @@ mkdir deliver bash clean.sh echo "TIMESTAMP $(date "+%D %T.%2N")" EXTRA_PARAMS="-DDUMMY -DFIRMWARE_ID=\\\"default\\\"" -make -j$(nproc) +make -j$(nproc) $@ EXTRA_PARAMS="" mv build/rusefi.elf deliver/rusefi.elf