AUTOSAR学习之RTE - 可运行实体
本文介绍RTE的运行体(runnable)。
An AUTOSAR component defines one or more "runnable entities". A runnable entity is a piece of code with a single entry point and an associate set of data. A softwarecomponent description provides definitions for each runnable entity within the softwarecomponent.
For components implemented using C or C++ the entry point of a runnable entity is implemented by a function with global scope defined within a software-component's source code. The following sections consider the function signature and prototype.
组件内部可以定义一组运行体。每个运行体内部有一个入口和与之关联的数据。
例如:

构件运行体为:
/* Model step function */
void Runnable_Component1 ( void )
{
/* local block i/o variables */
real_T rtb_BufferInput_InsertedFor_Dat;
{
uint8_T rtb_BufferInput_InsertedFor_Eve;
/* SignalConversion: '<Root>/BufferInput_InsertedFor_DataIN_at_outport_0' incorporates:
* Inport: '<Root>/DataIN'
*/
rtb_BufferInput_InsertedFor_Dat = Rte_IRead_Runnable_Component1_DataINPort_Data();
/* SignalConversion: '<Root>/BufferInput_InsertedFor_Event_at_outport_0' incorporates:
* Inport: '<Root>/Event'
*/
Rte_Read_EventPort_Event ( &rtb_BufferInput_InsertedFor_Eve );
/* Outputs for enable SubSystem: '<Root>/Runable1' incorporates:
* EnablePort: '<S1>/Enable'
*/
if ( rtb_BufferInput_InsertedFor_Eve > )
{
/* S-Function (sfun_autosar_clientop): '<S1>/BSW_ADD' incorporates:
* Constant: '<Root>/1'
*/
Rte_Call_AddPort_Add ( rtb_BufferInput_InsertedFor_Dat, Component1_P._Value, &Component1_B.BSW_ADD );
}
/* end of Outputs for SubSystem: '<Root>/Runable1' */
/* SignalConversion: '<Root>/BufferOutput_InsertedFor_DataOUT_at_inport_0' */
Rte_Write_DataOutPort_Data ( Component1_B.BSW_ADD );
}
}
使用一个xml描述这个运行体(可以看作是定义阶段所扫描生成的),结构如下:
<RUNNABLE-ENTITY>
<SHORT-NAME>Runnable_Component1</SHORT-NAME>
<CAN-BE-INVOKED-CONCURRENTLY>false</CAN-BE-INVOKED-CONCURRENTLY>
<DATA-READ-ACCESSS>
<DATA-READ-ACCESS>
<SHORT-NAME>IN_DataINPort_Data</SHORT-NAME>
<DATA-ELEMENT-IREF>
<R-PORT-PROTOTYPE-REF DEST="R-PORT-PROTOTYPE">/SWC/Component1/DataINPort</R-PORT-PROTOTYPE-REF>
<DATA-ELEMENT-PROTOTYPE-REF DEST="DATA-ELEMENT-PROTOTYPE">/Component1/if/MathDataInterface/Data</DATA-ELEMENT-PROTOTYPE-REF>
</DATA-ELEMENT-IREF>
</DATA-READ-ACCESS>
</DATA-READ-ACCESSS>
<DATA-RECEIVE-POINTS>
<DATA-RECEIVE-POINT>
<SHORT-NAME>IN_EventPort_Event</SHORT-NAME>
<DATA-ELEMENT-IREF>
<R-PORT-PROTOTYPE-REF DEST="R-PORT-PROTOTYPE">/SWC/Component1/EventPort</R-PORT-PROTOTYPE-REF>
<DATA-ELEMENT-PROTOTYPE-REF DEST="DATA-ELEMENT-PROTOTYPE">/Component1/if/EventInterface/Event</DATA-ELEMENT-PROTOTYPE-REF>
</DATA-ELEMENT-IREF>
</DATA-RECEIVE-POINT>
</DATA-RECEIVE-POINTS>
<DATA-SEND-POINTS>
<DATA-SEND-POINT>
<SHORT-NAME>OUT_DataOutPort_Data</SHORT-NAME>
<DATA-ELEMENT-IREF>
<P-PORT-PROTOTYPE-REF DEST="P-PORT-PROTOTYPE">/SWC/Component1/DataOutPort</P-PORT-PROTOTYPE-REF>
<DATA-ELEMENT-PROTOTYPE-REF DEST="DATA-ELEMENT-PROTOTYPE">/Component1/if/MathDataInterface/Data</DATA-ELEMENT-PROTOTYPE-REF>
</DATA-ELEMENT-IREF>
</DATA-SEND-POINT>
</DATA-SEND-POINTS>
<SERVER-CALL-POINTS>
<SYNCHRONOUS-SERVER-CALL-POINT>
<SHORT-NAME>SC_AddPort_Add</SHORT-NAME>
<OPERATION-IREFS>
<OPERATION-IREF>
<R-PORT-PROTOTYPE-REF DEST="R-PORT-PROTOTYPE">/SWC/Component1/AddPort</R-PORT-PROTOTYPE-REF>
<OPERATION-PROTOTYPE-REF DEST="OPERATION-PROTOTYPE">/BSW/if/BSW_ADD/Add</OPERATION-PROTOTYPE-REF>
</OPERATION-IREF>
</OPERATION-IREFS>
<TIMEOUT>0.000001</TIMEOUT>
</SYNCHRONOUS-SERVER-CALL-POINT>
</SERVER-CALL-POINTS>
<SYMBOL>Runnable_Component1</SYMBOL>
</RUNNABLE-ENTITY>
上面的<SYMBOL>Runnable_Component1</SYMBOL> 提示链接器连接这个符号。
1. 签名(Signature)
The definition of all runnable entities, whatever the RTEEvent that triggers their execution, follows the same basic form. [rte sws 1126]
<void|Std_ReturnType> <name>([IN Rte_Instance <instance>], [role parameters])
Where <name> 3 is the symbol describing the runnable's entry point rte sws in 0053. The definition of the role parameters is defined in Section 5.7.3.
所有运行体,不管是怎样触发,函数定义都是下面这个格式:
<void|Std_ReturnType> <name>([IN Rte_Instance <instance>], [role parameters])
如前面的例子:
void Runnable_Component1(void)
参数的意义为:
IN Rte_Instance <instance> - 本实体的指针,因为一个构件可以多重实例化,所以有时候必须要判断一下自己是哪个实体。
role parameters - 指明是谁触发的这个运行体,有时候一个运行体可以被多个事件触发,需要确定一下自己是哪个事件出发的。
Section 5.2.6.4 contains details on a recommended naming conventions for runnable entities based on the RTEEvent that triggers the runnable entity. The recommended naming convention makes explicit the functions that implement runnable entities as well as clearly associating the runnable entity and the applicable data element or operation.
2. 入口点原型(Entry Point Prototype)

