Hi Bohdan,

yes, your understanding is correct, the NSPE and SPE images need to built with the same set of options regarding FPU. Even in the case of the NSPE not using FPU , it still needs to enable the CP10/CP11 otherwise you would get, for example, an UsageFault on context switch to S with the NOCP bit set. This is architectural behaviour and you can read about it on the Armv8-M manual.

Thanks,
Antonio

From: Bohdan.Hunko--- via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Friday, December 15, 2023 15:35
To: tf-m@lists.trustedfirmware.org <tf-m@lists.trustedfirmware.org>
Cc: Hennadiy.Kytsun@infineon.com <Hennadiy.Kytsun@infineon.com>; Roman.Mazurak@infineon.com <Roman.Mazurak@infineon.com>; Nazar.Chornenkyy@infineon.com <Nazar.Chornenkyy@infineon.com>; Oleksii.Khyzhniak-EE@infineon.com <Oleksii.Khyzhniak-EE@infineon.com>
Subject: [TF-M] Arm v8 FPU questions
 

Hi all,

 

I have been working with FPU lately and I have a few questions regarding this topic:

 

Looks like there are 4 use cases of FPU usage:

FPU is used in

Use case number

SPE

NSPE

1

-

-

2

-

+

3

+

-

4

+

+

 

From https://tf-m-user-guide.trustedfirmware.org/integration_guide/tfm_fpu_support.html my understanding is following:

  1. If SPE and NSPE both does not use SPU (use case 1) then they both must be compiler with fp=soft?
  2. consistent FP ABI types between SPE and NSPE must be used. So even if only one of SPE or NSPE (use cases 2 and 3) does not use FPU they both still must be compiler with fp=hard
    Also if both SPE and NSPE use PFU then they both must be compiler with fp=hard
  3. Even if FPU is not used by NSPE, NSPE still MUST enable CP10 an CP11? – Is this correct? Is it possible to enable FPU for SPE but don’t enable CP10 and CP11 in NSPE?

 

So basically if either SPE or NSPE or both of them need to use FPU then both of them need to enable CP10 and CP11 and be compiled with fp=hard

 

Is my understanding correct? Inline comments are welcome.

 

 

Regards,

Bohdan Hunko

 

Cypress Semiconductor Ukraine

Engineer

CSUKR CSS ICW SW FW

Mobile: +38099 50 19 714
Bohdan.Hunko@infineon.com