1 /*
2  * Copyright (c) 2024, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef __TFM_PRIV_ASSERT_H__
8 #define __TFM_PRIV_ASSERT_H__
9 
10 #include <string.h>
11 #include "tfm_spm_log.h"
12 #include <assert.h>
13 
14 #ifndef NDEBUG
15 #define SPM_ASSERT(cond)                                \
16             do {                                        \
17                 if (!(cond)) {                          \
18                     SPMLOG_INFMSG("Assert:");           \
19                     SPMLOG_INFMSG(__func__);            \
20                     SPMLOG_INFMSGVAL(",", __LINE__);    \
21                     while (1) {                         \
22                         ;                               \
23                     }                                   \
24                 }                                       \
25             } while (0)
26 #else
27 #define SPM_ASSERT(cond)
28 #endif
29 
30 #define assert(cond) SPM_ASSERT(cond)
31 
32 #endif /* __TFM_PRIV_ASSERT_H__ */
33