FreeRTOS LIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 存在的意义以及高于它的中断不能调用 safe freertos api
This is how I understand it.
我是这样理解的。
If we now have 2 tasks and 6 interrupts, among which, and when interrupts 4, 5, 6 are running, they will call the safe freertos api.
如果我们现在有2个任务和6个中断,其中,当中断4、5、6运行时,它们将调用安全的freertos api。
Just like (1) in the picture.
就像图中的(1)一样。

So now if we are executing task 1 or task 2, interrupt 5 is triggered, and it will do what it needs to do in the callback, including calling the safe freertos api, and during the execution, it will enter the critical section to block all interrupts and tasks with a lower priority than it (for now, let’s not consider the MAX_SYSCALL_INTERRPUT_PRIORITY mechanism in FreeRTOS, that is, it will not block interrupts 1~4).
那么现在如果我们正在执行任务1或者任务2,触发了中断5,它就会在回调中做它需要做的事情,包括调用safe freertos api,并且在执行过程中,它会进入临界区进行阻塞所有中断和优先级比它低的任务(暂时不考虑FreeRTOS中的MAX_SYSCALL_INTERRPUT_PRIORITY机制,即它不会阻塞中断1~4)。
Just like (2) in the picture.
就像图中的(2)一样。

Moving forward, when interrupt 5 calls the safe freertos api and is in the process of execution, interrupt 4 is triggered at this time, it will preempt interrupt 5 execution, and further call the safe freertos api. At this time, I guess that interrupt 5 involves the operation of the freertos kernel (because of preemption, only half of it is executed) will lose protection, causing serious irreversible effects (there may be problems with context scheduling and task management).
接下来,当中断5调用safe freertos api并且正在执行过程中时,此时触发中断4,它会抢占中断5的执行,并进一步调用safe freertos api。这个时候我猜测中断5涉及到freertos内核的操作(因为抢占,只执行了一半)会失去保护,造成严重的不可逆影响(可能会出现上下文调度和任务管理的问题)。
Just like (3) in the picture.
就像图中的(3)一样。

So now let’s go back to the beginning. If there is MAX_SYSCALL_INTERRPUT_PRIORITY in FreeRTOS The mechanism exists. During the execution of interrupt 5, all interrupts below MAX_SYSCALL_INTERRPUT_PRIORITY will be blocked, so the accident caused by the interrupt 4 preemption execution mentioned above will not happen.
现在让我们回到开头。如果 FreeRTOS 中有 MAX_SYSCALL_INTERRPUT_PRIORITY 机制存在。中断5执行过程中,所有低于MAX_SYSCALL_INTERRPUT_PRIORITY的中断都会被阻塞,因此不会发生前面提到的中断4抢占执行带来的意外。
Just like (4) in the picture.
就像图中的(4)一样。

