小柴带你学AutoSar系列三、标准和规范篇(1)General

 flechazo

 小柴冲刺嵌入式系统设计师系列总目录

小柴带你学AutoSar总目录

缘起

一个小小的介绍啦,逐字逐句读规范。😜

不求能记住多少❤️

只是希望将知识串起来,用到的时候能快速找到就好啦!

一起学习AUTOSAR的规范吧

下面呢分为几个部分带着大家读一下规范啦

目录

缘起

一、Features特性

System and Architecture

Operating System

Runtime Environment (RTE)

Services

Mode Management

Communication via Bus

Communication buses

Memory Stack

Microcontroller Abstraction and I/O

Security

Safety

Libraries

Diagnostic and Error Handling

Test and Debugging

Integration and Migration

Standardization and Documentation

二、VFB虚拟功能总线

1 Introduction to this document

1.1 Contents

1.3 Relationship to other AUTOSAR specifications

1.4 Structure and conventions of this document

2 The Virtual Functional Bus

这里可以看到VFB的作用

VFB是这些组件的交互机制

RTE将组件与组件之间 和 组件与BSW之间分离,不再依赖。实现软件组件的独立。

VFB提供以下概念:

3 Overall mechanisms and concepts

3.1 Components

3.2 Port-Interfaces接口

3.3 Ports

3.3.1 Port Types

3.3.2 Port Compatibility

3.3.3 Data Type Policies

3.4 Connectors

3.4.1 Unconnected Ports

3.5 Compositions versus atomic components

3.6 Relationship between the VFB and the ECU Software Architecture

3.7 Kinds of software components

三、BulkNvDataManager

1 Introduction and functional overview

7 Functional specification

四、SecurityOverview

Attacks and Countermeasures

Existing Solutions

Write xor Execute, Data Execution Prevention (DEP)

Stack Smashing Protection (SSP)

Address Space Layout Randomization (ASLR)

Control-flow Integrity (CFI)

Code Pointer Integrity (CPI), Code Pointer Separation (CPS)

Pointer Authentication

Horizontal Isolation

五、SafetyOverview

总览

Vehicle Context

ECU Context

Microprocessor Context

Potential Hardware Faults and Safety Measures

Potential Software Faults and Safety Measures


一、Features特性

System and Architecture

4.1.1 [RS_BRF_01000] AUTOSAR architecture shall organize the BSW in a hardware independent and a hardware dependent layer

硬件抽象,需要脱离硬件的依赖哦

4.1.2 [RS_BRF_01008] AUTOSAR shall organize the hardware dependent layer in a microcontroller independent and a microcontrollerdependent layer

将独立的mcu和需要相互依赖的mcu分为两层

4.1.3 [RS_BRF_01016] AUTOSAR shall provide a modular design inside software layers

高内聚,低耦合

4.1.4 [RS_BRF_01024] AUTOSAR shall provide naming rules for public symbols

命名要有规范

4.1.5 [RS_BRF_01028] AUTOSAR shall provide naming conventions for symbols in its documentation

命名要有规范

4.1.6 [RS_BRF_01032] AUTOSAR modules shall provide meta data information

提供代码的版本信息,与适配工具的版本信息,适配相应版本的工具。版本不匹配报错

4.1.7 [RS_BRF_01040] AUTOSAR shall allow multiple instantiation of Basic Software Modules where appropriate

每个模块都允许多个实例化,就是用数组去控制,可以存在多个不同配置的模块

4.1.8 [RS_BRF_01048] AUTOSAR module design shall support modules to cooperate in a multitasking environment

应该考虑多任务的环境,及代码的重入性。以及其他模块对资源的占用。

4.1.9 [RS_BRF_01056] AUTOSAR BSW modules shall provide standardized interfaces

模块提供统一的对外接口,对外函数要标准要统一风格

4.1.10 [RS_BRF_01064] AUTOSAR BSW shall provide callback functions in order to access upper layer modules

通过提供回调函数来给上层调用者提供函数支持或状态提醒

4.1.11 [RS_BRF_01072] AUTOSAR BSW shall provide callout functions in order to implement certain functionality in integrator code

提供一些钩子函数,触发某种状态会调用callout。例如 shutdown的hook

4.1.12 [RS_BRF_01076] AUTOSAR basic software shall perform module local error recovery to the extent possible

要有报错机制

4.1.13 [RS_BRF_01080] AUTOSAR shall allow access to internal and external peripheral devices

将外设映射在地址总线中统一管理。例如将外部存储映射到一个地址去访问。

