Skip to content

Commit

Permalink
Attempt to deal with GCC 13+ and rv32 arch extensions. (#23086)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzarc committed Mar 9, 2024
1 parent fec2323 commit 900e79f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions platforms/chibios/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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-
Expand Down

0 comments on commit 900e79f

Please sign in to comment.