当前位置:网站首页>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 .
边栏推荐
- arduino获取数组的长度
- Pytorch-温度预测
- Selective sorting and bubble sorting [C language]
- Some concepts often asked in database interview
- Wangeditor rich text reference and table usage
- Password free login of distributed nodes
- RT-Thread API参考手册
- FTP文件上传文件实现,定时扫描文件夹上传指定格式文件文件到服务器,C语言实现FTP文件上传详解及代码案例实现
- Principle and implementation of MySQL master-slave replication
- [yarn] CDP cluster yarn configuration capacity scheduler batch allocation
猜你喜欢
随机推荐
互聯網協議詳解
[Flink] Flink learning
高通&MTK&麒麟 手機平臺USB3.0方案對比
2019 Tencent summer intern formal written examination
Basic knowledge of lithium battery
nodejs连接Mysql
TypeScript
List and set
2019腾讯暑期实习生正式笔试
express框架详解
分布式節點免密登錄
Vert. x: A simple login access demo (simple use of router)
Stage 4 MySQL database
小L的试卷
分布式节点免密登录
error C4996: ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_ s instead
C语言函数之可变参数原理:va_start、va_arg及va_end
Vert. x: A simple TCP client and server demo
4. Install and deploy spark (spark on Yan mode)
Keyword inline (inline function) usage analysis [C language]