ChibiOS简介5/5

2023-12-14 11:12
文章标签 简介 chibios

本文主要是介绍ChibiOS简介5/5,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

ChibiOS简介5/5

  • 1. 源由
  • 2. ChibiOS基础知识5/5
    • 2.16 Chapter 16 - The OS Library
      • 2.16.1 Memory Allocators
      • 2.16.2 Binary Semaphores
      • 2.16.3 Mailboxes
      • 2.16.4 Objects FIFOs
      • 2.16.5 Pipes
      • 2.16.6 Delegate Threads
      • 2.16.7 Jobs Queues
      • 2.16.8 Objects Caches
      • 2.16.9 Objects Factory
      • 2.16.10 Notes on Testing
  • 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基础知识5/5

2.16 Chapter 16 - The OS Library

The OS Library (OSLIB) is an optional set of RTOS features that can be added on top of both RT and NIL kernels. It is purely a source code architectural decision.

Requirements

  • Features that only use the common RT and NIL common API.
  • Features that cannot be optimized using tricks or details of the underlying RT or NIL kernels.
  • Features that are CPU architecture agnostic.
  • Features that are compiler agnostic.
  • Features that have no dependencies on external modules other than RT or NIL kernels.

2.16.1 Memory Allocators

The 4 kinds of allocators are designed to work together:

  • Core Allocator, for one-way memory allocation, memory cannot be freed.
  • Pool Allocator, for allocating and freeing fixed-size objects.
  • Guarded Pool Allocator, it is like the pool allocator but guarded by a semaphore. Trying to allocate an object causes the caller thread to wait if an object is not immediately available.
  • Heap Allocator, for allocating and freeing arbitrary-size memory blocks.

The above mechanisms were previously in the RT kernel and have been moved into OSLIB.

Allocators Comparison

Here is a table summarizing the information:

AllocatorCan FreeConstant TimeVariable SizeFrom ISRCreates FragmentsThread Safe
Core AllocatorNoYesYesYes-Yes
Pool AllocatorYesYesNoYesNoYes
Guarded Pool AllocatorYesNoNoYes1NoYes
Heap AllocatorYesNoYesNoYesYes
C Library AllocatorYesNoYesNoYesNo2
  1. Without waiting.
  2. Depends on library implementation and integration with the RTOS.
  • Can Free indicates the ability of the allocator to return blocks to the available memory.
  • Constant Time is the ability to allocate/free blocks in a constant time, this is important for system determinism.
  • Variable Size is the ability to allocate/free blocks of variable size.
  • From ISR indicates that the allocator services can also be called from ISR context.
  • Creates Fragments indicates if allocating and freeing memory can cause internal fragmentation.
  • Thread Safe indicates that the allocator can be used in a multi-threaded environment.

2.16.2 Binary Semaphores

A variation on the semaphore mechanism with only two internal states, this mechanism was previously in the RT kernel and has been moved into OSLIB.

在这里插入图片描述

2.16.3 Mailboxes

Queues of asynchronous messages, this mechanism was previously in the RT kernel and has been moved into OSLIB.

在这里插入图片描述

2.16.4 Objects FIFOs

Queues of objects composed by a pool of free object and a mailbox for pointers exchange. It is useful when there is the need to exchange fixed-size objects in a copy-less way.

在这里插入图片描述

2.16.5 Pipes

Structure-less streams of bytes exchanged between threads.

2.16.6 Delegate Threads

It is a mechanism that allows to perform function calls in the context of another thread which is acting as a “functions server thread”. Function calls are “delegated” to a dedicated thread which performs the call synchronously.

2.16.7 Jobs Queues

Implements a queue of “jobs” that are consumed and executed by a “jobs server thread” asynchronously. A job is simply a structure containing a function pointer and a pointer argument.

2.16.8 Objects Caches

Implements a cache of fixed-size objects which can be then retrieved by their numeric identifier. It could be used for a disk cache for example.

2.16.9 Objects Factory

