am_hal_debug.c 3.3 KB

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