summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zephyr/shim/include/builtin/assert.h5
-rw-r--r--zephyr/shim/src/panic.c5
-rw-r--r--zephyr/test/system_safe_mode/prj.conf1
3 files changed, 8 insertions, 3 deletions
diff --git a/zephyr/shim/include/builtin/assert.h b/zephyr/shim/include/builtin/assert.h
index 27dce8f2c4..e5e4a34b21 100644
--- a/zephyr/shim/include/builtin/assert.h
+++ b/zephyr/shim/include/builtin/assert.h
@@ -13,4 +13,9 @@
#define ASSERT __ASSERT_NO_MSG
#define assert __ASSERT_NO_MSG
+/* TODO(b/269175417): This should be handled in Zephyr __assert.h */
+#ifndef __ASSERT_UNREACHABLE
+#define __ASSERT_UNREACHABLE CODE_UNREACHABLE
+#endif
+
#endif /* __CROS_EC_ASSERT_H */
diff --git a/zephyr/shim/src/panic.c b/zephyr/shim/src/panic.c
index e7c13f746d..2e9068078b 100644
--- a/zephyr/shim/src/panic.c
+++ b/zephyr/shim/src/panic.c
@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
+#include "builtin/assert.h"
#include "common.h"
#include "panic.h"
#include "system_safe_mode.h"
@@ -169,9 +170,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
* the watchdog will overwrite this panic.
*/
panic_reboot();
-#ifndef TEST_BUILD
- CODE_UNREACHABLE;
-#endif
+ __ASSERT_UNREACHABLE;
}
void panic_set_reason(uint32_t reason, uint32_t info, uint8_t exception)
diff --git a/zephyr/test/system_safe_mode/prj.conf b/zephyr/test/system_safe_mode/prj.conf
index 22294e85d3..f7aeb4b776 100644
--- a/zephyr/test/system_safe_mode/prj.conf
+++ b/zephyr/test/system_safe_mode/prj.conf
@@ -11,6 +11,7 @@ CONFIG_SYSTEM_FAKE=y
CONFIG_PLATFORM_EC_SYSTEM_SAFE_MODE=y
CONFIG_TASK_HOSTCMD_THREAD_DEDICATED=y
CONFIG_PLATFORM_EC_HOSTCMD=y
+CONFIG_ASSERT_TEST=y
# Disable because not needed
CONFIG_PLATFORM_EC_BACKLIGHT_LID=n