Do compiler check first (#3706)

This commit is contained in:
Andrey G 2021-12-21 00:17:53 +03:00 committed by GitHub
parent 0e452d401e
commit d3caabd98d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 20 deletions

View File

@ -223,7 +223,9 @@ $(info LDSCRIPT: $(LDSCRIPT))
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(ALLCSRC) \
# check.c goes first to throw error as soon as possible
CSRC = check.c \
$(ALLCSRC) \
$(CHIBIOS)/os/various/syscalls.c \
$(CHIBIOS_CONTRIB)/os/various/ramdisk.c \
$(CHIBIOS)/os/various/evtimer.c \

24
firmware/check.c Normal file
View File

@ -0,0 +1,24 @@
// This file asserts that the compiler is appropriate for rusEFI use.
// non-MCU builds are significantly more tolerant
#if EFI_PROD_CODE
#define GCC_VERSION ((__GNUC__ * 100) + (__GNUC_MINOR__ * 10) + ( __GNUC_PATCHLEVEL__ ))
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
// Firmware builds require at least GCC 9.3.1
#if (GCC_VERSION < 931)
#pragma message("GCC is " STR(__GNUC__)"."STR(__GNUC_MINOR__)"."STR(__GNUC_PATCHLEVEL__))
#error "GCC compiler >= 9.3.1 required"
#endif
#if (GCC_VERSION > 1000)
#pragma message("GCC is " STR(__GNUC__)"."STR(__GNUC_MINOR__)"."STR(__GNUC_PATCHLEVEL__))
#error "GCC10 not supported see https://github.com/rusefi/rusefi/labels/Gcc10"
#endif
#endif

View File

@ -37,10 +37,6 @@
#include "hardware.h"
#include "thread_priority.h"
#if EFI_PROD_CODE
#include "version_check.h"
#endif
#if EFI_UNIT_TEST
#include <gtest/gtest.h>
#include <gmock/gmock.h>

View File

@ -1,15 +0,0 @@
// This file asserts that the compiler is appropriate for rusEFI use.
#pragma once
// non-MCU builds are significantly more tolerant
#if EFI_PROD_CODE
static constexpr auto gccVersion = (__GNUC__ * 100) + (__GNUC_MINOR__ * 10) + ( __GNUC_PATCHLEVEL__ );
// Firmware builds require at least GCC 9.3.1
static_assert(gccVersion >= 931, "GCC compiler >= 9.3.1 required");
static_assert(gccVersion < 1000, "GCC10 not supported see https://github.com/rusefi/rusefi/labels/Gcc10");
#endif