Then, you will definitely ask, what about interrupts 1~3, will they be blocked? The answer is: No. Then will they call the safe freertos api and the above mentioned accident will not happen? This is the problem I encountered recently, and now I know the answer. There is a MAX_SYSCALL_INTERRPUT_PRIORITY mechanism in FreeRTOS. Interrupts above MAX_SYSCALL_INTERRPUT_PRIORITY will not allow you to call the safe freertos api (if you call it, the code will not pass the compilation due to the existence of the reertos assertion), so there will be no accident.
那么,你一定会问,中断1~3呢,会被阻塞吗?答案是:不会。那么他们会调用安全的freertos api,上面提到的事故就不会发生吗?这是我最近遇到的问题,现在我知道答案了。 FreeRTOS中有一个MAX_SYSCALL_INTERRPUT_PRIORITY机制。 MAX_SYSCALL_INTERRPUT_PRIORITY以上的中断将不允许你调用安全的freertos api(如果调用的话,由于reertos断言的存在,代码将不会通过编译),所以不会出现意外。
This is my own understanding. If you find any errors, please leave a message to reply.
这是我个人的理解。如果发现错误,请留言回复。
FreeRTOS LIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 存在的意义以及高于它的中断不能调用 safe freertos api的更多相关文章
- freeRTOS中文实用教程4--资源管理互斥
1.前言 访问一个被多任务共享,或是被任务与中断共享的资源时,需要采用”互斥”技术以保证数据在任何时候都保持一致性.这样做的目的是要确保任务从开始访问资源就具有排它性,直至这个资源又恢复到完整状态 F ...
- FREERTOS 手册阅读笔记
郑重声明,版权所有! 转载需说明. FREERTOS堆栈大小的单位是word,不是byte. 根据处理器架构优化系统的任务优先级不能超过32,If the architecture optimized ...
- STM32F103和AIR32F103的FreeRTOS中断优先级
关于 Arm Cortex M 系列内核的中断优先级 https://community.arm.com/arm-community-blogs/b/embedded-blog/posts/cutti ...
- FreeRTOS随记
任务函数原型: void ATaskFunction(void * pvParameters); 任务不允许从实现函数中返回.如果一个任务不再需要,可以用vTaskDelete()删除; 一个任务函数 ...
- freeRTOSConfig.h文件对FreeRTOS进行系统配置
FreeRTOS内核是高度可定制的,使用配置文件FreeRTOSConfig.h进行定制.每个FreeRTOS应用都必须包含这个头文件,用户根据实际应用来裁剪定制FreeRTOS内核.这个配置文件是针 ...
- FreeRTOS
一.内核配置 1.configUSE_PREEMPTION 设置为1,使用抢先式内核:设置为0,为合作轮转内核. 2.configCPU_CLOCK_HZ 内部处理器执行的频率.这个值需要正确配置外围 ...
- 不可被忽视的操作系统( FreeRTOS )【1】
把大多数人每个星期的双休过过成了奢侈的节假日放假,把每天23点后定义为自己的自由时间,应该如何去思考这个问题 ? 双休的两天里,不!是放假的两天里,终于有较长的时间好好的学习一下一直断断续续的Free ...
- FreeRTOS相关转载-(朱工的专栏)
FreeRTOS系列第1篇---为什么选择FreeRTOS? 1.为什么学习RTOS? 作为基于ARM7.Cortex-M3硬件开发的嵌入式工程师,我一直反对使用RTOS.不仅因为不恰当的使用RTOS ...
- 【freertos】007-系统节拍和系统延时管理实现细节
前言 本章节的时钟系统节拍主要分析FreeRTOS内核相关及北向接口层,南向接口层不分析. 本章节的系统延时主要分析任务系统延时实现. 原文:李柱明博客:https://www.cnblogs.com ...
- STM32 使用 FreeRTOS过程记录
资源:http://blog.csdn.net/zhzht19861011/article/category/6191478 资源:可以下载安富莱的STM32-V5开发版资料中的FreeRTOS教程, ...
随机推荐
- chrome.tabs.sendMessage和chrome.runtime.sendMessage的用法及区别
在 Chrome 扩展开发中,chrome.tabs.sendMessage 和 chrome.runtime.sendMessage 是用于不同目的的消息发送 API,它们的主要区别在于消息的目标对 ...
- iptables 命令使用帮助总结
本文为博主原创,转载请注明出处: 1.iptables 命令帮助参数 root@controller1:~# iptables --help iptables v1.6.1 Usage: iptabl ...
- 10 Python面向对象编程:类和对象以及和Java的对比
本篇是 Python 系列教程第 10 篇,更多内容敬请访问我的 Python 合集 这里只介绍类和对象,self.属性.方法.访问控制.类继承.方法重写在后面的文章里介绍 在Python中,类和对象 ...
- Seata 四大模式详解
分布式事务 参考文章: 分布式事务实战方案汇总 https://www.cnblogs.com/yizhiamumu/p/16625677.html 分布式事务原理及解决方案案例https://www ...
- c++ 命名的强制类型转换
显式转换:显式将一种类型转换为另一种类型. References: C++中的显示数据类型转换 与命名的强制类型转换相比,旧式的强制类型转换从表现形式上来说不那么清晰明了,容易被看漏,所以一旦转换过程 ...
- React函数式组件避免无用渲染的方案
在class组件中可以使用shouldComponentUpdate钩子函数,但是函数式组件中是没有这种钩子函数的,那么在函数式组件中来达到类似的效果呢? 答案是:React.Memo,如以下使用案例 ...
- 【赵渝强老师】在Hive中使用Load语句加载数据
一.Hive中load语句的语法说明 Hive Load语句不会在加载数据的时候做任何转换工作,而是纯粹的把数据文件复制/移动到Hive表对应的地址.语法格式如下: LOAD DATA [LOCAL] ...
- laravel中添加公共函数
laravel中添加公共函数 1. 在项目中的新建app/Helper/functions.php文件 2.在项目的跟目录找到composer.json 文件,并打开,然后再autoload中添加如下 ...
- 41.key发生变化,dom还会复用吗
会复用但是可能会产生没有必要的真实DOM更新 ,会降低渲染效率 :比如使用 index 作为 key 值 :
- C#查漏补缺----值类型与引用类型,值类型一定分配在栈上吗?
前言 环境:.NET 8.0 系统:Windows11 参考资料:<CLR via C#>, <.Net Core底层入门>,<.NET 内存管理宝典> 栈空间与堆 ...