4.1.14 [RS_BRF_01088] AUTOSAR shall offer interfaces which allow to express high level application communication needs

通信时需要有状态管理,支持部分组网。

4.1.17 [RS_BRF_01112] AUTOSAR shall offer interfaces to boot loader

提供用于bootloader交互的接口

4.1.18 [RS_BRF_01120] AUTOSAR shall support re-flashing of configured BSW data

🥫应该将代码和配置代码分离烧录。在ld链接脚本文件中划分特有的区域存储静态代码和配置。这样可以单独烧录配置代码来改变配置而无需改变已有的静态代码。

4.1.19 [RS_BRF_01136] AUTOSAR shall support variants of configured BSW data resolved after system start-up

将配置项使用宏定义作为可选的配置项,来适配不同的配置。使用宏定义来管理不同的变体来初始化不同的行为。

4.1.20 [RS_BRF_01128] AUTOSAR shall allow software components to be started before all BSW modules are initialized

单独组件的初始化不应该依赖于其他组件的初始化。可以使用状态机来管理依赖i项。也就是分批次进行不同级别或者说不同子模块的初始化。

4.1.21 [RS_BRF_01144] AUTOSAR shall support configuration parameter which allow to trade interrupt response time against runtime

其他中断会打断或阻塞这次中断后数据的处理和相应速度,可以将处理放在异步执行的任务中。

4.1.22 [RS_BRF_01152] AUTOSAR shall support limited dynamic reconfiguration

配置中有部分可以动态配置。有部分则不可以。

4.1.23 [RS_BRF_00206] AUTOSAR shall support multi-core MCUs

应该支持多核架构

4.1.24 [RS_BRF_01160] AUTOSAR shall support BSW distribution on multi core MCUs

多核应该有自己单独的通信总线,同时多核之间的通信总线也应该有相互的网关

4.1.25 [RS_BRF_01168] AUTOSAR BSW and RTE shall support MCUs with memory write protection

内存写保护

4.1.26 [RS_BRF_00057] AUTOSAR shall define a memory mapping mechanism

内存映射机制

4.1.27 [RS_BRF_01176] The RTE shall be the only interfacing layer between software components and the BSW

RTE是SWC和BSW之间的唯一接口

4.1.28 [RS_BRF_01184] AUTOSAR shall support different methods of degradation

需要支持init和deinit,支持部分方法或者模式的部分初始化

Operating System

4.2.1 [RS_BRF_01200] AUTOSAR OS shall be backwards compatible to OSEK OS

要符合OSEK OS标准

4.2.2 [RS_BRF_01208] AUTOSAR OS shall support to start lists of tasks regularly

任务调度需要有一个任务列表

4.2.3 [RS_BRF_01216] AUTOSAR OS shall support to synchronize ScheduleTables to an outside time source

调度表需要支持可同步时间

4.2.4 [RS_BRF_01232] AUTOSAR OS shall support isolation and protection of application software and BSW

给SWC和BSW做不同的保护,相当于权限不一致。

4.2.5 [RS_BRF_01234] AUTOSAR OS shall support isolation and protection between BSW modules

模块之间的保护,应该将标准的功能实现和拓展的需求实现分开。标准+拓展。利于复用和移植。

4.2.6 [RS_BRF_01240] AUTOSAR OS shall support communication between OSApplications

需要支持OS应用之间的通信机制。在多OSApplications和多核之间传递一些数据。

4.2.7 [RS_BRF_01248] AUTOSAR OS shall support to terminate and restart OSApplications

OSApplications可以终止和重启

4.2.8 [RS_BRF_01256] AUTOSAR OS shall offer support to switch off cores

如何检测到没有task执行,那应该关掉核心来节能。如果没有给核3分配task那应该关掉它。

4.2.9 [RS_BRF_01264] AUTOSAR OS shall support multi-core deadlock free mutual exclusion

需要一个不会死锁的互斥机制来支持多核

4.2.10 [RS_BRF_01272] AUTOSAR OS shall offer functionality to allow Software Components time measurement

提供一个时间测量的功能,来测量任务执行的时长,用来观察任务的负载,以及占用的时长。

Runtime Environment (RTE)

4.3.1 [RS_BRF_01280] AUTOSAR RTE shall offer the external interfaces between Software Components and between Software Components and BSW

需要提供接口 传递数据 + 传递函数

4.3.2 [RS_BRF_01288] AUTOSAR RTE interfaces shall be independent of the addressee

需要支持不同的ECU、SWC之间的数据传递

