Hello to all,
I'd appreciate some advice on how to
- simulate a ARM Cortex-M4 system with large amount of RAM
- together with semihosting (stdin, stdout and files) on the host CPU.
The background of my question is a bit different from the conventional QEMU use-case for full-system simulation:
I am working on CC0 crypto libraries for the Arm Cortex-M series (see e.g. https://github.com/BjoernMHaase/fe25519). There is a lot of assembly optimization and assembly code-generators behind the scenes which need extensive tests. I'd like to publish my code together with a regression test library running on Qemu (specifically regarding the asm stuff). The regression tests best have access to files and need to be executed without the code-size-restriction and memory constraints of the tiny embedded targets (which might not even allow for stl containers, e.g.).
The problem is that the regression suite code is too big to fit onto any embedded target. I.e. I'd need to simulate a cortex-m4 system with, e.g. 256 MByte RAM and with file access using the semihosting support. So just running on the embedded target is not an option :-(. The use case is, thus, not to simulate real-world CPUs but to simulate CPUs that are not available in the real world.
With the older versions of QEMU, I succeeded with using
qemu-system-arm -nographic -monitor null -serial null -semihosting -cpu cortex-m4 -m 256M -M integratorcp -kernel ./test_naclM4
where I have used a combination of an ARM9 machine together with the "-cpu cortex-m4" switch. This worked perfectly. When compiling the testsuite with arm-none-eabi-gcc with -lrdimon and -lc and the corresponding linker specs, I was able to use the semihosting, just as for the integratorcp simulation.
Unfortunately the more recent versions of QEMU either core-dump or give warnings.
On Qemo 4.0 I get the result "qemu-system-arm: This board cannot be used with Cortex-M CPUs".
I did some attempts using e.g. the lm3s811evb targets. However, I constantly get failures such as
"qemu-system-arm: Trying to execute code outside RAM or ROM"
most surely since qemu checks for the limitations of this specific microcontroller memory sizes, which I want to exceed intentionally!
Also I believe that semihosting will not be supported on any of the native cortex-m machines? Any advice would be very appreciated.
- Would it be necessary to add a separate "cortex-m-semihosting" target to the qemu code or is there possibly another way to proceed?
- Is there some documentation on how to add a new machine to the qemu code? I did not actually find the place where e.g. the lm3s811evb configuration is stored within the source trees.
Any feedback would be appreciated.