tests: arch: arm_no_multithreading: Fix FPSCR validation for ARMv8.1-M

This commit fixes the FPSCR register initialisation validation test
for the ARMv8.1-M architecture.

For ARMv8.1-M, the newly added LTPSIZE field in the FPSCR may always
read the value of 4 when the M-Profile Vector Extension (MVE) is not
implemented or FP context is not active, so we must ignore its value
when validating the FPSCR register initialisation.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2021-08-25 03:26:51 +09:00 committed by Anas Nashif
commit ba7fda70ff

View file

@ -13,6 +13,16 @@
#error test can only run on Cortex-M MCUs #error test can only run on Cortex-M MCUs
#endif #endif
#if defined(CONFIG_ARMV8_1_M_MAINLINE)
/*
* For ARMv8.1-M, the FPSCR[18:16] LTPSIZE field may always read 0b010 if MVE
* is not implemented, so mask it when validating the value of the FPSCR.
*/
#define FPSCR_MASK (~FPU_FPDSCR_LTPSIZE_Msk)
#else
#define FPSCR_MASK (0xffffffffU)
#endif
extern K_THREAD_STACK_DEFINE(z_main_stack, CONFIG_MAIN_STACK_SIZE); extern K_THREAD_STACK_DEFINE(z_main_stack, CONFIG_MAIN_STACK_SIZE);
static volatile int test_flag; static volatile int test_flag;
@ -58,7 +68,7 @@ void test_main(void)
psp, main_stack_base, main_stack_top); psp, main_stack_base, main_stack_top);
#if defined(CONFIG_FPU) #if defined(CONFIG_FPU)
__ASSERT(__get_FPSCR() == 0, __ASSERT((__get_FPSCR() & FPSCR_MASK) == 0,
"FPSCR not zero (0x%x)", __get_FPSCR()); "FPSCR not zero (0x%x)", __get_FPSCR());
#endif #endif