ChibiOS简介1/5

news/2024/7/10 20:48:15 标签: 开源, chibios

ChibiOS简介1/5

  • 1. 源由
  • 2. ChibiOS基础知识1/5
    • 2.1 Chapter 1 - Introduction
      • 2.1.1 Priciple(设计原则)
      • 2.1.2 Fundamental requirements(基本需求)
    • 2.2 Chapter 2 - Real Time Systems Concepts
      • 2.2.1 System(系统)
      • 2.2.2 Classification(分类)
      • 2.2.3 Jitter(抖动)
    • 2.3 Chapter 3 - Embedded RTOSes
      • 2.3.1 Priorities(优先级)
      • 2.3.2 Scheduling(调度)
      • 2.3.3 Interrupts(中断)
      • 2.3.4 Tasks and Threads(任务和线程)
      • 2.3.5 Task Types(任务类型)
      • 2.3.6 Synchronization(同步)
      • 2.3.7 Atomic Operations(原子操作)
      • 2.3.8 Critical Sections(临界区域)
  • 3. 参考资料

1. 源由

作为后续研读Ardupilot的ChibiOS的垫脚石,先了解下ChibiOS系统。


Ardupilot ChibiOS项目: https://github.com/ArduPilot/ChibiOS

Artery(AT32) porting项目: //Artery官网没有相关porting动作,不过开源github有相关项目。

  • https://github.com/dron0gus/artery
  • https://github.com/dron0gus/ChibiOS

2. ChibiOS基础知识1/5

2.1 Chapter 1 - Introduction

2.1.1 Priciple(设计原则)

  • Elegant
  • Fast
  • Small
  • Static

2.1.2 Fundamental requirements(基本需求)

  • Focus for code elegance and consistency, it must be a pleasure to work with the code.
  • Fully, unambiguously static.
  • Short code paths for all operations, it has to be really fast.
  • Compact.
  • Feature complete.
  • Strong abstraction.

2.2 Chapter 2 - Real Time Systems Concepts

2.2.1 System(系统)

A complex systems can always be decomposed in a set of elementary processes connected in a network, the system has a set of input and output signals, we can still consider them events and reactions but on a system level. A system can also have a global state, information that can optionally be accessed by the various processes in the system.

在这里插入图片描述

2.2.2 Classification(分类)

  • Non Real Time(非实时). A non real time system is a system where there are no deadlines involved. Non realtime systems could be described as follow:

“A non real time system is a system where the programmed reaction to an event will certainly happen sometime in the future”.

  • Soft Real Time(软实时). A Soft Real Time (SRT) system is a system where not meeting a deadline can have undesirable but not catastrophic effects, a performance degradation for example. Such systems could be described as follow:

“A soft real time system is a system where the programmed reaction to an event is almost always completed within a known finite time”.

  • Hard Real Time(硬实时). An Hard Real Time (HRT) system is a system where not meeting a deadline can have catastrophic effects. Hard realtime systems require a much more strict definition and could be described as follow:

“An hard real time system is a system where the programmed reaction to an event is guaranteed to be completed within a known finite time”.

2.2.3 Jitter(抖动)

Processes never react in a constant time, at a sufficiently small time scale any physical process is bound to have jitter. Unbounded or not assessed jitter is not compatible with an hard realtime system.

在这里插入图片描述

2.3 Chapter 3 - Embedded RTOSes

2.3.1 Priorities(优先级)

  • Static Priorities are usually assigned statically and cannot be changed at runtime.

  • Modifiable Priorities allow for priority to change at runtime in order to implement particular scheduling strategies.
    在这里插入图片描述

2.3.2 Scheduling(调度)

The scheduling rule is very simple: in any instant, the task being executed is the ready task with the highest priority level. This is true for both tasks and ISRs in the proposed model.

2.3.3 Interrupts(中断)

Interrupts trigger directly ISRs which in turn can wakeup tasks.

在这里插入图片描述在这里插入图片描述Note: If interrupts processing is an important requirement for your system then you should look for an RTOS/core combination able to efficiently handle nested interrupts on a dedicated interrupts stack.

2.3.4 Tasks and Threads(任务和线程)

Tasks are the fundamental entities in an RTOS environment. A task can be seen as a virtual CPU inside the system with its own registers bank and stack area. Tasks are scheduled by the RTOS based on their priority as described before. Some RTOSes, like ChibiOS for example, use the term threads for their tasks.

在这里插入图片描述

2.3.5 Task Types(任务类型)

  • Periodic Tasks, a periodic task is a task triggered periodically with a fixed time interval. The task is mostly waiting and becomes ready for execution when its internal timer triggers it. The task then performs a brief action and returns to the waiting state.

  • Non-periodic Tasks, this kind of tasks are triggered by an external event, for example an ISR, and are thus not periodic. After performing its programmed action the task returns to the waiting state.

  • Continuous Tasks, tasks should never take the CPU indefinitely, a task running an empty loop would not allow the execution of tasks at lower priority level. The rule is that tasks should wait for events, do their programmed action and then go back to waiting for events. If there are tasks that never release the CPU resource then those must be placed at lowest priority level in the system.

