Skip to content

Commit ba7fda7

Browse files
stephanosionashif
authored andcommitted
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 <[email protected]>
1 parent 06b1501 commit ba7fda7

File tree

1 file changed

+11
-1
lines changed
  • tests/arch/arm/arm_no_multithreading/src

1 file changed

+11
-1
lines changed

tests/arch/arm/arm_no_multithreading/src/main.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@
1313
#error test can only run on Cortex-M MCUs
1414
#endif
1515

16+
#if defined(CONFIG_ARMV8_1_M_MAINLINE)
17+
/*
18+
* For ARMv8.1-M, the FPSCR[18:16] LTPSIZE field may always read 0b010 if MVE
19+
* is not implemented, so mask it when validating the value of the FPSCR.
20+
*/
21+
#define FPSCR_MASK (~FPU_FPDSCR_LTPSIZE_Msk)
22+
#else
23+
#define FPSCR_MASK (0xffffffffU)
24+
#endif
25+
1626
extern K_THREAD_STACK_DEFINE(z_main_stack, CONFIG_MAIN_STACK_SIZE);
1727

1828
static volatile int test_flag;
@@ -58,7 +68,7 @@ void test_main(void)
5868
psp, main_stack_base, main_stack_top);
5969

6070
#if defined(CONFIG_FPU)
61-
__ASSERT(__get_FPSCR() == 0,
71+
__ASSERT((__get_FPSCR() & FPSCR_MASK) == 0,
6272
"FPSCR not zero (0x%x)", __get_FPSCR());
6373
#endif
6474

0 commit comments

Comments
 (0)