4.3.3 [RS_BRF_01296] AUTOSAR RTE shall support and handle single and multiple instantiation of Software Components

支持多实例化,也就是整个数组或链表

4.3.4 [RS_BRF_01304] AUTOSAR RTE shall support broadcast communication

支持多播

4.3.5 [RS_BRF_01312] AUTOSAR RTE shall support procedure-call communication

支持过程调用通信,例如调用系统服务,NVRAM管理服务

4.3.6 [RS_BRF_01316] AUTOSAR RTE shall support data transformation transparent to the Software Components

支持数据的修改添加等。添加校验位等

4.3.7 [RS_BRF_01317] AUTOSAR shall support SOME/IP

支持SOME/IP。SOME/IP是为以太网设计的串行化和RPC协议

4.3.8 [RS_BRF_01320] AUTOSAR RTE shall schedule SWC and BSW modules

在这里调度SWC和BSW。在OS中启动OS的调度,根据OStask中的配置启动RTE中的调度

4.3.9 [RS_BRF_01328] AUTOSAR RTE shall support scheduling of executable entities on defined events

调度时需要明确是定时调度/中断触发/某某事件触发

4.3.10 [RS_BRF_01336] AUTOSAR RTE shall only run software component runnables inside tasks

不在中断中处理,而是中断中设置事件,RTE根据事件处理

4.3.11 [RS_BRF_01344] AUTOSAR RTE shall support Software Component global data

要有一些全局数据来处理不同运行实体的数据交互

4.3.12 [RS_BRF_01352] AUTOSAR RTE shall offer direct read/write data access, and alternatively pre-read data before a runnable is called and post-write data after the runnable returns

RTE应提供直接的读写数据或在运行实体被调用之前预读

4.3.13 [RS_BRF_01360] AUTOSAR RTE shall support explicit protection mechanisms against concurrent access

应该防止并发

4.3.14 [RS_BRF_01368] AUTOSAR RTE shall support calibration data

支持校准数据

4.3.15 [RS_BRF_01376] AUTOSAR RTE shall support automatic re-scaling and conversion of port data elements

数据的缩放与转换在RTE完成

4.3.16 [RS_BRF_01384] AUTOSAR RTE shall support automatic range  checks of data

自动检查数据的有效范围

4.3.17 [RS_BRF_01392] AUTOSAR RTE shall support a bypass implementation

支持旁路的实现,可以将已有的代码集成在Autosar的RTE中

4.3.18 [RS_BRF_01393] AUTOSAR RTE shall support a bypass selectable after generation of an ECU image

支持配置旁路的运行于禁止。

Use Case : A bypass user extends the functionality of a power-train ECU to perform experimental validation of new algorithms.

4.3.19 [RS_BRF_01394] AUTOSAR shall support a memory interface for RTE-managed buffer access

支持RTE缓冲区内存管理接口

4.3.20 [RS_BRF_01395] AUTOSAR shall support synchronization points for buffer access

支持缓冲区访问同步点

4.3.21 [RS_BRF_01400] AUTOSAR RTE shall offer configurable test hooks

提供可配置的hook用来测试

Services

4.4.1 [RS_BRF_01408] AUTOSAR shall provide a service layer that is accessible from each basic software layer

管理功能必须对系统所有模块和层可用。管理功能的接口称为服务

4.4.2 [RS_BRF_01416] AUTOSAR services shall support standardized handling of non-volatile memory data

提供NVM服务,独立于硬件,支持并发

4.4.3 [RS_BRF_01424] AUTOSAR services shall support communication services

提供通信服务

4.4.4 [RS_BRF_01432] AUTOSAR services shall support system time services

提供时间服务

4.4.5 [RS_BRF_01440] AUTOSAR services shall support system diagnostic functionality

提供基本的诊断服务

4.4.6 [RS_BRF_01448] AUTOSAR services shall support mode and state management

提供模式和状态管理

4.4.7 [RS_BRF_01456] AUTOSAR services shall provide system wide cryptographic functionality

提供加密服务

4.4.8 [RS_BRF_01464] AUTOSAR services shall support standardized handling of watchdogs

提供看门狗服务

4.4.9 [RS_BRF_01468] AUTOSAR services shall support time services for relative time measurement

提供时间测量服务 Use Case : Time measurement, timeout supervision, busy waiting

Mode Management

4.5.1 [RS_BRF_01472] AUTOSAR shall support modes

支持模式管理

4.5.2 [RS_BRF_01480] AUTOSAR shall support software component local modes, ECU global modes, and system wide modes

