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教程, ...
随机推荐
- 本地部署 Overleaf 服务
️ 注意:本教程只适用于 macOS / Linux 操作系统.如果需要在 Windows 上部署 Overleaf,请先安装 WSL,之后在 WSL 中部署 Overleaf . 本地部署 Over ...
- 立体视觉 StereoVision
双目相机 原理 [深度相机系列三]深度相机原理揭秘--双目立体视觉 StereoVision--立体视觉(1) StereoVision--立体视觉(2) StereoVision--立体视觉(3) ...
- AWS Data Analytics Fundamentals 官方课程笔记 - Variety, Veracity, Value
Variety structured data applications include Amazon RDS, Amazon Aurora, MySQL, MariaDB, PostgreSQL, ...
- 反DDD模式之关系型数据库
本文书接上回<图穷匕见-所有反DDD模式都是垃圾>,关注公众号(老肖想当外语大佬)获取信息: 最新文章更新: DDD框架源码(.NET.Java双平台): 加群畅聊,建模分析.技术实现交流 ...
- 官方 | 征集 Flutter 桌面端应用程序的构建案例
亲爱的社区成员们,大家好! Google Flutter 团队希望了解开发者们使用 Flutter 构建的桌面端应用程序,以提高 Flutter 桌面端的测试覆盖率,邀请大家通过表单的形式提交征集和反 ...
- Nuxt Kit 使用日志记录工具
title: Nuxt Kit 使用日志记录工具 date: 2024/9/23 updated: 2024/9/23 author: cmdragon excerpt: 摘要:本文介绍在Nuxt 3 ...
- 最好的文件管理器-dolphin
WARN:windows没有,废话少说,直接开始 what's dolphin 长得好看 dolphin使用kde的主题管理,可以通过kde的主题商店配合kvantum manager 配制出一个好看 ...
- SimpleAIAgent:使用免费的glm-4-flash即可开始构建简单的AI Agent应用
SimpleAIAgent是基于C# Semantic Kernel 与 WPF构建的一款AI Agent探索应用.主要用于使用国产大语言模型或开源大语言模型构建AI Agent应用的探索学习,希望能 ...
- Windows右下角时间显示到秒(改注册表)
事件起因: 由于京东秒杀,要准点抢购,于是想着能不能把Windows右下角的时间显示到秒,于是在网上查了一下,修改注册表即可 解决办法: 新建一个 ShowSecondsInSystemClock ...
- CSP 联训 3
好吧,又倒数了,就签了个 T2,100 pts. T1 我把相同颜色的存起来,每种颜色找出枚举选哪两个座位不合法的矩阵的左上和右下,如果找到的矩阵左下和右上也相同,则这个矩阵确实不合法,减去,但判断左 ...