Skip to content

Commit 99740db

Browse files
committed
stm32/stm32.mk: Error out if compiling for cortex-m55 on old gcc.
Signed-off-by: Damien George <[email protected]>
1 parent 50ea398 commit 99740db

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

ports/stm32/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ include $(TOP)/extmod/extmod.mk
6060

6161
GIT_SUBMODULES += lib/libhydrogen lib/stm32lib
6262

63+
CROSS_COMPILE ?= arm-none-eabi-
6364
LD_DIR=boards
6465
USBDEV_DIR=usbdev
6566
#USBHOST_DIR=usbhost
@@ -101,9 +102,6 @@ GEN_STMCONST_HDR = $(HEADER_BUILD)/modstm_const.h
101102
GEN_STMCONST_MPZ = $(HEADER_BUILD)/modstm_mpz.h
102103
CMSIS_MCU_HDR = $(STM32LIB_CMSIS_ABS)/Include/$(CMSIS_MCU_LOWER).h
103104

104-
# Select the cross compile prefix
105-
CROSS_COMPILE ?= arm-none-eabi-
106-
107105
INC += -I.
108106
INC += -I$(TOP)
109107
INC += -I$(BUILD)

ports/stm32/mboot/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ endif
4848
MBOOT_VERSION_ALLOCATED_BYTES ?= 64
4949
MBOOT_VERSION_INCLUDE_OPTIONS ?= 1 # if set to 1, this will append build options to version string (see version.c)
5050

51+
CROSS_COMPILE ?= arm-none-eabi-
5152
USBDEV_DIR=usbdev
5253
DFU=$(TOP)/tools/dfu.py
5354
PYDFU ?= $(TOP)/tools/pydfu.py
@@ -59,8 +60,6 @@ OPENOCD_CONFIG ?= boards/openocd_stm32f4.cfg
5960

6061
include ../stm32.mk
6162

62-
CROSS_COMPILE ?= arm-none-eabi-
63-
6463
INC += -I.
6564
INC += -I..
6665
INC += -I$(TOP)

ports/stm32/stm32.mk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,17 @@ MPY_CROSS_MCU_ARCH_h7 = armv7m
8383
MPY_CROSS_MCU_ARCH_n6 = armv7m # really armv8m
8484
MPY_CROSS_MCU_ARCH_wb = armv7m
8585
MPY_CROSS_MCU_ARCH_wl = armv7m
86+
87+
# gcc up to 14.2.0 have a known loop-optimisation bug:
88+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116799
89+
# This bug manifests for Cortex M55 targets, so require a newer compiler on such targets.
90+
ifeq ($(MCU_SERIES),n6)
91+
# Check if GCC version is less than 14.3
92+
GCC_VERSION := $(shell $(CROSS_COMPILE)gcc -dumpversion | cut -d. -f1-2)
93+
GCC_VERSION_MAJOR := $(shell echo $(GCC_VERSION) | cut -d. -f1)
94+
GCC_VERSION_MINOR := $(shell echo $(GCC_VERSION) | cut -d. -f2)
95+
GCC_VERSION_NUM := $(shell echo $$(($(GCC_VERSION_MAJOR) * 100 + $(GCC_VERSION_MINOR))))
96+
ifeq ($(shell test $(GCC_VERSION_NUM) -lt 1403 && echo yes),yes)
97+
$(error Error: GCC $(GCC_VERSION) has known issues with Cortex-M55; upgrade to GCC 14.3+ for proper CM55 support)
98+
endif
99+
endif

0 commit comments

Comments
 (0)