#@TYPE: Machine
#@NAME: generic riscv64 baremetal machine
#@DESCRIPTION: Machine configuration for running a generic riscv64

DEFAULTTUNE = "riscv64"
require conf/machine/include/qemu.inc
require conf/machine/include/riscv/tune-riscv.inc

# qemuboot options
QB_MACHINE = "-machine virt"
QB_DEFAULT_KERNEL = "fw_payload.elf"
QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@"
QB_ROOTFS_OPT = "-drive file=@ROOTFS@,format=raw,id=hd0 -device virtio-blk-device,drive=hd0"
QB_SLIRP_OPT = "-netdev user,id=net0,hostfwd=tcp::22222-:22"

# Prelink does not yet work

USER_CLASSES_remove = "image-prelink"
# To support baremetal ld complains
# /opt/riscv32/sysroots/x86_64-becsdk-linux/usr/libexec/riscv32-bec-elf/gcc/riscv32-bec-elf/7.3.0/real-ld: unrecognized option '--hash-style=gnu'
#TARGET_LINK_HASH_STYLE = ""
LINKER_HASH_STYLE = ""

TCLIBC = "baremetal"

BAD_RECOMMENDATIONS += "\
    libcxx-dev \
    libcxx-staticdev \
    compiler-rt-dev \
    compiler-rt-staticdev \
"
ASSUME_PROVIDED += "\
    libcxx-dev \
    libcxx-staticdev \
    compiler-rt-dev \
    compiler-rt-staticdev \
"
