2013-12-17 18:19:04 +00:00
|
|
|
/*
|
2019-07-26 12:21:39 +01:00
|
|
|
* Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
|
2013-12-17 18:19:04 +00:00
|
|
|
*
|
2017-05-03 09:38:09 +01:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2013-12-17 18:19:04 +00:00
|
|
|
*/
|
|
|
|
|
2017-05-16 09:52:02 +01:00
|
|
|
#include <assert.h>
|
2018-08-16 16:52:57 +01:00
|
|
|
#include <cdefs.h>
|
2018-08-16 16:46:06 +01:00
|
|
|
#include <stdio.h>
|
2013-12-17 18:19:04 +00:00
|
|
|
|
2018-12-14 00:18:21 +00:00
|
|
|
#include <common/debug.h>
|
|
|
|
#include <drivers/console.h>
|
|
|
|
#include <plat/common/platform.h>
|
|
|
|
|
2017-05-16 09:52:02 +01:00
|
|
|
/*
|
2018-08-16 14:53:05 +01:00
|
|
|
* Only print the output if PLAT_LOG_LEVEL_ASSERT is higher or equal to
|
|
|
|
* LOG_LEVEL_INFO, which is the default value for builds with DEBUG=1.
|
|
|
|
*/
|
2017-02-16 16:17:19 +00:00
|
|
|
|
2017-05-16 09:52:02 +01:00
|
|
|
#if PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_VERBOSE
|
2019-07-26 12:21:39 +01:00
|
|
|
void __dead2 __assert(const char *file, unsigned int line,
|
|
|
|
const char *assertion)
|
2017-05-16 09:52:02 +01:00
|
|
|
{
|
2018-08-16 16:46:06 +01:00
|
|
|
printf("ASSERT: %s:%d:%s\n", file, line, assertion);
|
2018-08-23 15:13:58 +01:00
|
|
|
backtrace("assert");
|
|
|
|
(void)console_flush();
|
2017-02-16 16:49:18 +00:00
|
|
|
plat_panic_handler();
|
2013-12-17 18:19:04 +00:00
|
|
|
}
|
2017-05-16 09:52:02 +01:00
|
|
|
#elif PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO
|
2019-07-26 12:21:39 +01:00
|
|
|
void __dead2 __assert(const char *file, unsigned int line)
|
2017-05-16 09:52:02 +01:00
|
|
|
{
|
2018-08-16 16:46:06 +01:00
|
|
|
printf("ASSERT: %s:%d\n", file, line);
|
2018-08-23 15:13:58 +01:00
|
|
|
backtrace("assert");
|
|
|
|
(void)console_flush();
|
2017-05-16 09:52:02 +01:00
|
|
|
plat_panic_handler();
|
|
|
|
}
|
|
|
|
#else
|
2019-07-26 12:21:39 +01:00
|
|
|
void __dead2 __assert(void)
|
2017-05-16 09:52:02 +01:00
|
|
|
{
|
2018-08-23 15:13:58 +01:00
|
|
|
backtrace("assert");
|
|
|
|
(void)console_flush();
|
2017-05-16 09:52:02 +01:00
|
|
|
plat_panic_handler();
|
|
|
|
}
|
|
|
|
#endif
|