1
0
Fork 0
forked from forks/qmk_firmware

Attempt to deal with GCC 13+ and rv32 arch extensions. (#23086)

This commit is contained in:
Nick Brassel 2024-03-09 21:40:19 +11:00 committed by GitHub
parent fec2323089
commit 900e79febe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -402,6 +402,17 @@ ifeq ($(strip $(MCU)), risc-v)
-mabi=$(MCU_ABI) \
-mcmodel=$(MCU_CMODEL) \
-mstrict-align
# Deal with different arch revisions and gcc renaming them
ifneq ($(shell echo 'int main() { asm("csrc 0x300,8"); return 0; }' | $(TOOLCHAIN)gcc $(MCUFLAGS) $(TOOLCHAIN_CFLAGS) -x c -o /dev/null - 2>/dev/null >/dev/null; echo $$?),0)
MCUFLAGS = -march=$(MCU_ARCH)_zicsr \
-mabi=$(MCU_ABI) \
-mcmodel=$(MCU_CMODEL) \
-mstrict-align
ifneq ($(shell echo 'int main() { asm("csrc 0x300,8"); return 0; }' | $(TOOLCHAIN)gcc $(MCUFLAGS) $(TOOLCHAIN_CFLAGS) -x c -o /dev/null - 2>/dev/null >/dev/null; echo $$?),0)
$(call CATASTROPHIC_ERROR,Incompatible toolchain,No compatible RISC-V toolchain found. Can't work out correct architecture.)
endif
endif
else
# ARM toolchain specific configuration
TOOLCHAIN ?= arm-none-eabi-