1 //*****************************************************************************
2 //
3 //! @file am_hal_debug.c
4 //!
5 //! @brief Useful Functions for Debugging.
6 //!
7 //! These functions and macros were created to assist with debugging. They are
8 //! intended to be as unintrusive as possible and designed to be removed from
9 //! the compilation of a project when they are no longer needed.
10 //!
11 //! @addtogroup haldebug3 Debug - HAL Debug/Assert Utilities
12 //! @ingroup apollo3_hal
13 //! @{
14 //
15 //*****************************************************************************
16 
17 //*****************************************************************************
18 //
19 // Copyright (c) 2024, Ambiq Micro, Inc.
20 // All rights reserved.
21 //
22 // Redistribution and use in source and binary forms, with or without
23 // modification, are permitted provided that the following conditions are met:
24 //
25 // 1. Redistributions of source code must retain the above copyright notice,
26 // this list of conditions and the following disclaimer.
27 //
28 // 2. Redistributions in binary form must reproduce the above copyright
29 // notice, this list of conditions and the following disclaimer in the
30 // documentation and/or other materials provided with the distribution.
31 //
32 // 3. Neither the name of the copyright holder nor the names of its
33 // contributors may be used to endorse or promote products derived from this
34 // software without specific prior written permission.
35 //
36 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
40 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
41 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 // POSSIBILITY OF SUCH DAMAGE.
47 //
48 // This is part of revision release_sdk_3_2_0-dd5f40c14b of the AmbiqSuite Development Package.
49 //
50 //*****************************************************************************
51 
52 #include <stdint.h>
53 #include <stdbool.h>
54 #include "am_mcu_apollo.h"
55 
56 #if defined (__IAR_SYSTEMS_ICC__)
57 __weak void
58 #else
59 void __attribute__((weak))
60 #endif
61 //*****************************************************************************
62 //
63 //! @brief Default implementation of a failed ASSERT statement.
64 //!
65 //! @param pcFile is the name of the source file where the error occurred.
66 //! @param ui32Line is the line number where the error occurred.
67 //! @param pcMessage is an optional message describing the failure.
68 //!
69 //! This function is called by am_hal_debug_assert() macro when the supplied
70 //! condition is not true. The implementation here simply halts the application
71 //! for further analysis. Individual applications may define their own
72 //! implementations of am_hal_debug_error() to provide more detailed feedback
73 //! about the failed am_hal_debug_assert() statement.
74 //!
75 //! @note this function never returns
76 //
77 //*****************************************************************************
am_hal_debug_error(const char * pcFile,uint32_t ui32Line,const char * pcMessage)78 am_hal_debug_error(const char *pcFile, uint32_t ui32Line, const char *pcMessage)
79 {
80     //
81     // Halt for analysis.
82     //
83     while(1);
84 }
85 
86 //*****************************************************************************
87 //
88 // End Doxygen group.
89 //! @}
90 //
91 //*****************************************************************************
92