prvTaskExitError异常退出,FreeRTOS启动失败分析
FreeRTOS报错信息如下Error:…\src\freertos\portable\RVDS\ARM_CM4F\port.c,233根据断言信息报错位置为port.c文件第233行查看源代码staticvoidprvTaskExitError(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 ). * * Artificially force an assert() to be triggered if configASSERT() is * defined, then stop here so application writers can catch the error. */configASSERT(uxCriticalNesting~0UL);portDISABLE_INTERRUPTS();for(;;){}}发现是执行了prvTaskExitError函数再根据官方文件注释FreeRTOS中规定任务不能退出如果要退出只能调用vTaskDelete( NULL )否则就会异常报错根据这个提示检查各个任务是不是有异常退出。如果有多个任务可以对在prvTaskExitError函数中增加调试代码打印任务名称如下staticvoidprvTaskExitError(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 ). * * Artificially force an assert() to be triggered if configASSERT() is * defined, then stop here so application writers can catch the error. */TaskHandle_t xTaskxTaskGetCurrentTaskHandle();constchar*pcTaskNamepcTaskGetName(xTask);printf(Error:Task %s exited unexpectedly!\r\n,pcTaskName);configASSERT(uxCriticalNesting~0UL);portDISABLE_INTERRUPTS();for(;;){}}再次运行即可打印出任务名称从而具体分析某个任务Error:Task ftp_server exited unexpectedly!Error:…\src\freertos\portable\RVDS\ARM_CM4F\port.c,237可以看出导致异常退出的任务是ftp_server分析ftp_server任务发现是有return返回的地方导致任务异常退出了。
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2410537.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!