blob: 301d1429faa908c1de07d601147fcbbb562ed0c3 [file] [log] [blame]
Imre Kisf55f2aa2024-05-28 15:55:19 +02001/*
2 * Copyright (c) 2013-2022, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <assert.h>
8#include <cdefs.h>
9#include <stdio.h>
10
11#include <common/debug.h>
12#include <drivers/console.h>
13#include <plat/common/platform.h>
14
15/*
16 * Only print the output if PLAT_LOG_LEVEL_ASSERT is higher or equal to
17 * LOG_LEVEL_INFO, which is the default value for builds with DEBUG=1.
18 */
19
20#if PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO
21void __dead2 __assert(const char *file, unsigned int line)
22{
23 printf("ASSERT: %s:%u\n", file, line);
24 backtrace("assert");
25 console_flush();
26 plat_panic_handler();
27}
28#else
29void __dead2 __assert(void)
30{
31 backtrace("assert");
32 console_flush();
33 plat_panic_handler();
34}
35#endif