That was certainly correct for one branch of Zephyr. I was able to run the HiFive1 target in the SiFive E series target ‘sifive_e’. Unfortunately, this was a case where we deliberately broke backwards compatibility because the ‘sifive’ machine didn’t match any hardware or simulators. There might be updates since then. We used the HiFive1 linker script load address of 0x2040_0000. We have other problems than just loading the target binaries as we may also want the user to be able to specify their own Mask ROM. In QEMU we have -bios and -kernel arguments so we could potentially use -bios to load Mask ROM. It’s not ideal as there is also a flash protect area. QEMU has the ability to attach flash devices so we can grow the support while trying our best to maintain backwards compatibility.
Now one of the problems we have is emulation of different hardware with different address maps and interrupt routing configurations as there are many different possible core configurations with ROM, flash, scratchpad and DRAM, from SiFive’s core generator. It’s a problem shared between spike and QEMU so ideally we can address it in a uniform way. Both of the emulators currently generate device tree, so using device tree as an input configuration mode would be quite a big change to how they work. We would have to validate the device tree and refuse to run if it contained devices we couldn’t emulate (as passing these to the OS would cause crashes), so we can perform relatively accurate simulation, and the parameter bounds for devices are often originated inside the emulator based on its internal constraints.
We are having ongoing discussions about this “protocol” or “format” issue (as the technical problem is not that hard to solve). We need something that maps to QOM (QEMU Object Model) and we need to break the model used by many of the arm machines in QEMU which use static configuration based on SOC structs. Indeed, internally QEMU supports dynamic configuration. I think it should be relatively easy to solve if we get both spike and QEMU on the same page. The most important piece is the schema for the configuration model. We should choose a format that is easy to use, noting here that SiFive E Series (Freedom Everywhere) do not have device tree, and SiFive U Series (Freedom Unleashed) do. I note here that x86 in QEMU has quite flexible device configuration but using command line arguments is not that friendly so a config file would be nice. This is a discussion to have on qemu-devel when we have a concrete proposal.
I’d prefer a modern and simple format using JSON or YAML that is easy to edit. YAML would look quite nice and it supports comments. Antmicro’s renode emulator has a very nice format to describe dynamic virtual hardware configurations however I’m not sure if there is a spec and whether it is open or not. It would be nice to have a format that is trivial to generate in Python to test different hardware configurations. libfdt based solutions add complexity to scripts because the Python bindings require a native library, which just makes build and installation of tooling harder.
I have a really simple format in mind that leverages simple parsers that are widespread. We’ll be able to generate device-tree from it pretty easily... That’s another discussion though.
I’m raising this because the compatibility issues come down to describing the memory map for ROMs, Flash, Scratchpad and DRAM. Note we also need to generate linker scripts. These just need a simple memmap.json (from core generator). We could replace several hundred lines of code with a dozen or so as JSON is a first class format in Python that maps to dict, list, etc (sorry talking about other related problems).
Regards,
Michael