freeRTOS随笔记录 Error:…\rtos\port\RVDS\ARM_CM3\port.c,244 configASSERT( uxCriticalNesting == ~0UL )
在使用freeRTOS的时候申请了三个任务,分别是串口数据解析,程序运行指示灯和网口任务解析
其中串口接受数据后解析的任务,使用了if - else if - else的语句,为了节省时间,在各个if else分支后加了一个return 用来结束if else的判断
程序运行的时候接受串口数据,执行命令,然后串口打印出一条断言
Error:…\rtos\port\RVDS\ARM_CM3\port.c,244
找到断言所在的地方,查看代码和注释
static void prvTaskExitError( void )
{
/* A function that implements a task must not exit or attempt to return to
its caller as there is nothing to return to. If a task wants to exit it
should instead call vTaskDelete( NULL ).
实现任务的函数不能退出或尝试返回其调用方,因为没有可返回的对象。
如果任务要退出,则应改为调用vTaskDelete(NULL)。
Artificially force an assert() to be triggered if configASSERT() is
defined, then stop here so application writers can catch the error.
如果定义了configASSERT(),则人工强制触发assert(),然后在此停止,
以便应用程序编写器可以捕获错误*/
configASSERT( uxCriticalNesting == ~0UL );
portDISABLE_INTERRUPTS();
for( ;; );
}
if(StringCompare2(Command1 ,&RxBuffer[0]) == 0) //字符串对比
{
PrintfHELP(); //打印帮助信息
}
else if(StringCompare2(Command2 ,&RxBuffer[0]) == 0)
{
printf("V1.0.0\r\n"); //打印版本信息
//return 0;
}
结合代码和注释来看,程序要么是没有执行,要么就是程序要返回,而我的代码是属于后者,由于不需要程序跳出循环,就把return给删除了,至此,问题解决