misc: Add GCC minimum toolchain check for CM55.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
iabdalkader 2025-07-05 14:02:15 +02:00
parent ad722d0153
commit a008ecf707
3 changed files with 22 additions and 4 deletions

View File

@ -127,9 +127,10 @@ MPY_MKARGS = PORT=$(PORT) BOARD=$(TARGET) DEBUG=$(DEBUG) MICROPY_MANIFEST_OMV_LI
MICROPY_ROM_TEXT_COMPRESSION=$(ROM_TEXT_COMPRESSION) USER_C_MODULES=$(TOP_DIR) MICROPY_ROM_TEXT_COMPRESSION=$(ROM_TEXT_COMPRESSION) USER_C_MODULES=$(TOP_DIR)
# Disable broken optimization for CM55.
# Check GCC toolchain version.
ifeq ($(CPU),cortex-m55) ifeq ($(CPU),cortex-m55)
CFLAGS += -fdisable-rtl-loop2_doloop include $(TOP_DIR)/common/check_toolchain.mk
endif endif
# Configure additional built-in modules. Note must define both the CFLAGS and the Make command line args. # Configure additional built-in modules. Note must define both the CFLAGS and the Make command line args.

View File

@ -49,8 +49,8 @@ endif
# Include the port Makefile. # Include the port Makefile.
include $(PORT_DIR)/$(PORT_LOWER)_port.mk include $(PORT_DIR)/$(PORT_LOWER)_port.mk
# Disable broken optimization for CM55. # Check GCC toolchain version.
ifeq ($(CPU),cortex-m55) ifeq ($(CPU),cortex-m55)
CFLAGS += -fdisable-rtl-loop2_doloop include $(TOP_DIR)/common/check_toolchain.mk
endif endif

17
common/check_toolchain.mk Normal file
View File

@ -0,0 +1,17 @@
ifeq ($(CPU),cortex-m55)
# Check if GCC version is less than 14.3
GCC_VERSION := $(shell arm-none-eabi-gcc -dumpversion | cut -d. -f1-2)
GCC_MAJOR := $(shell echo $(GCC_VERSION) | cut -d. -f1)
GCC_MINOR := $(shell echo $(GCC_VERSION) | cut -d. -f2)
# Convert to comparable number (14.3 becomes 1403)
GCC_VERSION_NUM := $(shell echo $$(($(GCC_MAJOR) * 100 + $(GCC_MINOR))))
# Only add the flag if version < 14.3 (1403)
ifeq ($(shell test $(GCC_VERSION_NUM) -lt 1403 && echo yes),yes)
$(warning *** ERROR ***)
$(warning GCC $(GCC_VERSION) has known issues with Cortex-M55)
$(warning Upgrade to GCC 14.3+ for proper CM55 support)
$(error )
endif
endif