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. 【Homebrew】之相关命令问题合集及iOS真机调试包

    一.Homebrew更换国内镜像源(中科大.阿里.清华) Homebrew主要有四个部分组成: brew.homebrew-core .homebrew-bottles.homebrew-cask. ...

  2. dataX是阿里开源的离线数据库同步工具

    dataX是阿里开源的离线数据库同步工具的使用 DataX介绍: DataX 是阿里开源的一个异构数据源离线同步工具,致力于实现包括关系型数据库(MySQL.Oracle等).HDFS.Hive.OD ...

  3. ERR_INVALID_REDIRECT

    原因为: response.sendRedirect(url) url地址写错了

  4. vlan 技术

    Ref: VLAN及Trunk,重要!看瑞哥如何讲的明明白白! 图文并茂VLAN以及Trunk详解,超级详细

  5. python脚本之requests库上传文件

    一.前言 在学习的时候,发现有一个AWD的文件上传执行漏洞,突然想着批量对不同靶机进行操作并get_flag.思路简单,但是没构造 过文件上传的requests 的post请求的payload.便记录 ...

  6. 终于有人把Modbus讲明白了

    大家好!我是付工. 2012年开始接触Modbus协议,至今已经有10多年了,从开始的懵懂,到后来的顿悟,再到现在的开悟,它始终岿然不动,变化的是我对它的认知和理解. 今天跟大家聊聊关于Modbus协 ...

  7. MySQL linux下安装,配置,免密登录与基本认识

    目录 MySQL卸载 环境 查看是否已安装MySQL 卸载mysql服务 查看是否卸载干净 MySQL安装 查看linux版本 选择MySQL版本 获取mysql官方yum源 rpm安装mysql官方 ...

  8. 心得小结,关于注重加强MCU下调试能力的意识

    这两个月没有怎么更新博文,最近换工作了,根据新工作安排,大半年内都做MCU开发(就不要叫单片机了,太老土了). 入职新工作了,需重构拳头产品的软件,所以每天加班加点. 单片机与linux应用开发,开发 ...

  9. iframe嵌套登录页-页面无法加载

    背景 活动页面和登录页跨域,过去都是跳转到登录页登录之后再跳转回来,体验不好. 现在需要将登录模块嵌入到活动页,因为懒,不想开发重复的模块,首先我想到的是iframe 刚开始还能正常使用,一段时间后安 ...

  10. [Tkey] A decorative fence

    还是看看简单而富有美感的爆搜吧 #include<bits/stdc++.h> using namespace std; #define int long long #define tes ...