A hands-on learning project for spacecraft computer systems — real-time operating systems, embedded C, and delay-tolerant networking — built entirely in virtual environments using QEMU.
No physical hardware required.
Building a spacecraft computer simulator with Claude Code
Set up an ARM cross-compilation environment and write bare-metal C targeting an emulated Cortex-M3 (MPS2-AN385). Software talks directly to hardware registers without an OS.
- UART output via memory-mapped I/O
- Interrupt handlers (SysTick timer)
Clone FreeRTOS and run it on the same QEMU Cortex-M3 target. Learn RTOS fundamentals through progressive exercises.
- Two tasks printing to UART at different rates
- Share data between tasks via a FreeRTOS queue
- Watchdog timer that resets if a task hangs
- Sensor-reading pipeline with priority-based scheduling
- Trigger and resolve a priority inversion scenario
Build NASA JPL's delay-tolerant networking stack and simulate space-like network conditions.
- Two-node DTN network in Docker containers
- Simulated degraded links with
tc netem(latency, packet loss, intermittent connectivity) - Bundle transfer over degraded link (sustained throughput, larger payloads)
- File transfer using CFDP
- Contact-graph routing with scheduled link windows
FreeRTOS "spacecraft" sends telemetry over DTN to a "ground station" — a miniature version of real mission architecture.
- FreeRTOS collects fake sensor data in QEMU
- ION DTN node acts as ground station in Docker
- UART bridge: telemetry flows from QEMU to ION via host script
- Artificial Mars-distance delays on the virtual network
sudo apt install gcc-arm-none-eabi qemu-system-arm build-essential
make -C bare-metal run # bare-metal: build and run in QEMU (Ctrl-A, X to exit)
make -C freertos run # FreeRTOS: sensor pipeline demo
make -C freertos test # run integration tests (7 assertions)
make -C dtn test # DTN: build ION, run two-node network, 6 tests
make -C dtn test-degraded # DTN: degraded links (latency, loss, intermittent), 3 tests
make -C dtn test-throughput # DTN: larger payloads (10-500 KB) over degraded links
make -C dtn test-cfdp # DTN: CFDP file transfer (1-100 KB, integrity checks)
make -C dtn test-cgr # DTN: contact-graph routing with scheduled windows (~3 min)
make -C integration run # integration: continuous telemetry in QEMU (Ctrl-A, X to exit)
make -C integration test # run integration tests (15 assertions)
make -C integration test-bridge # UART bridge: QEMU -> DTN ground station (11 assertions)
make -C integration test-mars-delay # Mars delay: 5s OWLT + tc netem (7 assertions)| Domain | What | Why It Matters |
|---|---|---|
| RTOS | Deterministic scheduling, priority preemption, queues, mutexes | Tasks must execute within guaranteed time windows |
| Spacecraft | Radiation hardening, TMR, ECC, strict C standards (JPL/MISRA) | Cosmic rays flip bits; software must be bulletproof |
| DTN | Store-and-forward, Bundle Protocol, contact-graph routing | TCP/IP breaks in space; DTN handles latency and link disruption |
- "Digital Apollo" by David Mindell — Apollo Guidance Computer history
- "Mastering the FreeRTOS Real Time Kernel" by Richard Barry — free PDF
- JPL "Power of 10" coding rules — safety-critical C style guide
- RFC 9171 — Bundle Protocol specification
- NASA cFS — open-source flight software framework
- ION DTN docs