amiro-blt / Target / Source / assert.c @ 1446566f
History | View | Annotate | Download (3.542 KB)
1 | 69661903 | Thomas Schöpping | /************************************************************************************//** |
---|---|---|---|
2 | * \file Source\assert.c
|
||
3 | * \brief Bootloader assertion module source file.
|
||
4 | * \ingroup Core
|
||
5 | * \internal
|
||
6 | *----------------------------------------------------------------------------------------
|
||
7 | * C O P Y R I G H T
|
||
8 | *----------------------------------------------------------------------------------------
|
||
9 | * Copyright (c) 2011 by Feaser http://www.feaser.com All rights reserved
|
||
10 | *
|
||
11 | *----------------------------------------------------------------------------------------
|
||
12 | * L I C E N S E
|
||
13 | *----------------------------------------------------------------------------------------
|
||
14 | * This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
|
||
15 | * modify it under the terms of the GNU General Public License as published by the Free
|
||
16 | * Software Foundation, either version 3 of the License, or (at your option) any later
|
||
17 | * version.
|
||
18 | *
|
||
19 | * OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||
20 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||
21 | * PURPOSE. See the GNU General Public License for more details.
|
||
22 | *
|
||
23 | * You should have received a copy of the GNU General Public License along with OpenBLT.
|
||
24 | * If not, see <http://www.gnu.org/licenses/>.
|
||
25 | *
|
||
26 | * A special exception to the GPL is included to allow you to distribute a combined work
|
||
27 | * that includes OpenBLT without being obliged to provide the source code for any
|
||
28 | * proprietary components. The exception text is included at the bottom of the license
|
||
29 | * file <license.html>.
|
||
30 | *
|
||
31 | * \endinternal
|
||
32 | ****************************************************************************************/
|
||
33 | |||
34 | /****************************************************************************************
|
||
35 | * Include files
|
||
36 | ****************************************************************************************/
|
||
37 | #include "boot.h" /* bootloader generic header */ |
||
38 | |||
39 | |||
40 | #ifndef NDEBUG
|
||
41 | /****************************************************************************************
|
||
42 | * Local data declarations
|
||
43 | ****************************************************************************************/
|
||
44 | /** \brief Holds the filename in which the assertion occurred. */
|
||
45 | static volatile blt_char *assert_failure_file; |
||
46 | /** \brief Holds the linenumber where the assertion occurred. */
|
||
47 | static volatile blt_int32u assert_failure_line; |
||
48 | |||
49 | |||
50 | /************************************************************************************//** |
||
51 | ** \brief Called when a runtime assertion failed. It stores information about where
|
||
52 | ** the assertion occurred and halts the software program.
|
||
53 | ** \param file Name of the source file where the assertion occurred.
|
||
54 | ** \param line Linenumber in the source file where the assertion occurred.
|
||
55 | ** \return none
|
||
56 | **
|
||
57 | ****************************************************************************************/
|
||
58 | void AssertFailure(blt_char *file, blt_int32u line)
|
||
59 | { |
||
60 | /* store the file string and line number so that it can be read on a breakpoint*/
|
||
61 | assert_failure_file = file; |
||
62 | assert_failure_line = line; |
||
63 | /* hang the software so that it requires a hard reset */
|
||
64 | for(;;)
|
||
65 | { |
||
66 | /* keep servicing the watchdog so that this one does not cause a reset */
|
||
67 | CopService(); |
||
68 | } |
||
69 | } /*** end of AssertFailure ***/
|
||
70 | #endif /* !NDEBUG */ |
||
71 | |||
72 | |||
73 | /*********************************** end of assert.c ***********************************/
|