2.3.6 Synchronization(同步)

Usually tasks can use areas of memory as shared data, usually also called Shared Resources, the concurrent access to resources can lead to corruption of said data because the operations performed by tasks may be not atomic.

2.3.7 Atomic Operations(原子操作)

The safest approach is to consider everything not atomic. Failure to understand atomicity and implement proper mutual exclusion is the recipe for disaster, errors are usually random in nature and very hard to detect and debug. Ideally the problem must be resolved in the analysis and design phases by carefully defining the shared resources and defining correct protocols for concurrent access.

Most RTOSes have a specific API for handling of critical sections, the right approach is to use the RTOS-provided API and not make assumptions about how critical sections are or should be implemented. A good RTOS should take care about the best implementation on any given architecture.

2.3.8 Critical Sections(临界区域)

Critical Sections (or critical zones) are probably the most simple and common way to make a non-atomic sequence of code behave atomically.

3. 参考资料

【1】ArduPilot开源飞控系统之简单介绍
【2】 ChibiOS官方文档


http://www.niftyadmin.cn/n/5248602.html

相关文章

uniapp实战 —— 轮播图【数字下标】(含组件封装,点击图片放大全屏预览)

组件封装 src\components\SUI_Swiper2.vue <script setup lang"ts"> import { ref } from vue const props defineProps({config: Object, })const activeIndex ref(0) const change: UniHelper.SwiperOnChange (e) > {activeIndex.value e.detail.cur…

mysql 主从搭建、django实现读写分离、django中多redis缓存、django中使用连接池、pycharm远程linux开发

1 mysql 主从搭建 2 django实现读写分离 3 django中多redis缓存 4 django中使用连接池 5 pycharm远程linux开发 1 mysql 主从搭建 # 之前做过redis的主从&#xff0c;很简单# mysql 稍微复杂一些&#xff0c; 搭建mysql主从的目的是&#xff1f;-读写分离-单个实例并发量低&…

1文件+2个命令,无需安装,单机离线运行70亿大模型

1文件2个命令&#xff0c;无需安装&#xff0c;单机离线运行70亿大模型 大家好&#xff0c;我是老章 最近苹果发布了自己的深度学习框架--MLX&#xff0c;专门为自家M系列芯片优化。看了展示视频&#xff0c;这个框架还能直接运行Llama 7B的大模型&#xff0c;在M2 Ultral上运…

前端学习微信小程序开发

1.微信小程序项目结构 2.WXML和HTML的区别 3.WXSS与CSS的区别 4.小程序中的.js文件 5.小程序的宿主环境 宿主环境是指程序运行所必须的依赖环境&#xff0c;因此手机微信时小程序的宿主环境。小程序宿主环境包含了通信模型、运行机制、组件、API。 &#xff08;1&#xff09;…

Shell脚本如何使用 for 循环、while 循环、break 跳出循环和 continue 结束本次循环

Shell脚本如何使用 for 循环、while 循环、break 跳出循环和 continue 结束本次循环 下面是一个简单的 Shell 脚本示例&#xff0c;演示了如何使用 for 循环、while 循环、break 跳出循环和 continue 结束本次循环。 #!/bin/bash# For循环 echo "For循环示例&#xff1a;…

图像搜索应用:基于Python的CLIP和Streamlit | 附源码

类似Google Photos的应用程序使得通过文本查询在手机上搜索图像成为可能。值得注意的是&#xff0c;该应用程序不需要您根据内容为图像添加标签。例如&#xff0c;您可以在Google Photos应用程序中搜索猫或汤&#xff0c;并获得相关结果&#xff0c;尽管您的图像没有文本描述。…

容器资源视图隔离 —— 筑梦之路

先做个记录&#xff0c;抽空再整理 K8s 部署 Lxcfs 准入控制器&#xff0c;实现容器中资源单独可见 - 「Johny」PlayGround Kubernetes 中利用 LXCFS 控制容器资源可见性 - 码农教程 容器资源可视化隔离的实现方法_51CTO博客_容器隔离技术 Lxcfs在容器集群中的使用-腾讯云开…

接口自动化测试用例

1、接口文档 根据开发、产品的接口文档&#xff0c;以及评审&#xff0c;进行设计接口测试用例&#xff0c;它不像UI测试&#xff0c;有个界面&#xff0c;对于简单的系统&#xff0c;需求文档不提供也能覆盖所有功能&#xff0c;接口测试虽说可以抓包&#xff0c;但抓包无法覆…