Skip to content

Commit cf76704

Browse files
authored
Merge pull request adafruit#9779 from jepler/arm-version-check
Add global GCC version check
2 parents 1584f5e + a4399cf commit cf76704

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

ports/broadcom/mpconfigport.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ USB_NUM_ENDPOINT_PAIRS = 8
2525
USB_HIGHSPEED = 1
2626

2727
CIRCUITPY_BUILD_EXTENSIONS ?= disk.img.zip,kernel8.img
28+
29+
ifeq ($(CHIP_VARIANT), "bcm2711")
30+
CIRCUITPY_MIN_GCC_VERSION ?= 10
31+
else ifeq ($(CHIP_VARIANT), "bcm2837")
32+
CIRCUITPY_MIN_GCC_VERSION ?= 10
33+
endif

ports/litex/mpconfigport.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ CIRCUITPY_USB_HID = 1
3131
CIRCUITPY_USB_MIDI = 1
3232

3333
CIRCUITPY_BUILD_EXTENSIONS ?= dfu
34+
CIRCUITPY_MIN_GCC_VERSION ?= 8

py/circuitpy_mpconfig.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,3 +599,19 @@ void background_callback_run_all(void);
599599
// Enable compiler functionality.
600600
#define MICROPY_ENABLE_COMPILER (1)
601601
#define MICROPY_PY_BUILTINS_COMPILE (1)
602+
603+
#ifndef CIRCUITPY_MIN_GCC_VERSION
604+
#define CIRCUITPY_MIN_GCC_VERSION 13
605+
#endif
606+
607+
#if defined(__GNUC__)
608+
#if __GNUC__ < CIRCUITPY_MIN_GCC_VERSION
609+
// (the 3 level scheme here is required to get expansion & stringization
610+
// correct)
611+
#define DO_PRAGMA(x) _Pragma(#x)
612+
#define DO_ERROR_HELPER(x) DO_PRAGMA(GCC error #x)
613+
#define DO_ERROR(x) DO_ERROR_HELPER(Minimum GCC version x \
614+
-- older versions are known to miscompile CircuitPython)
615+
DO_ERROR(CIRCUITPY_MIN_GCC_VERSION);
616+
#endif
617+
#endif

py/circuitpy_mpconfig.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,10 @@ CFLAGS += -DCIRCUITPY_TUSB_ATTR_USBRAM=$(CIRCUITPY_TUSB_ATTR_USBRAM)
697697
CIRCUITPY_SWO_TRACE ?= 0
698698
CFLAGS += -DCIRCUITPY_SWO_TRACE=$(CIRCUITPY_SWO_TRACE)
699699

700+
# Check for a minimum GCC version during build (set to 0 to disable)
701+
CIRCUITPY_MIN_GCC_VERSION ?= 13
702+
CFLAGS += -DCIRCUITPY_MIN_GCC_VERSION=$(CIRCUITPY_MIN_GCC_VERSION)
703+
700704
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
701705
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
702706
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.

0 commit comments

Comments
 (0)