#config for qemu
global_set(qemu_command "/home/davis/qemu-riscv/bin/qemu-system-riscv64")
#global_set(qemu_bios ${CMAKE_SOURCE_DIR}/firmware/sbi-qemu)
global_set(qemu_bios ${CMAKE_SOURCE_DIR}/firmware/opensbi/fw_dynamic.bin)
global_set(qemu_kernel ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.bin)

set(run_command ${qemu_command} -machine virt -bios ${qemu_bios} -kernel ${CMAKE_BINARY_DIR}/${PROJECT_NAME} -m 128M -smp 2 -nographic -drive file=fs.img,if=none,format=raw,id=x0 -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0)

add_custom_command(TARGET run POST_BUILD
        COMMAND ${run_command}
        )

add_custom_command(TARGET debug POST_BUILD
        COMMAND ${run_command} -S -s
        )


