I’ve followed the bare metal guide at https://git.morello-project.org/morello/docs/-/blob/morello/release-1.3/standalone-baremetal-readme.rst to run the example ‘helloworld’ as a TFA payload on the FVP and hardware and all works fine. I also replaced the ‘helloworld’ program with a branch to self loop and successfully downloaded a helloworld EL2 program from the Development Studio on FVP and Hardware.
I then wanted to rebuild for purcap. I built the loop program using
Bin/clang -target aarch64-none-elf -march=morello+c64 -mabi-purecap -c loop.c -o loop.o 03
etc
And built the fip.bin and bl1.bin binaries for FVP as before but with the ENABLE_MORELLO_CAP=1 option.
However after running the FVP and connecting to Development Studio with a connect only connection, it appears the PSTATE.C64 is set to a64 (instead of c64). For capability mode this would need to be in c64 mode on entry to EL2. I checked SPSR_EL3[26] which sets the mode on the ERET, and this appears to be set to a64 mode.
Consequently if I try to download a purecap program from the debugger it eventually falls over.
Is someone able to advise if I need to do anything else, or if it is a problem with the build scripts?
Many thanks
Hi Jen,
We don't have an EL2 version of that but should be fairly straight-forward to modify (change EL3 to EL2)? I believe you additionally need an update to the page table setup bits (https://git.morello-project.org/morello/newlib/-/blob/morello/release-1.3/libgloss/aarch64/cpu-init/rdimon-aem-el3.S if you're using 1.3)
Thanks,
Silviu
Many thanks. For other people needing to do this I needed crt.0, rdimon-aem-el3.S, and svc.h. I also needed to create a stub for _init and _fini, and include a linker flag -nostartfiles to stop the default _start from being used from within Development Studio. Once working for EL3 I could then modify for EL2. Thanks.