blob: 97fab4b0f2c4cdfdce01738fd5d180d07b390510 [file] [log] [blame]
Harry Liebel0f702c62013-12-17 18:19:04 +00001/*
Antonio Nino Diaze3962d02017-02-16 16:17:19 +00002 * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
Harry Liebel0f702c62013-12-17 18:19:04 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Harry Liebel0f702c62013-12-17 18:19:04 +00005 */
6
Antonio Nino Diaz11a6e9d2017-05-16 09:52:02 +01007#include <assert.h>
Antonio Nino Diaze3962d02017-02-16 16:17:19 +00008#include <console.h>
Soby Mathewafe7e2f2014-06-12 17:23:58 +01009#include <debug.h>
Antonio Nino Diaze3962d02017-02-16 16:17:19 +000010#include <platform.h>
Harry Liebel0f702c62013-12-17 18:19:04 +000011
Antonio Nino Diaz11a6e9d2017-05-16 09:52:02 +010012/*
13* Only print the output if PLAT_LOG_LEVEL_ASSERT is higher or equal to
14* LOG_LEVEL_INFO, which is the default value for builds with DEBUG=1.
15*/
Antonio Nino Diaze3962d02017-02-16 16:17:19 +000016
Antonio Nino Diaz11a6e9d2017-05-16 09:52:02 +010017#if PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_VERBOSE
18void __assert(const char *file, unsigned int line, const char *assertion)
19{
Roberto Vargasfe42f9c2017-07-18 16:02:50 +010020 tf_printf("ASSERT: %s:%d:%s\n", file, line, assertion);
Antonio Nino Diaze3962d02017-02-16 16:17:19 +000021 console_flush();
Antonio Nino Diaz11a6e9d2017-05-16 09:52:02 +010022 plat_panic_handler();
23}
24#elif PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO
25void __assert(const char *file, unsigned int line)
26{
Roberto Vargasfe42f9c2017-07-18 16:02:50 +010027 tf_printf("ASSERT: %s:%d\n", file, line);
Antonio Nino Diaz11a6e9d2017-05-16 09:52:02 +010028 console_flush();
29 plat_panic_handler();
30}
31#else
32void __assert(void)
33{
Antonio Nino Diaze98fa3a2017-02-16 16:49:18 +000034 plat_panic_handler();
Harry Liebel0f702c62013-12-17 18:19:04 +000035}
Antonio Nino Diaz11a6e9d2017-05-16 09:52:02 +010036#endif