The solution was even easier: I forgot to load the proxy kernel. As soon as I replaced the command-line parameter "-kernel <ELF>" with "-kernel <PK> -append <ELF>", everything was working as expected.
Without your hint about my possibly misconfigured toolchain I would have probably continued to search for the error in the QEMU HTIF device. But in fact it was due to the wrong binary. Thanks a lot! :-) > On 16. Oct 2020, at 20:03, Alistair Francis <alistai...@gmail.com> wrote: > > On Fri, Oct 16, 2020 at 7:59 AM Peer Adelt <ad...@hni.upb.de> wrote: >> >> Hi, >> >> I have a problem with the RISC-V HTIF device. >> >> Every binary I have compiled for Spike on riscv32 fails with the following >> error message: "HTIF tohost must be 8 bytes" >> >> This happens regardless of which program I have translated for Spike. This >> is also the case with the official riscv-compliance tests, for example. >> >> The query "if (st_size != 8)" in the HTIF device always fails, because >> st_size seems to be always 0. >> >> To be able to reproduce it: >> - QEMU GIT Hash: d0ed6a69d399ae193959225cdeaa9382746c91cc (tag "v5.1.0") > > I just checked with this hash and with the current master and on both > I can run a ELF executable on the Spike machine for RV32. > >> - System: Mac OS 10.14.6 (Darwin Kernel Version 18.7.0) >> - Compiler: Latest SiFive Build for GCC under OSX > > Maybe try using an official toolchain instead of a vendor fork. > > Alistair > >> - Command: qemu-system-riscv32 -M spike -nographic -bios none -kernel >> <ANY_SPIKE_ELF_FILE> >> >> Best regards, >> Peer Adelt