arch: arm: cortex_m: Modifed FPU save and restore helpers

z_arm_save_fp_context and z_arm_restore_fp_context
save and restore fpu context regardless of the
CONFIG_FPU_SHARING setting.

This modification is required to support suspend to ram use cases
where save and restore of FPU state is needed to ensure proper bahaviour
after wakeup.

Signed-off-by: Michele Sardo <michele.sardo@st.com>
This commit is contained in:
Michele Sardo 2025-07-14 22:50:28 +02:00 committed by Anas Nashif
parent 6cc046061e
commit 5981dc8ee1

View File

@ -16,7 +16,7 @@
void z_arm_save_fp_context(struct fpu_ctx_full *buffer)
{
#if defined(CONFIG_FPU_SHARING)
#if defined(CONFIG_FPU)
__ASSERT_NO_MSG(buffer != NULL);
uint32_t CONTROL = __get_CONTROL();
@ -44,7 +44,7 @@ void z_arm_save_fp_context(struct fpu_ctx_full *buffer)
void z_arm_restore_fp_context(const struct fpu_ctx_full *buffer)
{
#if defined(CONFIG_FPU_SHARING)
#if defined(CONFIG_FPU)
if (buffer->ctx_saved) {
/* Set FPCA first so it is set even if an interrupt happens
* during restoration.