Thank you for letting us know the problem when you are using TF-M, this is helpful for all stakeholder of TF-M.
- Queries
- All Stories
- Search
- Advanced Search
- Transactions
- Transaction Logs
Advanced Search
Jun 8 2021
Jun 3 2021
Jun 1 2021
In T921#10778, @ioannisg wrote:However, this is only a partial solution. That is because a Secure thread re-scheduling will clear the .FPCA flag, but leave the LSPACT set, meaning that a NS IRQ with FP instructions will trigger again an FP stacking. But this FP stacking will be done on the memory where FPCAR is pointing at, and FPCAR is only updated in exception entry, if .FPCA is set. As a result, it does not seem that you avoid a stack corruption.
Let me know if you've understood this argumentation, or you need more information.
May 27 2021
Please try to add code below just before setting NSACR in tfm_arch_config_extensions() and let me know the result. Thanks!
May 21 2021
I tried on my side with steps above, and I still cannot reproduce your issue.
Please confirm NSACR register is configured correctly, and check the FP related registers before the FP instruction causing crash.
May 17 2021
TF-M currently support "-mfloat-abi=soft" as default, but doesn't support the setting in Zephyr "-mfloat-abi=softfp". Because they are totally different things.
But why? These ABIs are link-compatible, I do not see the problem. GCC allows these binaries to link successfully.
I mean TF-M itself current FP option is "-mfloat-abi=soft", not the "-mfloat-abi=softfp" which is used in Zephyr. It doesn't matter with setting for Zephyr.
May 13 2021
This is the explanation for "FP_SOFTABI" in Zephyr.
"config FP_SOFTABI
bool "Floating point Soft ABI"
help
This option selects the Floating point ABI in which hardware floating point instructions are generated but soft-float calling conventions."
The first thing I want to confirm is "I compile zephyr and Tf-M with soft FP". As you know, TF-M is default with soft FP.
- But for Zephyr, are you using soft FP or hardware FP?
- Is it possible for you to share the compile options and linker options for the source file including the "Non-Secure interrupt" crashing?
- Is it possible to show the assembly code for the "Non-Secure interrupt"?
- Please have a try to disable lazy FP stacking, to see whether still crash.
May 11 2021
If you didn't change TF-M while integrating into your project, PSA call(handler mode) cannot be interrupted by non-secure interrupt like you mentioned, the reason is non-secure exceptions are de-prioritized (AIRCR.PRIS = 1) in TF-M.
Non-secure interrupt can only be active when system in thread mode.
Apr 30 2021
For the concern you mentioned, yes, we need to add extra steps in secure scheduler, I am still working on this part.
- When secure doing secure calls: a. if lazy fp is disabled, hardware will push/pop FP context automatically during exception entry/return. b. if lazy fp is enable, for isolation 1, secure scheduler will save and restore FP context, but not invalidate FP context; for isolation 2 and 3, secure scheduler will trigger lazy fp stacking, hardware will push FP context to thread' stack and invalidate them automatically.
- When non-secure doing secure calls, non-secure side will SG to secure world in tfm_nspm_thread_entry, then doing secure calls as same as above. FP context of non-secure can be restored when bxns lr to non-secure side.