Comments (5)
To minimize assert implementations we did this in eRPC project:
taskDISABLE_INTERRUPTS() can be handy in examples asserts
from mcux-sdk-examples.
From experience i would say it could looks like (maybe not all cases covered):
FreertosConfig.h:
#include <assert.h>
#define configASSERT(x) assert(x)
fsl_assert.c:
/*
* Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
* Copyright 2016-2017 NXP
* All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "fsl_common.h"
#include "fsl_debug_console.h"
#if defined(__has_include)
#if __has_include("FreeRTOSConfig.h")
#undef ERPC_HAS_FREERTOSCONFIG_H
#define ERPC_HAS_FREERTOSCONFIG_H (1)
#endif
#endif
#if ERPC_HAS_FREERTOSCONFIG_H
#include "FreeRTOS.h"
#include "task.h"
#endif
#ifndef NDEBUG
#if (defined(__CC_ARM)) || (defined(__ARMCC_VERSION)) || (defined(__ICCARM__))
void __aeabi_assert(const char *failedExpr, const char *file, int line)
{
#if ERPC_HAS_FREERTOSCONFIG_H
if (xPortIsInsideInterrupt() == pdFALSE)
{
taskDISABLE_INTERRUPTS();
}
#endif
#if SDK_DEBUGCONSOLE == DEBUGCONSOLE_DISABLE
PRINTF("ASSERT ERROR \" %s \": file \"%s\" Line \"%d\" \n", failedExpr, file, line);
#else
(void)PRINTF("ASSERT ERROR \" %s \": file \"%s\" Line \"%d\" \n", failedExpr, file, line);
#endif
for (;;)
{
__BKPT(0);
}
}
#elif (defined(__GNUC__))
#if defined(__REDLIB__)
void __assertion_failed(char *failedExpr)
{
#if ERPC_HAS_FREERTOSCONFIG_H
if (xPortIsInsideInterrupt() == pdFALSE)
{
taskDISABLE_INTERRUPTS();
}
#endif
(void)PRINTF("ASSERT ERROR \" %s \n", failedExpr);
for (;;)
{
__BKPT(0);
}
}
#else
void __assert_func(const char *file, int line, const char *func, const char *failedExpr)
{
#if ERPC_HAS_FREERTOSCONFIG_H
if (xPortIsInsideInterrupt() == pdFALSE)
{
taskDISABLE_INTERRUPTS();
}
#endif
(void)PRINTF("ASSERT ERROR \" %s \": file \"%s\" Line \"%d\" function name \"%s\" \n", failedExpr, file, line,
func);
for (;;)
{
__BKPT(0);
}
}
#endif /* defined(__REDLIB__) */
#endif /* (defined(__CC_ARM) || (defined(__ICCARM__)) || (defined(__ARMCC_VERSION)) */
#endif /* NDEBUG */
from mcux-sdk-examples.
@mcuxsusan Any inputs here?
from mcux-sdk-examples.
Related Issues (13)
- evkmimx8mm: missing pinmux call HOT 4
- USB audio examples lpc54114 and RT600 HOT 4
- Release examples in csolution format HOT 1
- The RDC example does not work on evkmimx8mp HOT 3
- Please add License File to this repo HOT 1
- Can't find any examples for K32W148
- usb audio class device not cross platform HOT 3
- Bluetooth applications removed from evkmimxrt1060 examples
- Multicore armgcc examples "cannot" be built. HOT 6
- rt1170-EVK Error 404 uSD Jumpers not found. HOT 7
- rt1170 m4 swd armgcc examples not working if not used basic debug/release target (e.g sdram debug/release or flexspi_nor debug/release target is used). HOT 13
- RT1170-EVK - Bluetooth not working with AW-AM457MA-D module HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mcux-sdk-examples.