zephyr/lib/os/assert.c
Krzysztof Chruscinski 6904501173 misc: Add k_panic on assert
Replaced forever loop in assert with call to a function.
In post_assert_action() function, k_panic is called.

Forever loop was preventing logs to be printed and had behavior
ependent on the context (low prioriy thread - system continue to
ork, irq - system is blocked).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-02 15:58:33 -08:00

19 lines
301 B
C

/*
* Copyright (c) 2019 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <misc/__assert.h>
#include <zephyr.h>
void assert_post_action(void)
{
if (IS_ENABLED(CONFIG_ARCH_POSIX)) {
extern void posix_exit(int exit_code);
posix_exit(1);
} else {
k_panic();
}
}