rust-embedded / cortex-m

Low level access to Cortex-M processors
Apache License 2.0
812 stars 145 forks source link

Can we use an Arm FVP for testing #358

Closed thejpster closed 1 year ago

thejpster commented 2 years ago

355 is brilliant, we we should do that. But can we also do something with https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps? It appears to emulate a Cortex-M55.

thejpster commented 2 years ago

Ah, to be specific, I was looking at the Corstone-300 FVP.

The Corstone-300 model is aligned with the Arm MPS3 development platform. It is based on the Cortex-M55 processor and offers a choice of the Ethos-U55 and Ethos-U65 processors.

Unlike the other FVPs, these ones appear to have no licence control (at least at download time). Normally you need an Arm account and a licence to use an FVP.

thejpster commented 2 years ago

Seems to be an SDL application - and I think the serial ports come up as TCP connections.

image

newAM commented 2 years ago

I tried this out, some thoughts:

I wanted to start writing some tests and poking at the peripherals to do a more technical comparison, but the sparse documentation for the FVP does not make this a very pleasant experiment.

I do like that the FVP model is a better representation of the CPU, but I think that QEMU is a better choice for the target audience of cortex-m.

jonathanpallant commented 2 years ago

I had a chat with Arm about this and the basic free FVP doesn't have any kind of debug ability. That only comes with the paid licences. So it's possible we could run on FVP but then debugging any issues would only be possible on local machines by developers who had those licences.

jonathanpallant commented 2 years ago

For anyone interested in playing, this Dockerfile will spin up the GUI for you. I post it as doing an X server in a Docker container isn't straightforward. You'll want to adapt this to either start the FVP with your binary, or start an xterm so you can run the FVP GUI on demand.

# syntax=docker/dockerfile:1
FROM ubuntu:latest
RUN apt-get -y update && apt-get install -y tightvncserver twm xterm libatomic1 libdbus-1-3
COPY FVP_Base_AEMv8R_11.17_21.tgz /tmp
RUN tar xvf /tmp/FVP_Base_AEMv8R_11.17_21.tgz -C /root
RUN mkdir -p /root/.vnc
RUN echo "letmein123" | vncpasswd -f > /root/.vnc/passwd
RUN chmod 400 /root/.vnc/passwd
EXPOSE 5901/tcp
EXPOSE 5000/tcp
EXPOSE 5001/tcp
EXPOSE 5002/tcp
EXPOSE 5003/tcp
CMD USER=root tightvncserver -geometry 1920x1080 && DISPLAY=:1 /root/AEMv8R_base_pkg/models/Linux64_GCC-9.3/FVP_BaseR_AEMv8R
thejpster commented 1 year ago

Now available in GHA...

https://github.blog/2022-11-02-github-partners-with-arm-to-revolutionize-internet-of-things-software-development-with-github-actions/

thejpster commented 1 year ago

In https://github.com/Neotron-Compute/Neotron-QEMU-BIOS/tree/a5b00635feff73aa2b551c4673f97774ae1f7121 I have an example application which runs in both QEMU and the Arm FVP - both emulating the MPS3-AN547 (which is an Arm MPS3 evaluation board where the FPGA is loaded with the Corstone SSE-300 SoC image, which in turn has a Cortex-M55 inside it).

In that repo is a UART driver, so there's a starter for ten. You could set up various interrupt handlers and write to the UART from them to prove they'd been called, and so on.

Edit: Ah, I see in https://github.com/rust-embedded/cortex-m/tree/master/testsuite we already have some QEMU tests on the LM3 simulated machine. That's probably good enough, we can close this - after two days I didn't find anything FVP can do that QEMU can't do and it's nightmarishly undocumented.