fsl_assert.c 901 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
  3. * Copyright 2016-2017 NXP
  4. * All rights reserved.
  5. *
  6. *
  7. * SPDX-License-Identifier: BSD-3-Clause
  8. */
  9. #include "fsl_common.h"
  10. #include "fsl_debug_console.h"
  11. #ifndef NDEBUG
  12. #if (defined(__CC_ARM)) || (defined(__ARMCC_VERSION)) || (defined(__ICCARM__))
  13. void __aeabi_assert(const char *failedExpr, const char *file, int line)
  14. {
  15. PRINTF("ASSERT ERROR \" %s \": file \"%s\" Line \"%d\" \n", failedExpr, file, line);
  16. for (;;)
  17. {
  18. __BKPT(0);
  19. }
  20. }
  21. #elif(defined(__GNUC__))
  22. void __assert_func(const char *file, int line, const char *func, const char *failedExpr)
  23. {
  24. PRINTF("ASSERT ERROR \" %s \": file \"%s\" Line \"%d\" function name \"%s\" \n", failedExpr, file, line, func);
  25. for (;;)
  26. {
  27. __BKPT(0);
  28. }
  29. }
  30. #endif /* (defined(__CC_ARM) || (defined(__ICCARM__)) || (defined(__ARMCC_VERSION)) */
  31. #endif /* NDEBUG */