1 /*
2  * Copyright (c) 2017 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #include <zephyr/kernel.h>
7 #include <zephyr/ztest.h>
8 
9 ZTEST_BMEM volatile bool valid_fault;
10 
k_sys_fatal_error_handler(unsigned int reason,const struct arch_esf * pEsf)11 void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
12 {
13 	printk("Caught system error -- reason %d %d\n", reason, valid_fault);
14 	if (valid_fault) {
15 		printk("fatal error expected as part of test case\n");
16 		valid_fault = false; /* reset back to normal */
17 	} else {
18 		printk("fatal error was unexpected, aborting\n");
19 		TC_END_REPORT(TC_FAIL);
20 		k_fatal_halt(reason);
21 	}
22 }
23