(xTaskNotify)- assert failed! 错误的修复
2023-09-11 14:21:24 时间
今日在测试ESP32代码的时候,使用xTaskNotify发生错误,提示如下:
(xTaskNotify)- assert failed!
,然后系统重启。
找了一下原因,在xTaskNotify()
之前先打印对应的task_handle
,结果是NULL。
if(target_task_handle != NULL){
xTaskNotify((TaskHandle_t )target_task_handle, //接收任务通知的任务句柄
(uint32_t )bit_lock_onoff,
(eNotifyAction )eSetBits);
}else{
ESP_LOGI("xTaskNotify","NULL pointer");
}
然后找到创建任务的代码,发现最后一个参数使用了target_task_handle
。编译和运行不会报错,但是使用target_task_handle
向任务传递消息的时候就不行了。原因是xTaskCreate
的handle参数应该使用地址&target_task_handle
。修改后问题解决。
ps: esp-idf里面也有一部分代码有类似的错误…
比如这里:
相关文章
- Eclipse 报 “Exception in thread "main" java.lang.OutOfMemoryError: Java heap space ”错误的解决办法
- WSL(Linux子系统) gedit 报错 failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
- Deepin v20依赖错误,检测更新失败解决办法
- IIS 服务或万维网发布服务,或者依赖这 服务可能在启动期间发生错误或者已禁用
- [Trading] 建立一个日内交易例程来避免错误
- 81. 使用 SAP ABAP Memory Inspector 对应用程序消耗内存进行检测时常犯的错误
- 如何处理WebIDE里运行UI5应用遇到的404 not found错误
- Rxjs SwitchMap 的一些容易犯的错误和替代方案
- SAP Cloud for Customer前台发送到后台的HTTP请求,遇到错误该怎么分析
- 使用 cx recipe 安装 Hybris Commerce Cloud 之后,遇到 indexer workder failed 错误
- IIS 服务或万维网发布服务,或者依赖这 服务可能在启动期间发生错误或者已禁用
- INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl1631409119.tmp/base.ap
- [转载]Go的50度灰:Golang新开发者要注意的陷阱和常见错误
- jumpserver 常见错误解决
- Failed to create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container..
- 使用VC2005编译出现这个错误
- PyQt5系列(三)Python3.x AttributeError: module 'string' has no attribute 'maketrans'错误解决
- Win10解决Android Studio:Gradle sync failed: Failed to open zip file.