Compiling an application for use in highly radioactive environments

后端 未结 23 1884
名媛妹妹
名媛妹妹 2020-12-02 03:30

We are compiling an embedded C++ application that is deployed in a shielded device in an environment bombarded with ionizing radiation. We are using GCC and cross-compiling

23条回答
  •  旧时难觅i
    2020-12-02 03:56

    NASA has a paper on radiation-hardened software. It describes three main tasks:

    1. Regular monitoring of memory for errors then scrubbing out those errors,
    2. robust error recovery mechanisms, and
    3. the ability to reconfigure if something no longer works.

    Note that the memory scan rate should be frequent enough that multi-bit errors rarely occur, as most ECC memory can recover from single-bit errors, not multi-bit errors.

    Robust error recovery includes control flow transfer (typically restarting a process at a point before the error), resource release, and data restoration.

    Their main recommendation for data restoration is to avoid the need for it, through having intermediate data be treated as temporary, so that restarting before the error also rolls back the data to a reliable state. This sounds similar to the concept of "transactions" in databases.

    They discuss techniques particularly suitable for object-oriented languages such as C++. For example

    1. Software-based ECCs for contiguous memory objects
    2. Programming by Contract: verifying preconditions and postconditions, then checking the object to verify it is still in a valid state.

    And, it just so happens, NASA has used C++ for major projects such as the Mars Rover.

    C++ class abstraction and encapsulation enabled rapid development and testing among multiple projects and developers.

    They avoided certain C++ features that could create problems:

    1. Exceptions
    2. Templates
    3. Iostream (no console)
    4. Multiple inheritance
    5. Operator overloading (other than new and delete)
    6. Dynamic allocation (used a dedicated memory pool and placement new to avoid the possibility of system heap corruption).

提交回复
热议问题