您的位置:首页 > 编程语言

停用代码——DO-178B/ED-12B学习笔记之二

2009-12-21 17:45 239 查看
停用代码­
——DO-178B/ED-12B学习笔记之二

1. 停用代码的定义

  DO-178B/ED-12B对停用代码(Deactivated code)的定义是:
  Executable object code (or data) which by design is either (a) not intended to be executed (code) or used (data), for example, a part of a previously developed software component, or (b) is only executed (code) or used (data) in certain configurations of the target computer environment, for example, code that is enabled by a hardware pin selection or software programmed options.
  试译如下:
  由设计而产生的可执行目标码(或数据)是:(a)不打算执行的代码或不打算使用的数据,如以前开发的软件部件的一部分;(b)是只能在目标计算机环境的某一配置中执行的代码或使用的数据,例如可通过硬件引脚选择或软件可编程的选项使能的代码。
  由此可见:
  ——停用代码是针对可执行的目标码而不是源码定义的;
  ——停用代码包括代码和数据;
­  ——停用代码在当前的目标计算机环境的配置中被停止执行(指代码)或停止使用(指数据)。

2. 停用代码与无用代码的区别

  DO-178B/ED-12B在5.4. 3条提到了停用代码与无用代码(dead code)的区别:
An airborne system or equipment may be designed to include several configurations, not all of which are intended to be used in every application. This can lead to deactivated code that cannot be executed or data that is not used. This differs from dead code which is defined in the glossary and discussed in subparagraph 6.4.4.3.
  试译如下:
  一个机载系统或设备可设计为包括若干种配置,这不意谓在每一种应用中使用所有的配置。这样可能导致不被执行的不起作用的代码或不被使用的数据。这不同于在术语汇编中定义的和在6.4.4.3条中讨论的无用代码。
  DO-248B/ED-94B在FAQ#28中有如下论述:
  The distinction between dead code and deactivated code is important in answering this concern. As defined in DO-178B/ED-12B, dead code is associated with design errors: …
  On the other hand, the definition of deactivated code and Sections 6.4.4.3d and 5.4.3 of DO-178B/ED-12B allow code that is not used in the specific application to be present in airborne systems under the conditions that it is disabled and covered in the software plans. Loosely restating Section 6.4.4.3d: deactivated code is there on purpose, and it should be verified to be safe.
  试译如下:
  在回答这个问题时区分无用代码与停用代码是重要的。如DO-178B/ED-12B所定义,无用代码与设计错误有关:…
  另一方面,停用代码的定义以及DO-178B/ED-12B的6.4.4.3d条和5.4.3条允许在机载系统中存在某个特定应用不使用的代码,其条件是这类代码不被使能,并且在软件计划中说明了这类代码。
  由此可见,停用代码与无用代码的主要区别是:
  ——前者来自正常的设计,后者来自错误的设计;
  ——前者可以保留,后者必须消除。

3. 停用代码的确认

  与无用代码不同的是,停用代码是有意设计的。一般情况下,设计者知道它们在程序中的位置,而且应该在软件需求和软件设计文档中说明这类代码。然而,在软件验证过程中,独立的软件验证方会报告没有被覆盖的代码。此时需要设计者确认未覆盖的代码是停用代码还是无用代码。
  与无用代码类似的是,结构覆盖分析可以但不是必定揭示停用代码。在前一篇笔记中说明了无用代码识别与结构覆盖分析的关系,这也适用于停用代码。

4. 停用代码的处理

  在软件策划过程中,DO-178B/ED-12B的4.2.h条规定:
  If deactivated code is planned (subsection 2.4), the software planning process should describe how the deactivated code (selected options, flight test) will be defined, verified and handled to achieve system safety objectives.
  试译如下:
  如果准备允许停用代码(2.4条),软件策划过程要描述怎样定义、验证和处理停用代码(例如,可选项、飞行试验),以达到系统安全性目标。
  在集成过程中,DO-178B/ED-12B的5.4.3.a条和5.4.3.b条规定:
  a. Evidence should be available that the deactivated code is disabled for the environments where its use is not intended. Unintended activation of deactivated code due to abnormal system conditions is the same as unintended activation of activated code.
  b. The methods for handling deactivated code should comply with the software plans.
  试译如下:
  a. 要有证据表明停用代码在不打算使用它的环境中未被使能。由于异常的系统状态造成的停用代码的不希望的动作与在用代码的不希望的动作具有相同的性质。(笔者注:此译文参考了法文版,后一句意味这种动作是不允许的)
  b.处理停用代码的方法要符合软件计划。
  在软件验证过程中,DO-178B/ED-12B的6.4.4.3.d条规定:
  Deactivated code: For deactivated code which is not intended to be executed in any configuration used within an aircraft or engine, a combination of analysis and testing should show that the means by which such code could be inadvertently executed are prevented, isolated, or eliminated. For deactivated code which is only executed in certain configurations of the target computer environment, the operational configuration needed for normal execution of this code should be established and additional test cases and test procedures developed to satisfy the required coverage objectives.
  试译如下:
  停用代码:对于在飞机或发动机的任何配置中不打算被执行的停止使用的代码, 应结合分析和测试来表明已采用了某种手段,它能防止、隔离或消除因疏忽而执行这类代码。对于只在目标机环境的某些配置中执行的停用代码,应建立正常执行这类代码所需的运行配置,并开发附加的测试用例和测试规程来满足所需的覆盖目标。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: