2
1

arch.mk.riscv 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #
  2. # Configure the GCC_TARGET_ARCH variable and append the
  3. # appropriate RISC-V ISA extensions.
  4. #
  5. ifeq ($(BR2_riscv),y)
  6. ifeq ($(BR2_RISCV_64),y)
  7. GCC_TARGET_ARCH := rv64i
  8. else
  9. GCC_TARGET_ARCH := rv32i
  10. endif
  11. ifeq ($(BR2_RISCV_ISA_RVM),y)
  12. GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)m
  13. endif
  14. ifeq ($(BR2_RISCV_ISA_RVA),y)
  15. GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)a
  16. endif
  17. ifeq ($(BR2_RISCV_ISA_RVF),y)
  18. GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)f
  19. endif
  20. ifeq ($(BR2_RISCV_ISA_RVD),y)
  21. GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)d
  22. endif
  23. ifeq ($(BR2_RISCV_ISA_RVC),y)
  24. GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)c
  25. endif
  26. ifeq ($(BR2_RISCV_ISA_RVV),y)
  27. GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)v
  28. endif
  29. # Starting from gcc 12.x, csr and fence instructions have been
  30. # separated from the base I instruction set, and special -march
  31. # suffixes are needed to enable their support. In Buildroot, we assume
  32. # all RISC-V cores that support Linux implement those instructions, so
  33. # we unconditionally enable those extensions.
  34. ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_12),y)
  35. GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)_zicsr_zifencei
  36. endif
  37. endif