@@ -18,6 +18,9 @@ CONFIGURATION_MAKEFILE = 1
1818MAKEFLAGS += -r
1919MAKEFLAGS += -R
2020
21+ # Enforce a minimum complier version
22+ MINIMUM_GCC_MAJOR := 13
23+
2124# Toolchain programs.
2225AR := -ar
2326AS := -as
@@ -260,6 +263,12 @@ ifneq ($(findstring rv32i,$(TOCK_ARCH_FAMILIES)),)
260263 CC_rv32_version_major := $(shell echo $(CC_rv32_version ) | cut -f1 -d.)
261264endif
262265
266+ # Validate the the toolchain is new enough
267+ ifneq (1,$(shell [ $(CC_rv32_version_major ) -ge $(MINIMUM_GCC_MAJOR ) ] && echo "1") )
268+ $(info $(TOOLCHAIN_rv32 )$(CC_rv32 ) -dumpfullversion : $(CC_rv32_version ) )
269+ $(error Your compiler is too old. Need gcc version >= $(MINIMUM_GCC_MAJOR))
270+ endif
271+
263272# Match compiler version to support libtock-newlib versions.
264273ifeq ($(CC_rv32_version_major ) ,10)
265274 NEWLIB_VERSION_rv32 := 4.2.0.20211231
@@ -406,6 +415,12 @@ ifneq ($(findstring cortex-m,$(TOCK_ARCH_FAMILIES)),)
406415 CC_cortex-m_version_major := $(shell echo $(CC_cortex-m_version ) | cut -f1 -d.)
407416endif
408417
418+ # Validate the the toolchain is new enough
419+ ifneq (1,$(shell [ $(CC_cortex-m_version_major ) -ge $(MINIMUM_GCC_MAJOR ) ] && echo "1") )
420+ $(info $(TOOLCHAIN_cortex-m )$(CC_cortex-m ) -dumpfullversion : $(CC_cortex-m_version ) )
421+ $(error Your compiler is too old. Need gcc version >= $(MINIMUM_GCC_MAJOR))
422+ endif
423+
409424# Match compiler version to support libtock-newlib versions.
410425ifeq ($(CC_cortex-m_version_major ) ,10)
411426 NEWLIB_VERSION_cortex-m := 4.2.0.20211231
0 commit comments