Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Verify Bounded Execution Time in Satellite Flight Software

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Verifying bounded execution time in satellite flight software ensures that every task completes within its allocated time slot, preventing missed deadlines that could lead to system failures or loss of the mission. This guide walks you through a practical, step-by-step process using static analysis, dynamic measurement, and formal verification techniques. You'll need access to your flight software's source code, a representative hardware target (or a high-fidelity simulator), a logic analyzer or tracing tool, and a real-time operating system (RTOS) that supports timing instrumentation.

What You'll Need

  • Source code of the flight software (including all tasks, ISRs, and kernel configuration)
  • A representative target hardware board or a cycle-accurate simulator
  • A logic analyzer, oscilloscope, or software tracing tool (e.g., JTAG trace, SEGGER SystemView)
  • An RTOS with timing hooks (e.g., VxWorks, RTEMS, FreeRTOS with trace macros)
  • Static analysis tools (e.g., AbsInt aiT, or an open-source alternative like OTAWA)
  • Build tools and a debugger for your specific processor architecture

Step-by-Step

  1. Define the timing requirements. For each task, interrupt service routine (ISR), and critical section, specify the worst-case execution time (WCET) and the deadline. These should come from the system requirements or the scheduling analysis (e.g., Rate Monotonic Analysis). Write these down in a traceability matrix.
  2. Set up the measurement environment. Connect your logic analyzer or tracing tool to the target. Configure the RTOS to record task start/stop events and ISR entry/exit events. Ensure the system clock and timer resolution are sufficient (at least 1 microsecond, preferably better).
  3. Create a reproducible test scenario. Design a test that exercises the worst-case input conditions for each task. This often involves injecting maximum data rates, triggering all possible error paths, and preempting tasks at the most critical moments. Use a test harness that can run the same scenario repeatedly.
  4. Measure execution times. Run the test scenario multiple times (at least 100 iterations) and record the execution time of each task and ISR. Use the tracing tool to capture start and end timestamps. Compute the maximum observed execution time for each piece of code.
  5. Perform static WCET analysis. Use a static analyzer on the compiled binary (or source) to compute an upper bound on execution time without actually running the code. This analysis considers all possible paths, including loops, branches, and cache behavior. Configure the tool with the target processor's timing model (e.g., ARM Cortex-R5, LEON3).
  6. Compare static and dynamic results. The static WCET should be greater than or equal to the maximum measured time. If it is much larger (e.g., 10x), your static analysis may be too pessimistic; if it is smaller, your analysis is incorrect or your test scenario is not covering the worst case. Investigate discrepancies.
  7. Add safety margins. Multiply the static WCET by a safety factor (typically 1.2 to 2.0) to account for unforeseen hardware variations, compiler changes, or future software updates. This becomes your verified WCET value.
  8. Verify scheduling feasibility. Using the verified WCETs, run a scheduling analysis (e.g., with a tool like MAST or manually using RMA) to confirm that all tasks meet their deadlines under the worst-case scheduling scenario. If not, you must reduce WCETs or adjust priorities.
  9. Document and baseline. Record the verified WCETs, the test scenario, the analysis configuration, and the safety margin in a version-controlled document. This becomes the baseline for future changes.
  10. Repeat after any change. Whenever you modify the flight software, re-run the dynamic measurements and static analysis. Automate this in your continuous integration pipeline if possible.

Common Mistakes

  • Testing only happy paths. Forgetting to test error handling, watchdog timeouts, or maximum data load leads to underestimating WCET.
  • Ignoring interrupts. Execution time of a task includes time for interrupts that preempt it. You must measure total time from task start to task end, including any preemption overhead.
  • Using a simulator that is not cycle-accurate. A functional simulator may not model cache, pipeline, or memory wait states, giving unrealistic times.
  • Not accounting for cache and DMA. Cache misses and DMA transfers can drastically increase execution time. Static analysis must model these, or you must disable caches for a conservative estimate.
  • Assuming the compiler is deterministic. Different optimization levels or compiler versions can change WCET. Always analyze the exact binary that will fly.

Tips

  • Use a hardware-in-the-loop (HIL) setup with the actual flight processor and peripherals to get realistic timing.
  • Instrument at the source level with macros that toggle GPIO pins around critical sections; this is simpler than a full tracing tool and often sufficient.
  • Run a stress test with a random input generator to explore more paths than a hand-crafted test.
  • For space applications, consider using a time-triggered architecture (e.g., TTEthernet) to make timing verification easier.
  • Keep the safety margin explicit and justify it in your verification report.

Troubleshooting

Measured time exceeds static WCET. This is a red flag. Check that your static analysis includes all possible paths (e.g., exception handlers, floating-point operations). Re-run with a more conservative analysis configuration, or disable caches and measure again.

Static WCET is absurdly high (e.g., 100x the measured). Your analysis may be modeling the wrong processor variant or cache policy. Verify the timing model matches your hardware revision. Also, check for loops that the analyzer cannot bound—add loop bound annotations.

Tracing tool misses events. Increase the buffer size, reduce the number of events traced, or use hardware tracing (e.g., ETM on ARM) instead of software hooks.

Task misses its deadline in scheduling analysis. Try raising the task's priority, splitting the task into smaller ones, or optimizing the code (e.g., using faster math functions). If still not feasible, you may need to reduce the task's period or change the system design.

Test scenario is not repeatable. Use a deterministic input seed and disable any randomization in the scheduler. Ensure the system clock is stable and not affected by temperature drift.

Frequently Asked Questions

Q: What is the difference between WCET and execution time?
A: Execution time is what you measure when running the code; WCET is the theoretical upper bound for any input and any initial state. WCET is always greater than or equal to the maximum measured time.

Q: Can I use a simulator instead of real hardware?
A: Yes, but only if the simulator is cycle-accurate and models the exact processor, memory, and peripherals. Otherwise, the results are not trustworthy for flight software.

Q: How many test runs are enough?
A: There is no fixed number, but a common practice is to run until the maximum observed time stabilizes (i.e., no new maximum for 100 consecutive runs). For safety-critical systems, combine with static analysis to cover all paths.

Q: Does compiler optimization affect WCET?
A: Yes, significantly. Higher optimization levels can reduce execution time but may also change control flow. Always analyze the exact binary that will be deployed.

Q: What if my RTOS does not support tracing?
A: You can manually toggle GPIO pins at task entry/exit and measure with an oscilloscope. Alternatively, add your own instrumentation hooks in the RTOS scheduler.

Q: Is static analysis mandatory for certification?
A: For critical software (e.g., DO-178C Level A), static WCET analysis is highly recommended and often required to demonstrate that timing requirements are met. It provides a formal upper bound that dynamic testing cannot guarantee.