1 // SPDX-License-Identifier: BSD-3-Clause
2 /*
3  * Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved.
4  */
5 
6 #include "libc_platform.h"
7 #include "trace.h"
8 
9 /*
10  * The generic trace function called on assert fail.
11  */
platform_assert(const char * file,int line,const char * func,const char * failedexpr)12 void __noreturn platform_assert(const char *file, int line, const char *func,
13 				const char *failedexpr)
14 {
15 #if TRACE_LEVEL >= TRACE_LEVEL_ERROR
16 	ts_trace_printf(func, line, TRACE_LEVEL_ERROR, "assertion %s failed", failedexpr);
17 #endif /* TRACE_LEVEL */
18 
19 	while (1)
20 		;
21 }
22 
platform_abort(void)23 void __noreturn platform_abort(void)
24 {
25 #if TRACE_LEVEL >= TRACE_LEVEL_ERROR
26 	trace_puts("abort()");
27 #endif /* TRACE_LEVEL */
28 
29 	while (1)
30 		;
31 }
32