Baremetal TFA payload built for capability mode still in PSTATE a64 on EL2 entry

I’ve followed the bare metal guide at 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


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