[binaries]
c = ['clang', '-target', 'riscv64-unknown-elf',
     '-mcmodel=medany',
     '-march=rv64gc_zicfilp1p0_zicfiss1p0_zimop1p0_zcmop1p0',
     '-mabi=lp64d',
     '-menable-experimental-extensions',
     '-fcf-protection=full',
     '-nostdlib']
cpp = ['clang', '-target', 'riscv64-unknown-elf',
       '-mcmodel=medany',
       '-march=rv64gc_zicfilp1p0_zicfiss1p0_zimop1p0_zcmop1p0',
       '-mabi=lp64d',
       '-menable-experimental-extensions',
       '-fcf-protection=full',
       '-nostdlib', '-stdlib=libstdc++']
c_ld = '/usr/bin/riscv64-unknown-elf-ld'
cpp_ld = '/usr/bin/riscv64-unknown-elf-ld'
ar = 'riscv64-unknown-elf-ar'
as = 'riscv64-unknown-elf-as'
nm = 'riscv64-unknown-elf-nm'
strip = 'riscv64-unknown-elf-strip'
# only needed to run tests
exe_wrapper = ['env', 'run-riscv']

[host_machine]
system = 'none'
cpu_family = 'riscv64'
cpu = 'riscv'
endian = 'little'

[properties]
# CFI requires Zicfilp / Zicfiss / Zimop, all of which are still tagged
# "experimental" in current LLVM releases (<=21).  We therefore enable
# experimental extensions and disable -Werror=double-promotion which can
# fire from libgcc helpers compiled without the same flags.
c_args = ['-Werror=double-promotion', '-fshort-enums']
c_link_args = ['-Wl,-melf64lriscv',
               '-L/usr/lib/gcc/riscv64-unknown-elf/15/rv64ifd/lp64d',
               '-L/usr/lib/gcc/riscv64-unknown-elf/15.2.0/rv64ifd/lp64d',
               '-Wno-unused-command-line-argument']
cpp_link_args = ['-Wl,-melf64lriscv',
                 '-L/usr/lib/gcc/riscv64-unknown-elf/15/rv64ifd/lp64d',
                 '-L/usr/lib/gcc/riscv64-unknown-elf/15.2.0/rv64ifd/lp64d',
                 '-Wno-unused-command-line-argument']
skip_sanity_check = true
has_link_defsym = true
default_flash_addr = '0x80000000'
default_flash_size = '0x00400000'
default_ram_addr   = '0x80400000'
default_ram_size   = '0x00200000'
