Remove TF-A specific assert and abort
Replace TF-A specific assert and abort handlers by platform_ functions
which should be implemented by the environment.
Signed-off-by: Imre Kis <imre.kis@arm.com>
Change-Id: I613cede8d85919aaaa175ac20d2ed4f4b1abef40
diff --git a/components/common/libc/include/assert.h b/components/common/libc/include/assert.h
index acfd147..6a886db 100644
--- a/components/common/libc/include/assert.h
+++ b/components/common/libc/include/assert.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -9,26 +9,12 @@
#include <cdefs.h>
-#include <common/debug.h>
+#ifndef NDEBUG
+void __dead2 __assert(const char *file, int line, const char *func, const char *assertion);
-#ifndef PLAT_LOG_LEVEL_ASSERT
-#define PLAT_LOG_LEVEL_ASSERT LOG_LEVEL
-#endif
-
-#if ENABLE_ASSERTIONS
-# if PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO
-# define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__))
-# else
-# define assert(e) ((e) ? (void)0 : __assert())
-# endif
+#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, __func__, #e))
#else
-#define assert(e) ((void)0)
-#endif /* ENABLE_ASSERTIONS */
-
-#if PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO
-void __dead2 __assert(const char *file, unsigned int line);
-#else
-void __dead2 __assert(void);
+#define assert(e) ((void)(e))
#endif
#endif /* ASSERT_H */
diff --git a/components/common/libc/include/libc_platform.h b/components/common/libc/include/libc_platform.h
new file mode 100644
index 0000000..77c5706
--- /dev/null
+++ b/components/common/libc/include/libc_platform.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved.
+ */
+
+#ifndef LIBC_PLATFORM_H_
+#define LIBC_PLATFORM_H_
+
+#include <cdefs.h>
+
+/*
+ * Generic assert fail and abort handler function definitions.
+ * Should be implemented by the environment.
+ */
+void __dead2 platform_assert(const char *file, int line, const char *func,
+ const char *failedexpr);
+
+void __dead2 platform_abort(void);
+
+#endif /* LIBC_PLATFORM_H_ */