summaryrefslogtreecommitdiff
path: root/bsp/smartfusion2/CMSIS/mss_assert.h
blob: edec5c1609fa8df3a1be861b5d39fb237dff3763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*******************************************************************************
 * (c) Copyright 2009-2013 Microsemi SoC Products Group. All rights reserved.
 * 
 * Assertion implementation.
 *
 * This file provides the implementation of the ASSERT macro. This file can be
 * modified to cater for project specific requirements regarding the way
 * assertions are handled.
 *
 * SVN $Revision: 6422 $
 * SVN $Date: 2014-05-14 14:37:56 +0100 (Wed, 14 May 2014) $
 */
#ifndef __MSS_ASSERT_H_
#define __MSS_ASSERT_H_

#if defined(NDEBUG)

#define ASSERT(CHECK)

#else   /* NDEBUG */

#include <assert.h>

#if defined ( __GNUC__   )

/*
 * SoftConsole assertion handling
 */
#define ASSERT(CHECK)  \
    do { \
        if (!(CHECK)) \
        { \
            __asm volatile ("BKPT\n\t"); \
        } \
    } while (0);
    
#elif defined ( __ICCARM__ )
/*
 * IAR Embedded Workbench assertion handling.
 * Call C library assert function which should result in error message
 * displayed in debugger.
 */
#define ASSERT(X)   assert(X)

#else
/*
 * Keil assertion handling.
 * Call C library assert function which should result in error message
 * displayed in debugger.
 */

#ifndef __MICROLIB
  #define ASSERT(X)   assert(X)
#else
  #define ASSERT(X)
#endif

#endif  /* Tool Chain */

#endif  /* NDEBUG */

#endif  /* __MSS_ASSERT_H_ */