From 2bd15ce24a8901eb0ee615b5ac94b706c8f205cf Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Thu, 27 May 2021 17:53:16 +0200 Subject: [PATCH] tests: error_hook skipping div-by-0 test on cortex M0 M0+ On the Cortex M0+, M0, M23 the div-by-zero is not mapped as an hardware exception but triggers a HardFault. The test case is skipped for any ARMV6_M_ARMV8_M_BASELINE. Signed-off-by: Francois Ramu --- tests/ztest/error_hook/src/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/ztest/error_hook/src/main.c b/tests/ztest/error_hook/src/main.c index b8468889732..d17993dc132 100644 --- a/tests/ztest/error_hook/src/main.c +++ b/tests/ztest/error_hook/src/main.c @@ -110,9 +110,13 @@ __no_optimization static void trigger_fault_divide_zero(void) * an exception for divide zero. They might need to enable the divide * zero exception. We only skip the QEMU board here, this means this * test will still apply on the physical board. + * For the Cortex-M0, M0+, M23 (CONFIG_ARMV6_M_ARMV8_M_BASELINE) + * which does not include a divide instruction, the test is skipped, + * and there will be no hardware exception for that. */ #if (defined(CONFIG_SOC_SERIES_MPS2) && defined(CONFIG_QEMU_TARGET)) || \ - defined(CONFIG_BOARD_QEMU_CORTEX_A53) || defined(CONFIG_SOC_QEMU_ARC) + defined(CONFIG_BOARD_QEMU_CORTEX_A53) || defined(CONFIG_SOC_QEMU_ARC) || \ + defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) ztest_test_skip(); #endif }