支持软件的范围管理,支持不同的范围模式

  • software component local

  • ECU global

  • system wide

4.5.3 [RS_BRF_01488] AUTOSAR RTE and BSW shall support standardized modes for ECU start up, ECU shut down with restart, and for putting an ECU to sleep

支持对ECU的模式管理

4.5.4 [RS_BRF_01496] AUTOSAR shall standardize how events which move an ECU out of the SLEEP mode are handled

模式的切换应该设计详细的事件来触发和追踪

4.5.5 [RS_BRF_01504] AUTOSAR shall handle memory corruption resulting from ECU sleep

进入SLEEP模式时应该对内存进行校验计算,用于唤醒时对数据的校验

4.5.6 [RS_BRF_01512] AUTOSAR mode management shall support standardized modes for handling of communication buses

对通信总线的模式管理

4.5.7 [RS_BRF_01520] AUTOSAR RTE shall automatically adapt the runnable management on a mode switch

RTE需要自适应不同mode的运行

4.5.8 [RS_BRF_01528] AUTOSAR mode management shall perform actions based on the evaluation of configured rules

模式管理应提供运行时的配置规则与评估规则

4.5.9 [RS_BRF_01536] For system wide modes, AUTOSAR mode management shall forward ECU local mode requests to all involved ECUs

模式管理应该支持将模式请求发送给相关的ECU

Communication via Bus

4.6.1 [RS_BRF_01544] AUTOSAR communication shall define transmission and reception of communication data

通信应定义数据如何处理、如何发送以及如何接收显示的

这里有看到一种很优美的写方法供大家学习。是不是很清晰!

/* Table of service (instance) relevant information. */
const DescSvcInst g_descSvcInst[kDescSvcInstNumItems] =
{ /*DescMsgLen, {DescStateInfo} ,DescSetStateIndex, DescPostHandlerIndex,DescMainHandler*/
  {   2, 0x03, 0x03, 1, { 0x03, 0x07, 0x00 },                      0,    0, DescOemStartSessionDefault } /* $10 $1 */,
  {   2, 0x03, 0x03, 1, { 0x03, 0x07, 0x00 },                      1,    0, DescOemStartSessionProgramming } /* $10 $2 */,
  {   2, 0x03, 0x03, 1, { 0x03, 0x07, 0x00 },                      2,    0, DescOemStartSessionExtended } /* $10 $3 */,
  {   2, 0x03, 0x03, 1, { 0x03, 0x07, 0x00 }, kDescStateNoTransition,    0, ApplDescEcuResetHard } /* $11 $1 */,
  {   2, 0x03, 0x03, 1, { 0x03, 0x07, 0x00 }, kDescStateNoTransition,    0, ApplDescEcuResetSoft } /* $11 $3 */,
  {   4, 0x03, 0x03, 0, { 0x03, 0x07, 0x00 }, kDescStateNoTransition,    0, DescOemClearDiagInfo } /* $14 */,
  {   3, 0x03, 0x03, 0, { 0x03, 0x07, 0x00 }, kDescStateNoTransition,    3,  ApplDescUserServiceHandler } /* $19 $1 ----by Evan, original DescMainHandler:DescOemReadDtcRNODTCBSM*/,
  {   3, 0x03, 0x03, 0, { 0x03, 0x07, 0x00 }, kDescStateNoTransition,    3,  ApplDescUserServiceHandler } /* $19 $2 ----DescOemReadDtcRDTCBSM*/,

  {   2, 0x03, 0x03, 0, { 0x03, 0x07, 0x00 }, kDescStateNoTransition,    3,  ApplDescUserServiceHandler } /* $19 $3 ----DescOemReadDtcRDTCSSI*/,
  {   6, 0x03, 0x03, 0, { 0x03, 0x07, 0x00 }, kDescStateNoTransition,    3,  ApplDescUserServiceHandler } /* $19 $4 -----DescOemReadDtcRDTCSSBDTC*/,
  {   2, 0x03, 0x03, 0, { 0x03, 0x07, 0x00 }, kDescStateNoTransition,    3,  ApplDescUserServiceHandler } /* $19 $A ----DescOemReadDtcRSUPDTC*/,
  {   0, 0x03, 0x03, 0, { 0x03, 0x07, 0x00 }, kDescStateNoTransition,    2, DescReadDataByIdentifier } /* $22 */,
  {   2, 0x03, 0x03, 0, { 0x03, 0x07, 0x00 }, kDescStateNoTransition
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

FlechazoCLF

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值