当前位置:网站首页>Dead loop in FreeRTOS task function
Dead loop in FreeRTOS task function
2022-07-06 11:59:00 【Weiyuan escort agency】
The task function is an infinite loop function with no return value .
The task must be an endless cycle , Otherwise, the task will pass LR return , If LR Pointing to illegal memory will generate HardFault_Handler, and FreeRTOS Point to a dead cycle , Then the task will be executed in the dead loop after it returns , Such a task is not safe .
This should be avoided when programming , Tasks are usually closed-loop and have no return value .
If it's a single task , Delete after one execution , It will not affect the operation of the system , therefore , Remember to delete tasks that are only executed once after execution . namely At the end of the mission , add vTaskDelete(NULL)
.
In the circular task The delay function must use FreeRTOS The delay function provided inside , We can't use the kind of delay in bare metal programming . The difference between these two delays is FreeRTOS The delay inside is blocking delay , That is to call vTaskDelay() Function , The current task will be suspended , The scheduler switches to other ready tasks , So as to realize multitasking . If you still use the delay in bare metal programming , Then the whole task becomes an endless cycle , If it happens, the priority of this task is the highest , Then the system will always run in this task , Tasks with lower priority cannot be run , There is no way to multitask .
When the task enters the delay , Because there is no other user task ready , Then the system will enter idle tasks , Idle tasks are FreeRTOS A task started by the system itself , The lowest priority . When the whole system has no ready task , The system must ensure that there is a task running , Idle tasks are designed for this . When the user task delay expires , It will switch back from idle task to user task .
边栏推荐
猜你喜欢
[yarn] yarn container log cleaning
Linux yum安装MySQL
Password free login of distributed nodes
FTP文件上传文件实现,定时扫描文件夹上传指定格式文件文件到服务器,C语言实现FTP文件上传详解及代码案例实现
Comparison of solutions of Qualcomm & MTK & Kirin mobile platform USB3.0
RT-Thread的main线程“卡死”的一种可能原因及解决方案
分布式節點免密登錄
优先级反转与死锁
ESP8266使用arduino连接阿里云物联网
Characteristics, task status and startup of UCOS III
随机推荐
4、安装部署Spark(Spark on Yarn模式)
Linux Yum install MySQL
分布式事务的实现方案
Basic knowledge of lithium battery
Gallery's image browsing and component learning
Reading notes of difficult career creation
Small L's test paper
Word排版(小計)
电商数据分析--用户行为分析
Detailed explanation of Union [C language]
Internet protocol details
分布式节点免密登录
物联网系统框架学习
inline详细讲解【C语言】
Mall project -- day09 -- order module
电商数据分析--薪资预测(线性回归)
【CDH】CDH5.16 配置 yarn 任务集中分配设置不生效问题
{one week summary} take you into the ocean of JS knowledge
Machine learning -- linear regression (sklearn)
Reno7 60W super flash charging architecture