mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-18 10:47:47 -04:00
Improve vAssertCalled function to include filename / line number info.
This commit is contained in:
parent
84ad9250da
commit
c6325a02ff
2 changed files with 44 additions and 31 deletions
|
@ -40,12 +40,24 @@
|
||||||
*----------------------------------------------------------*/
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
#define configASSERT_DEFINED 1
|
#define configASSERT_DEFINED 1
|
||||||
extern void vAssertCalled( void );
|
|
||||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()
|
extern void vAssertCalled( const char * pcFileName,
|
||||||
|
int line );
|
||||||
|
|
||||||
|
#define __NAME_ARG__ ( __builtin_strrchr( __BASE_FILE__, '/' ) ? __builtin_strrchr( __BASE_FILE__, '/' ) + 1 : __BASE_FILE__ )
|
||||||
|
|
||||||
|
#define configASSERT( x ) \
|
||||||
|
do { \
|
||||||
|
if( ( x ) == 0 ) { \
|
||||||
|
vAssertCalled( __NAME_ARG__, __LINE__ ); \
|
||||||
|
} \
|
||||||
|
} while( 0 )
|
||||||
|
|
||||||
|
|
||||||
#define configQUEUE_REGISTRY_SIZE 20
|
#define configQUEUE_REGISTRY_SIZE 20
|
||||||
|
|
||||||
#ifdef PICOLIBC_TLS
|
#ifdef PICOLIBC_TLS
|
||||||
#define configUSE_PICOLIBC_TLS 1
|
#define configUSE_PICOLIBC_TLS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define configUSE_PREEMPTION 1
|
#define configUSE_PREEMPTION 1
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
||||||
char * pcTaskName );
|
char * pcTaskName );
|
||||||
|
@ -125,23 +126,23 @@ void vApplicationTickHook( void )
|
||||||
}
|
}
|
||||||
#endif /* mainSELECTED_APPLICATION */
|
#endif /* mainSELECTED_APPLICATION */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vAssertCalled( void )
|
void vAssertCalled( const char * pcFileName,
|
||||||
|
int line )
|
||||||
{
|
{
|
||||||
volatile unsigned long looping = 0;
|
printf( "Assertion failed at %s: %d\n", pcFileName, line );
|
||||||
|
fflush( NULL );
|
||||||
|
|
||||||
taskENTER_CRITICAL();
|
while( 1 )
|
||||||
{
|
{
|
||||||
/* Use the debugger to set ul to a non-zero value in order to step out
|
asm ( "nop" );
|
||||||
* of this function to determine why it was called. */
|
|
||||||
while( looping == 0LU )
|
|
||||||
{
|
|
||||||
portNOP();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
taskEXIT_CRITICAL();
|
exit( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
void vLoggingPrintf( const char * pcFormat,
|
void vLoggingPrintf( const char * pcFormat,
|
||||||
... )
|
... )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue