arch: arm: aarch32: clear CONTROL.FPCA for every CPU that has a FPU
Upon reset, the CONTROL.FPCA bit is, normally, cleared. However, it might be left un-cleared by firmware running before Zephyr boot, for example when Zephyr image is loaded by another image. We must clear this bit to prevent errors in exception unstacking. This caused stack offset when booting from a build-in EFM32GG bootloader Fixes #22977 Signed-off-by: Luuk Bosma <l.bosma@interay.com>
This commit is contained in:
parent
cc21aba55f
commit
dfb80526b4
1 changed files with 13 additions and 0 deletions
|
@ -144,6 +144,19 @@ static inline void z_arm_floating_point_init(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif /* CONFIG_FLOAT */
|
#endif /* CONFIG_FLOAT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Upon reset, the CONTROL.FPCA bit is, normally, cleared. However,
|
||||||
|
* it might be left un-cleared by firmware running before Zephyr boot.
|
||||||
|
* We must clear this bit to prevent errors in exception unstacking.
|
||||||
|
*
|
||||||
|
* Note:
|
||||||
|
* In Sharing FP Registers mode CONTROL.FPCA is cleared before switching
|
||||||
|
* to main, so it may be skipped here (saving few boot cycles).
|
||||||
|
*/
|
||||||
|
#if !defined(CONFIG_FLOAT) || !defined(CONFIG_FP_SHARING)
|
||||||
|
__set_CONTROL(__get_CONTROL() & (~(CONTROL_FPCA_Msk)));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_CPU_HAS_FPU */
|
#endif /* CONFIG_CPU_HAS_FPU */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue