stacking issue in psa_call when FP was enabled
Closed, ResolvedPublic

Description

From tfm_svcall_psa_call()

/*
* FixMe: 5th parameter is pushed at stack top before SVC; plus
* exception stacked contents, 5th parameter is now at 8th position
* in SVC handler. However, if thread mode applies FloatPoint, then
* FloatPoint context is pushed into stack and then 5th parameter
* will not be args[8].
* Will refine it later.
*/

we are seeing this issue on a platform with M33-FE core

orenc17 created this task.Sun, Mar 10, 11:49 AM

We are experiencing this issue on the NXP LPC55S69 MCU, which is Cortex-M33-FE core.

Inside the svc_handler if you check LR, which holds EXC_RETURN.

If the case of thread mode using Floating point, the stack frame type bit (4) should be 0 which indicates 26 words (instead of the regular 8).

Hi @mikisch81,
Since you have found the root cause, can you provide a fix for that? You can push to branch feature-ipc.
Thanks.

-Ken

We are currently pre-occupied with the 5.12 release, you can look at Mbed-os PR#10027 to see how we solved this issue.

The patch is created, do the test now. Expect to publish it soon for review.
Thanks.

@mikisch81
A short question, has your platform defined __FPU_PRESENT=1?

To create a patch we need to cover more cases; so we need to include the FP related operations with __FPU_USED=1.

@KenLSoft Yes, our platform (LPC55S69 by NXP) does defined __FPU_PRESENT=1U.

KenLSoft closed this task as Resolved.Mon, Mar 18, 1:42 AM