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教程, ...
随机推荐
- 【Azure Policy】添加策略用于审计Azure 网络安全组(NSG)规则 -- 只能特定的IP地址允许3389/22端口访问
问题描述 对Azure上的虚拟机资源,需要进行安全管理.只有指定的IP地址才能够通过RDP/SSH远程到虚拟机上, 有如下几点考虑: 1) 使用Azure Policy服务,扫描订阅中全部的网络安全组 ...
- VUE-局部使用
目录 VUE-局部使用 快速入门 常用指令 v-for v-bind v-if & v-show v-on v-model vue生命周期 Axios Vue案例 VUE-局部使用 Vue 是 ...
- MySQL服务端innodb_buffer_pool_size配置参数
innodb_buffer_pool_size是什么? innodb_buffer_pool是 InnoDB 缓冲池,是一个内存区域保存缓存的 InnoDB 数据为表.索引和其他辅助缓冲区.innod ...
- DataV兼容vue3的方法
发现问题 在使用vue开发大屏时,发现了一个很好用的可视化组件库DataV,不是阿里那个DataV哈,用vue2开发时都一切顺利,直到有一天升级项目到vue3时,发现一堆报错,后面查了下,好像是Dat ...
- 【转】AddMvcCore,AddControllers,AddControllersWithViews,AddRazorPages的区别
1.services.AddMvcCore()只註冊運行 Controller/Razor Pages 必要的核心服務,確保 Pipeline 程序可動作,其餘如像 Data Annotation M ...
- 【YashanDB知识库】存储过程报错snapshot too old
问题描述 20231127上午客户反馈绩效系统20231125.20231126出现2次YAS-02020 snapshot too old的问题,测试也有类似问题. 该过程是客户新增的存储过程,目的 ...
- vue3 如何获取 dom
1. 通过 ref 1. 在 html 标签上指定 ref 属性 2. 在 setup 中定义并返回.注意:标签上的 ref 属性名需要跟 setup 中的对应 <h1 ref= ...
- 知乎问题:为什么很多web项目还是使用 px,而不是 rem?
阅读过几篇关于 px rem 的文章,感觉 rem 很强大.但是自己接触到的公司项目全部都使用 px,想知道为什么.是我司技术更新落后了吗? 我们当然有在用 vw 和 vh,但是只是在 layout ...
- Java获取Object中Value的方法
在Java中,获取对象(Object)中的值通常依赖于对象的类型以及我们希望访问的属性.由于Java是一种静态类型语言,直接从一个Object类型中访问属性是不可能的,因为Object是所有类的超类, ...
- Sqoop简介安装及使用
Sqoop简介 sqoop 是 apache 旗下一款"Hadoop 和关系数据库服务器之间传送数据"的工具. 核心的功能有两个: 导入.迁入 导出.迁出 导入数据:MySQL,O ...