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的更多相关文章

  1. freeRTOS中文实用教程4--资源管理互斥

    1.前言 访问一个被多任务共享,或是被任务与中断共享的资源时,需要采用”互斥”技术以保证数据在任何时候都保持一致性.这样做的目的是要确保任务从开始访问资源就具有排它性,直至这个资源又恢复到完整状态 F ...

  2. FREERTOS 手册阅读笔记

    郑重声明,版权所有! 转载需说明. FREERTOS堆栈大小的单位是word,不是byte. 根据处理器架构优化系统的任务优先级不能超过32,If the architecture optimized ...

  3. STM32F103和AIR32F103的FreeRTOS中断优先级

    关于 Arm Cortex M 系列内核的中断优先级 https://community.arm.com/arm-community-blogs/b/embedded-blog/posts/cutti ...

  4. FreeRTOS随记

    任务函数原型: void ATaskFunction(void * pvParameters); 任务不允许从实现函数中返回.如果一个任务不再需要,可以用vTaskDelete()删除; 一个任务函数 ...

  5. freeRTOSConfig.h文件对FreeRTOS进行系统配置

    FreeRTOS内核是高度可定制的,使用配置文件FreeRTOSConfig.h进行定制.每个FreeRTOS应用都必须包含这个头文件,用户根据实际应用来裁剪定制FreeRTOS内核.这个配置文件是针 ...

  6. FreeRTOS

    一.内核配置 1.configUSE_PREEMPTION 设置为1,使用抢先式内核:设置为0,为合作轮转内核. 2.configCPU_CLOCK_HZ 内部处理器执行的频率.这个值需要正确配置外围 ...

  7. 不可被忽视的操作系统( FreeRTOS )【1】

    把大多数人每个星期的双休过过成了奢侈的节假日放假,把每天23点后定义为自己的自由时间,应该如何去思考这个问题 ? 双休的两天里,不!是放假的两天里,终于有较长的时间好好的学习一下一直断断续续的Free ...

  8. FreeRTOS相关转载-(朱工的专栏)

    FreeRTOS系列第1篇---为什么选择FreeRTOS? 1.为什么学习RTOS? 作为基于ARM7.Cortex-M3硬件开发的嵌入式工程师,我一直反对使用RTOS.不仅因为不恰当的使用RTOS ...

  9. 【freertos】007-系统节拍和系统延时管理实现细节

    前言 本章节的时钟系统节拍主要分析FreeRTOS内核相关及北向接口层,南向接口层不分析. 本章节的系统延时主要分析任务系统延时实现. 原文:李柱明博客:https://www.cnblogs.com ...

  10. STM32 使用 FreeRTOS过程记录

    资源:http://blog.csdn.net/zhzht19861011/article/category/6191478 资源:可以下载安富莱的STM32-V5开发版资料中的FreeRTOS教程, ...

随机推荐

  1. Python wheel

    在 Python 的生态系统中,wheel 是一种打包格式,用于分发和安装 Python 项目.它是 Python 包的标准格式之一,旨在提高安装速度和可靠性. Wheel 的优势 快速安装:因为 w ...

  2. iPhone 打不开 Apple News 解决方法

    想看 Apple News,但是在主屏幕找不到,在 App Store 搜索 Apple News 后打开时显示访问控制已启用,然而在设置中检查发现访问控制并没有启用. 经过一番摸索,发现这个访问控制 ...

  3. python pyqt6 设定logo图标

    如果是Window self.setWindowIcon(QIcon(get_icon('logo.png'))) 如果是Dialog self.login_dialog.setWindowIcon( ...

  4. 火山引擎VeDI赋能小城酒店业,助力“流量”向“留量”转化

    更多技术交流.求职机会,欢迎关注字节跳动数据平台微信公众号,回复[1]进入官方交流群.   今年,"去小城过假期"正悄然流行.根据途牛旅游发布的<2024年上半年度旅游消费报 ...

  5. MYSQL数据库备份还原,并还原到最新状态(mysqldump)

    启用二进制日志文件 vim /etc/my.cnf 配置文件位置及文件名根据实际情况确定<br>sql_log_bin=on|off:是否记录二进制日志,默认为on 在需要的时候设置为of ...

  6. Angular 18+ 高级教程 – Component 组件 の 生命周期钩子 (Lifecycle Hooks)

    前言 之前在 Component 组件 の Angular Component vs Custom Elements 文章中,我们有学习过几个基础的 Lifecycle Hooks. 比如 OnCha ...

  7. 浏览器中生成 OSS 令牌 | Web Crypto API

    笔者写文章的时候,都会把图片通过自己搭建的一个简单站点 https://imgbed.sugarat.top/ 把图片上传到各种云的对象存储服务(OSS)上. 然后通过CDN访问,保证图片有可靠的访问 ...

  8. USB2.0设备的休眠挂起及远程唤醒

    USB可见设备状态,分为连接(Attached),上电(Powered),默认(Default),地址(Address),配置(Configured)和挂起(Suspended)6个状态.所谓可见,即 ...

  9. unable to find sdk 'iphoneos XX' 报错

    解决方法: Build Setting->Base SDK->修改为iOS

  10. 45. beforeCreate和created的区别

    data数据和methods的方法是否存在,是否定义了 : beforeCreate 都是 undefiend :