当前位置:网站首页>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 .
边栏推荐
猜你喜欢
Apprentissage automatique - - régression linéaire (sklearn)
FTP file upload file implementation, regularly scan folders to upload files in the specified format to the server, C language to realize FTP file upload details and code case implementation
【yarn】CDP集群 Yarn配置capacity调度器批量分配
分布式节点免密登录
MongoDB
C语言回调函数【C语言】
[yarn] yarn container log cleaning
機器學習--線性回歸(sklearn)
sklearn之feature_extraction.text.CountVectorizer / TfidVectorizer
[CDH] cdh5.16 configuring the setting of yarn task centralized allocation does not take effect
随机推荐
Vert. x: A simple TCP client and server demo
Common regular expression collation
STM32 如何定位导致发生 hard fault 的代码段
Contiki source code + principle + function + programming + transplantation + drive + network (turn)
GNN的第一个简单案例:Cora分类
Détails du Protocole Internet
【presto】presto 参数配置优化
Pytorch实现简单线性回归Demo
Unit test - unittest framework
Analysis of charging architecture of glory magic 3pro
使用LinkedHashMap实现一个LRU算法的缓存
互联网协议详解
[CDH] modify the default port 7180 of cloudera manager in cdh/cdp environment
Selective sorting and bubble sorting [C language]
[Flink] cdh/cdp Flink on Yan log configuration
Matlab learning and actual combat notes
XML file explanation: what is XML, XML configuration file, XML data file, XML file parsing tutorial
Using LinkedHashMap to realize the caching of an LRU algorithm
MongoDB
Keyword inline (inline function) usage analysis [C language]