The FAA/NASA have guidelines for getting space craft "human rated":
https://www.huffpost.com/entry/what-are-the-safety-regulatio...
The software design aspects of these rules have probably evolved in conjunction with DO-178, the industry standard for designing safe computing systems for avionics.