Building RISCV SPIKE simulator for windows

Hi,

Anybody knows if i can build RISCV simulator SPIKE and Proxy kernel(PK) for windows (using MINGW or CYGWIN).

I could build them with linux binaries in WSL Ubuntu. But any chance that i can also build them with windows binaries ?

Any inputs are useful here

Thanks.

I think it’s possible but do expect some changes are needed. I build it with msys2 on window with some minor change (without extensive check). For cygwin, need to resolved strnlen compile issue if default gcc is used and need to resolve dlopen if mingw gcc is used.

With WSL 2 available for more than a year now I’m not sure it’s worth anyone’s time to figure out how to make things work with MINGW or CYGWIN. Windows now has a solution that Just Works.

I’m quite unfamiliar with modern Windows but yesterday I took delivery of a new laptop (ThinkPad E14 Gen 2, AMD 4500U CPU (Zen 2, 6 core, 4.0 GHz, 8 MB L3, no HT), 8 GB RAM, 256 GB SSD, $735 including tax and delivery).

It came with Windows and though my natural inclination is to delete it and install Ubuntu natively I decided to give Windows with WSL (with Ubuntu 18.04) a chance first.

I haven’t tried Spike yet, but I’ve built riscv-gnu-toolchain and qemu with absolutely zero issues.

Performance is very good. 11m9s to build the newlib toolchain with arch=rv64gc abi=lp64d. This compares to 5m02s on my 32 core ThreadRipper with -j64 or 9m20s with -j6 in an attempt to simulate the laptop. That’s not precise emulation of course as the 2990wx has 32 MB of L3 cache (vs 8), twice the icache per core, 128 GB RAM (so caches the filesystem better), and -j6 doesn’t prevent a little assistance from other cores. And 3.0 GHz vs 2.3 GHz base speed.

I haven’t of course yet tried native Ubuntu on this machine, but it seems any overhead from the virtualization of Linux must be very small.

WSL is reasonably convenient. You can get into it with just “Windws-R bash”. In PowerShell typing “wsl qemu-riscv64” will happily run the Linux binary if it is in your Linux PATH (e.g. /usr/local/bin) and the Linux current directory is set to your Windows current directory, so it’s convenient to use Linux programs on Windows files.

1 Like

I just checked out and built spike and pk on Ubuntu 18.04 in WSL 2.

Absolutely zero problems. For simplicity just don’t specify a PREFIX so they get installed in /usr/local/bin

Using the same program I built and ran in the previous message:

spike