The RTE determines the required role parameters, and hence the prototype of the entry point, for a runnable entity based on information in the input information (see Appendix B). The entry point defined in the component source must be compatible with the parameters passed by the RTE when the runnable entity is triggered by the RTE and therefore the RTE generator is required to emit a prototype for the function. [rte sws 1132] The RTE generator shall emit a prototype for the runnable entity's entry point in the application header file.
RTE通过角色参数判断入口点类型,所以运行体入口必须要定义得复合参数类型,以便于RTE生成函数的触发。
The prototype for a function implementing the entry point of a runnable entity is emitted for both "RTE Contract" and "RTE Generation" phases. The function name for the prototype is the runnable entity's entry point. The prototype of the entry point function includes the runnable entity's instance handle and its role parameters, see Figure 5.2.

[rte sws 1016] The function implementing the entry point of a runnable entity shall define an instance handle as the first formal parameter.
第一个参数必须是组件实例。
The RTE will ensure that when the runnable entity is triggered the instance handle parameter indicates the correct component instance. The remaining parameters passed to the runnable entity depend on the RTEEvent that triggers execution of the runnable entity.
[rte sws 1130] A function implementing a runnable entity entry point shall only have the return type Std_ReturnType, if the runnable entity represents a server operation and the AUTOSAR interface description of that client server communication lists potential application errors. All other functions implementing a runnable entity entry point shall have a return type of void.
如果运行体是一个server operation,则返回正确与否,否则返回void。
[rte sws ext 2704] Only the least significant six bit of the return value of a server runnable shall be used by the application to indicate an error. The upper two bit shall be zero. See also rte sws 2573.
返回值的最高2位必须是0。
AUTOSAR学习之RTE - 可运行实体的更多相关文章
- AUTOSAR学习之RTE - 基本概念
1.什么是RTE? The Run-Time Environment (RTE) is at the heart of the AUTOSAR ECU architecture. The RTE is ...
- Adaptive AUTOSAR 学习笔记 8 - 干货小结:背景、技术、特征、架构、方法论和 Manifest
官方文档下载方式及介绍情参见 Adaptive AUTOSAR 学习笔记 2 - 官方文档下载及阅读建议. 这是 Adaptive AUTOSAR 学习笔记的第 8 篇,学习笔记 3 - 7 翻译了 ...
- python学习笔记-python程序运行
小白初学python,写下自己的一些想法.大神请忽略. 安装python编辑器,并配置环境(见http://www.cnblogs.com/lynn-li/p/5885001.html中 python ...
- Adaptive AUTOSAR 学习笔记 3 - AP 背景、技术及特征(中文翻译)
本系列学习笔记基于 AUTOSAR Adaptive Platform 官方文档 R20-11 版本.本文从AUTOSAR_EXP_PlatformDesign.pdf开始,一边学习,一边顺带着翻译一 ...
- Adaptive AUTOSAR 学习笔记 1 - Overview
缩写 AP: AUTOSAR Adaptive Platform CP: AUTOSAR Classic Platform AA: Adaptive Application ARA: AUTOSAR ...
- Adaptive AUTOSAR 学习笔记 6 - 架构 - 方法论和 Manifest
本系列学习笔记基于 AUTOSAR Adaptive Platform 官方文档 R20-11 版本 AUTOSAR_EXP_PlatformDesign.pdf 缩写 AP:AUTOSAR Adap ...
- Adaptive AUTOSAR 学习笔记 10 - 执行管理
本系列学习笔记基于 AUTOSAR Adaptive Platform 官方文档 R20-11 版本 AUTOSAR_EXP_PlatformDesign.pdf 缩写 EM:Execution Ma ...
- Adaptive AUTOSAR 学习笔记 16 - 时间同步和网络管理
本系列学习笔记基于 AUTOSAR Adaptive Platform 官方文档 R20-11 版本 AUTOSAR_EXP_PlatformDesign.pdf.作者:Zijian/TENG 原文地 ...
- MFC学习-第一课 MFC运行机制
最近由于兴趣爱好,学习了孙鑫的MFC教程的第一课.看完视频了,自己便用visual studio 2010尝试了MFC编程,其中遇到了一些问题. 1.vs2010不像vs6.0那样可以新建一个空的MF ...
随机推荐
- android开发环境配置和一些坑
要开发安卓应用,首先就是要配置安卓的开发环境. 新手在这个步骤时,会发现安卓的开发环境配置不是一般的麻烦,因为一般人是选择eclipse+a sdk+adt的,需要java环境,需要翻 墙,需要有非一 ...
- white box白盒测试
逻辑覆盖法:语句覆盖,判定覆盖,条件覆盖,判定/条件覆盖,组合覆盖,路径覆盖 基本路径测试法:Control Flow Graphs, CFG.带箭头的边 条件覆盖:使每个判定中每个条件的可能值至少满 ...
- 2018.11.2 2018NOIP冲刺之最短公共父串
很有意思的一个题 试题描述 给定字符串A和字符串B,要求找一个最短的字符串,使得字符串A和B均是它的子序列. 输入 输入包含两行,每行一个字符串,分别表示字符串A和字符串B.(串的长度不超过30) 输 ...
- git中常用的操作命令有哪些?常用操作命令归纳
git中常用的操作命令有哪些?本篇文章就给到大家归纳了一些git中常用操作命令.有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. git开始 全局配置:配置用户名和e-mail地址 1 ...
- 关于安装了git或者小乌龟(TortoiseGit)使用之后出现红色! 绿色√ 蓝色?的解决办法:
在当前目录中新建文件保存为(删除git信息.bat)在其写入:for /r . %%a in (.) do @if exist "%%a\.git" rd /s /q " ...
- 初识Grep
前言:grep这个命令都不陌生,最常用的就是和管道符结合,例如:ps -ef | grep docker,但是我还是想认识一下这个非常giao的命令... Grep称为全局正则表达式检索工具,在企业中 ...
- xfs 文件系统修复
pvcreate /dev/sdb1 pvcreate /dev/sdc1 pvcreate /dev/sdd1 vgcreate vg_bricks /dev/sdb1 vgcreate vg_br ...
- UVA11988 【Broken Keyboard (a.k.a. Beiju Text)】:题解
题目链接:https://www.luogu.org/problemnew/show/UVA11988 这题虽说是和链表有关的模拟,但其实并不是很需要啊,但蒟蒻用了(说的好听是练手,说的难听是太弱), ...
- MTSC2019第五届移动互联网测试开发大会PPT下载
关注公众号「软件测试大本营」后台回复「MTSC」或「测试开发大会」即可获取云盘下载地址及提取码. 注:PPT文件版权归相关撰写人所有,仅供学习交流,请勿用于任何商业用途,谢谢 前不久在北京举办了第五届 ...
- 个人永久性免费-Excel催化剂功能第53波-无比期待的合并工作薄功能
合并工作薄.工作表功能,几乎每一款Excel插件都提供,而且系列衍生功能甚至有多达10多个.今天Excel催化剂重拾武器,在现有众多插件没提供到位的部分场景中,给予支持和补充,做到人有我优,人无我有的 ...