Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add global GCC version check #9779

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ports/broadcom/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ USB_NUM_ENDPOINT_PAIRS = 8
USB_HIGHSPEED = 1

CIRCUITPY_BUILD_EXTENSIONS ?= disk.img.zip,kernel8.img

ifeq ($(CHIP_VARIANT), "bcm2711")
CIRCUITPY_MIN_GCC_VERSION ?= 10
else ifeq ($(CHIP_VARIANT), "bcm2837")
CIRCUITPY_MIN_GCC_VERSION ?= 10
endif
1 change: 1 addition & 0 deletions ports/litex/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ CIRCUITPY_USB_HID = 1
CIRCUITPY_USB_MIDI = 1

CIRCUITPY_BUILD_EXTENSIONS ?= dfu
CIRCUITPY_MIN_GCC_VERSION ?= 8
16 changes: 16 additions & 0 deletions py/circuitpy_mpconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,3 +599,19 @@ void background_callback_run_all(void);
// Enable compiler functionality.
#define MICROPY_ENABLE_COMPILER (1)
#define MICROPY_PY_BUILTINS_COMPILE (1)

#ifndef CIRCUITPY_MIN_GCC_VERSION
#define CIRCUITPY_MIN_GCC_VERSION 13
#endif

#if defined(__GNUC__)
#if __GNUC__ < CIRCUITPY_MIN_GCC_VERSION
// (the 3 level scheme here is required to get expansion & stringization
// correct)
#define DO_PRAGMA(x) _Pragma(#x)
#define DO_ERROR_HELPER(x) DO_PRAGMA(GCC error #x)
#define DO_ERROR(x) DO_ERROR_HELPER(Minimum GCC version x \
-- older versions are known to miscompile CircuitPython)
DO_ERROR(CIRCUITPY_MIN_GCC_VERSION);
#endif
#endif
4 changes: 4 additions & 0 deletions py/circuitpy_mpconfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,10 @@ CFLAGS += -DCIRCUITPY_TUSB_ATTR_USBRAM=$(CIRCUITPY_TUSB_ATTR_USBRAM)
CIRCUITPY_SWO_TRACE ?= 0
CFLAGS += -DCIRCUITPY_SWO_TRACE=$(CIRCUITPY_SWO_TRACE)

# Check for a minimum GCC version during build (set to 0 to disable)
CIRCUITPY_MIN_GCC_VERSION ?= 13
CFLAGS += -DCIRCUITPY_MIN_GCC_VERSION=$(CIRCUITPY_MIN_GCC_VERSION)

# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
Expand Down