Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[topic-clang] Add LLVM RISC-V multi-libs #839

Merged
merged 9 commits into from
Nov 26, 2024
7 changes: 6 additions & 1 deletion cmake/zephyr/llvm/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ if("${ARCH}" STREQUAL "arm")
endif()
elseif("${ARCH}" STREQUAL "arm64")
set(triple aarch64-none-elf)
# TODO: Add RISC-V target support.
elseif("${ARCH}" STREQUAL "riscv")
if(CONFIG_64BIT)
set(triple riscv64-none-elf)
else()
set(triple riscv32-none-elf)
endif()
endif()

if(DEFINED triple)
Expand Down
332 changes: 326 additions & 6 deletions scripts/llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1769,9 +1769,121 @@ add_library_variants_for_cpu(
# RISC-V multilibs
## RV32I
add_library_variants_for_cpu(
rv32i_zicsr_zifencei
rv32i_zicsr_zifencei_ilp32
COMPILE_FLAGS "-march=rv32i_zicsr_zifencei -mabi=ilp32"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32i2p1_zicsr2p0_zifencei2p0 -mabi=ilp32"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32im_zicsr_zifencei_ilp32
COMPILE_FLAGS "-march=rv32im_zicsr_zifencei -mabi=ilp32"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32i2p1_m2p0_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=ilp32"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32im_zicsr_zifencei_zba_zbb_zbc_zbs_ilp32
COMPILE_FLAGS "-march=rv32im_zicsr_zifencei_zba_zbb_zbc_zbs -mabi=ilp32"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32i2p1_m2p0_zicsr2p0_zifencei2p0_zmmul1p0_zba1p0_zbb1p0_zbc1p0_zbs1p0 -mabi=ilp32"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32imac_zicsr_zifencei_ilp32
COMPILE_FLAGS "-march=rv32imac_zicsr_zifencei -mabi=ilp32"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32i2p1_m2p0_a2p1_c2p0_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=ilp32"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32imafc_zicsr_zifencei_ilp32f
COMPILE_FLAGS "-march=rv32imafc_zicsr_zifencei -mabi=ilp32f"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32i2p1_m2p0_a2p1_f2p2_c2p0_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=ilp32f"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32imfc_zicsr_zifencei_ilp32f
COMPILE_FLAGS "-march=rv32imfc_zicsr_zifencei -mabi=ilp32f"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32i2p1_m2p0_f2p2_c2p0_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=ilp32f"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32imafd_zicsr_zifencei_ilp32d
COMPILE_FLAGS "-march=rv32imafd_zicsr_zifencei -mabi=ilp32d"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32i2p1_m2p0_a2p1_f2p2_d2p2_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=ilp32d"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32if_zicsr_zifencei_ilp32f
COMPILE_FLAGS "-march=rv32if_zicsr_zifencei -mabi=ilp32f"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32i2p1_f2p2_zicsr2p0_zifencei2p0 -mabi=ilp32f"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
Expand All @@ -1786,9 +1898,89 @@ add_library_variants_for_cpu(
)
## RV32E
add_library_variants_for_cpu(
rv32e_zicsr_zifencei
rv32e_zicsr_zifencei_ilp32e
COMPILE_FLAGS "-march=rv32e_zicsr_zifencei -mabi=ilp32e"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32e2p0_zicsr2p0_zifencei2p0 -mabi=ilp32e"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32em_zicsr_zifencei_ilp32e
COMPILE_FLAGS "-march=rv32em_zicsr_zifencei -mabi=ilp32e"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32e2p0_m2p0_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=ilp32e"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32emc_zicsr_zifencei_ilp32e
COMPILE_FLAGS "-march=rv32emc_zicsr_zifencei -mabi=ilp32e"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32e2p0_m2p0_c2p0_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=ilp32e"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32emc_zicsr_zifencei_zba_zbb_zbc_zbs_ilp32e
COMPILE_FLAGS "-march=rv32emc_zicsr_zifencei_zba_zbb_zbc_zbs -mabi=ilp32e"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32e2p0_m2p0_c2p0_zicsr2p0_zifencei2p0_zmmul1p0_zba1p0_zbb1p0_zbc1p0_zbs1p0 -mabi=ilp32e"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32emc_zicsr_ilp32e
COMPILE_FLAGS "-march=rv32emc_zicsr -mabi=ilp32e"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32e2p0_m2p0_c2p0_zicsr2p0_zmmul1p0 -mabi=ilp32e"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv32emc_zicsr_zba_zbb_zbc_zbs_ilp32e
COMPILE_FLAGS "-march=rv32emc_zicsr_zba_zbb_zbc_zbs -mabi=ilp32e"
MULTILIB_FLAGS "--target=riscv32-unknown-none-elf -march=rv32e2p0_m2p0_c2p0_zicsr2p0_zmmul1p0_zba1p0_zbb1p0_zbc1p0_zbs1p0 -mabi=ilp32e"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv32"
Expand All @@ -1803,9 +1995,137 @@ add_library_variants_for_cpu(
)
## RV64I
add_library_variants_for_cpu(
rv64i_zicsr_zifencei
rv64i_zicsr_zifencei_lp64
COMPILE_FLAGS "-march=rv64i_zicsr_zifencei -mabi=lp64 -mcmodel=medany"
MULTILIB_FLAGS "--target=riscv64-unknown-none-elf"
MULTILIB_FLAGS "--target=riscv64-unknown-none-elf -march=rv64i2p1_zicsr2p0_zifencei2p0 -mabi=lp64"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv64"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv64im_zicsr_zifencei_lp64
COMPILE_FLAGS "-march=rv64im_zicsr_zifencei -mabi=lp64 -mcmodel=medany"
MULTILIB_FLAGS "--target=riscv64-unknown-none-elf -march=rv64i2p1_m2p0_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=lp64"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv64"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv64im_zicsr_zifencei_zba_zbb_zbc_zbs_lp64
COMPILE_FLAGS "-march=rv64im_zicsr_zifencei_zba_zbb_zbc_zbs -mabi=lp64 -mcmodel=medany"
MULTILIB_FLAGS "--target=riscv64-unknown-none-elf -march=rv64i2p1_m2p0_zicsr2p0_zifencei2p0_zmmul1p0_zba1p0_zbb1p0_zbc1p0_zbs1p0 -mabi=lp64"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv64"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv64imac_zicsr_zifencei_lp64
COMPILE_FLAGS "-march=rv64imac_zicsr_zifencei -mabi=lp64 -mcmodel=medany"
MULTILIB_FLAGS "--target=riscv64-unknown-none-elf -march=rv64i2p1_m2p0_a2p1_c2p0_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=lp64"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv64"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv64imac_zicsr_zifencei_zba_zbb_zbc_zbs_lp64
COMPILE_FLAGS "-march=rv64imac_zicsr_zifencei_zba_zbb_zbc_zbs -mabi=lp64 -mcmodel=medany"
MULTILIB_FLAGS "--target=riscv64-unknown-none-elf -march=rv64i2p1_m2p0_a2p1_c2p0_zicsr2p0_zifencei2p0_zmmul1p0_zba1p0_zbb1p0_zbc1p0_zbs1p0 -mabi=lp64"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv64"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv64imafdc_zicsr_zifencei_lp64d
COMPILE_FLAGS "-march=rv64imafdc_zicsr_zifencei -mabi=lp64d -mcmodel=medany"
MULTILIB_FLAGS "--target=riscv64-unknown-none-elf -march=rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=lp64d"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv64"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv64imafd_zicsr_zifencei_lp64d
COMPILE_FLAGS "-march=rv64imafd_zicsr_zifencei -mabi=lp64d -mcmodel=medany"
MULTILIB_FLAGS "--target=riscv64-unknown-none-elf -march=rv64i2p1_m2p0_a2p1_f2p2_d2p2_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=lp64d"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv64"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv64imfc_zicsr_zifencei_lp64f
COMPILE_FLAGS "-march=rv64imfc_zicsr_zifencei -mabi=lp64f -mcmodel=medany"
MULTILIB_FLAGS "--target=riscv64-unknown-none-elf -march=rv64i2p1_m2p0_f2p2_c2p0_zicsr2p0_zifencei2p0_zmmul1p0 -mabi=lp64f"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv64"
QEMU_PARAMS "-m 1G"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x20000000
FLASH_SIZE 0x1000000
RAM_ADDRESS 0x21000000
RAM_SIZE 0x1000000
STACK_SIZE 4K
)
add_library_variants_for_cpu(
rv64imfc_zicsr_zifencei_zba_zbb_zbc_zbs_lp64f
COMPILE_FLAGS "-march=rv64imfc_zicsr_zifencei_zba_zbb_zbc_zbs -mabi=lp64f -mcmodel=medany"
MULTILIB_FLAGS "--target=riscv64-unknown-none-elf -march=rv64i2p1_m2p0_f2p2_c2p0_zicsr2p0_zifencei2p0_zmmul1p0_zba1p0_zbb1p0_zbc1p0_zbs1p0 -mabi=lp64f"
PICOLIBC_BUILD_TYPE "release"
QEMU_MACHINE "none"
QEMU_CPU "rv64"
Expand Down
Loading
Loading