A system that allows to allocate other objects dynamically and attribute them a name. Objects can be used by reference, references can be obtained by searching for name.

2.16.10 Notes on Testing

The OSLIB has its own suite of tests, the tests are performed on both RT and NIL host kernels.

3. 参考资料

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

这篇关于ChibiOS简介5/5的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/492294

相关文章

Spring Security简介、使用与最佳实践

《SpringSecurity简介、使用与最佳实践》SpringSecurity是一个能够为基于Spring的企业应用系统提供声明式的安全访问控制解决方案的安全框架,本文给大家介绍SpringSec... 目录一、如何理解 Spring Security?—— 核心思想二、如何在 Java 项目中使用?——

Java Stream 并行流简介、使用与注意事项小结

《JavaStream并行流简介、使用与注意事项小结》Java8并行流基于StreamAPI,利用多核CPU提升计算密集型任务效率,但需注意线程安全、顺序不确定及线程池管理,可通过自定义线程池与C... 目录1. 并行流简介​特点:​2. 并行流的简单使用​示例:并行流的基本使用​3. 配合自定义线程池​示

PostgreSQL简介及实战应用

《PostgreSQL简介及实战应用》PostgreSQL是一种功能强大的开源关系型数据库管理系统,以其稳定性、高性能、扩展性和复杂查询能力在众多项目中得到广泛应用,本文将从基础概念讲起,逐步深入到高... 目录前言1. PostgreSQL基础1.1 PostgreSQL简介1.2 基础语法1.3 数据库

Python库 Django 的简介、安装、用法入门教程

《Python库Django的简介、安装、用法入门教程》Django是Python最流行的Web框架之一,它帮助开发者快速、高效地构建功能强大的Web应用程序,接下来我们将从简介、安装到用法详解,... 目录一、Django 简介 二、Django 的安装教程 1. 创建虚拟环境2. 安装Django三、创

MySQL 索引简介及常见的索引类型有哪些

《MySQL索引简介及常见的索引类型有哪些》MySQL索引是加速数据检索的特殊结构,用于存储列值与位置信息,常见的索引类型包括:主键索引、唯一索引、普通索引、复合索引、全文索引和空间索引等,本文介绍... 目录什么是 mysql 的索引?常见的索引类型有哪些?总结性回答详细解释1. MySQL 索引的概念2

Qt QCustomPlot库简介(最新推荐)

《QtQCustomPlot库简介(最新推荐)》QCustomPlot是一款基于Qt的高性能C++绘图库,专为二维数据可视化设计,它具有轻量级、实时处理百万级数据和多图层支持等特点,适用于科学计算、... 目录核心特性概览核心组件解析1.绘图核心 (QCustomPlot类)2.数据容器 (QCPDataC

rust 中的 EBNF简介举例

《rust中的EBNF简介举例》:本文主要介绍rust中的EBNF简介举例,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录1. 什么是 EBNF?2. 核心概念3. EBNF 语法符号详解4. 如何阅读 EBNF 规则5. 示例示例 1:简单的电子邮件地址

Python 异步编程 asyncio简介及基本用法

《Python异步编程asyncio简介及基本用法》asyncio是Python的一个库,用于编写并发代码,使用协程、任务和Futures来处理I/O密集型和高延迟操作,本文给大家介绍Python... 目录1、asyncio是什么IO密集型任务特征2、怎么用1、基本用法2、关键字 async1、async

Android Mainline基础简介

《AndroidMainline基础简介》AndroidMainline是通过模块化更新Android核心组件的框架,可能提高安全性,本文给大家介绍AndroidMainline基础简介,感兴趣的朋... 目录关键要点什么是 android Mainline?Android Mainline 的工作原理关键

Golang的CSP模型简介(最新推荐)

《Golang的CSP模型简介(最新推荐)》Golang采用了CSP(CommunicatingSequentialProcesses,通信顺序进程)并发模型,通过goroutine和channe... 目录前言一、介绍1. 什么是 CSP 模型2. Goroutine3. Channel4. Channe