SWC步骤

纲要:

SWC属于AUTOSAR的Component文件夹下,而Composition属于Composition文件夹下。

目录

1. Import "Data Type" and "Interface" information

2. Creat Software Component(SWC)

3. Create "Port" for this SWC

4. Add "Internal Behavior" for this SWC


1. Import "Data Type" and "Interface" information

Copy the "01_TypesAndInterface.arxml" file into the project, which contains

  • Sender receiver Interface
    • Data Element
  • Application data type
  • Implementation Data Type

which will be used in the "SWC creation". [0][0.1]

2. Creat Software Component(SWC)

Right click on the project, create "Component - Element/Sensor Actuator Sw Component Type". Then name the SWC, which will create "02_WiperControl_100us.arxml" file to save the SWC information.

3. Create "Port" for this SWC

Right click on the "02_WiperControl_100us.arxml" file and Open with “Component Editor", there will be option to create Pport/Rport. And also which Interface to be added under the port.[0.2](Interface is defined under 01_TypesAndInterface.arxml

4. Add "Internal Behavior" for this SWC

  • Runnable Entity(RE) [1]
    • DataAccessPoint: DataReadAccess/DataWriteAccess [2][2.1]        
    • Timing Event[3]
  • DataTypeMappingSet[4][5]

1个SWC下面可以有多个 runnable【也就是函数】和多个Interface。 runnable下的DataAccessPoint 实现了将指定的interface分配给该runnable/函数 

注:

[0] 说明新建SWC port的前提是要提前定义好Interface库,port只能从现有的库里面去绑定Interface

Interface定义在01_TypesAndInterface.arxml的PortInterface Package下面

[0]: 每次在新建SWC之前,都应该去看看有哪些Interface可用,这是新建SWC的基础和前提条件。因为SWC的port只能与现有的Interface相连,而Interface下面的Data Element则代表着SWC可用的variable

[0.1]: Application data type 和 Implementation Data Type 存在“01_TypesAndInterface.arxml”文件,但AUTOSAR platform types存在"ISOLAR_PlatformTypes.arxml"文件里面

[0.2]: 用户去决定是Pport还是Rport,因为Interface是不分方向的

[1] 每个SWC下面可以有多个runnables

[2] 是Read还是Write基于之前给该SWC新建的Ports来确定,软件会自动识别这步分配的是Pport还是Rport,从而确定是Read还是Write AccessPoint

[2.1] DataAccessPoint是在Function/Runnable下面的一个子tab,说白了就是一个SWC可以有多个runnable,在DataAccessPoint这个tab来规定各个port到底分配到哪个runnable

[3] 新建TimingEvent后软件会问和哪个runnable绑定,即TimingEvent可以看作是runnable的子tab

[4] DataTypeMappingSet is under "Internal Behavior', 所以说是基于SWC去绑定一个个相互独立的DataTypeMappingSet

[5] 之前在“01_TypesAndInterface.arxml” 文件里面只会去创建Application data type和Implementation data type(并声明IDT和哪种AUTOSAR base type相连)(Data Element在Interface下面和ADT相连),在这里(02_WiperControl_100us.arxml)才会将 Application data type和Implementation data type连接起来(可附加ComputeMethoud)

02_WiperControl_100us.arxml

[6] 但在实际生成的代码中,SWC变量/DataElement 用的是Implementation data type

WiperControl_2ms.c

[7] 之所以搞ADT出来,是为了Interface的复用,因为IDT是和AUTOSAR Platform Type绑定的,而AUTOSAR Platform Type与硬件有关(Int是16还是32-bit), 而在创建Interface的时候如果直接用IDT换了硬件就没法复用了,所以选用ADT和Data Element绑定,然后再在SWC的Internal Behavior里面用DataTypeMapping将ADT和IDT对应起来

1. RTE.c 里面的function name 是由 Internal behavior/Function这儿的命名一样吗?

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值