# K16 — Integrated real-time application and evidence report

## Position

- Series: FreeRTOS C++
- Lesson: L15, card K16
- Duration: 30 minutes
- Final integration card; no new wrapper primitive
- Reproducible end-to-end evidence on Hazard3

## Outcome

The student composes ownership, storage, task priorities, startup coordination,
ISR/timer boundaries, queue pressure and memory/stack diagnostics into one
defensible real-time service graph.

## Lesson plan

| Time | Mode | Evidence |
| --- | --- | --- |
| 0–5 | inventory | static services delta 0; dynamic report queue 128 B |
| 5–10 | startup | EventGroup barrier=0x7; task priorities and ownership |
| 10–15 | inputs | real IRQ tick 1; timer ticks 5/10 |
| 15–20 | pipeline | three samples, transform sum 120 |
| 20–25 | pressure | peaks 2/2, sequence 4 dropped, end marker recovers |
| 25–30 | report | latency 6, stack HWM, 24-event digest c474ac09 |

## Acceptance

- no new wrapper primitive is introduced;
- producer, processor and reporter are StaticTask instances;
- startup EventGroup remains at mask 0x7;
- external IRQ wakes producer at tick 1 and requests exactly one yield;
- periodic timer callbacks occur at ticks 5 and 10, then timer becomes inactive;
- three samples are produced, processed and reported with sum 120;
- input and report queues both reach depth 2;
- sequence 4 is explicitly drop-newest and the end marker later succeeds;
- static services have heap delta zero;
- exactly one persistent dynamic Queue costs 128 B;
- oversized fallible allocation returns null without changing free heap;
- producer/processor/reporter stack HWM are positive and recorded;
- end-to-end latency is 6 ticks and trace digest is c474ac09;
- target exits with PASS.

## Main traps

1. Adding abstraction without a new invariant.
2. Hiding an unbounded allocation or queue wait in the periodic path.
3. Treating a pressure drop as success or failing to count it.
4. Performing transformation in ISR/timer callback instead of a task.
5. Reporting screenshots without source, timestamped trace and repeatable gate.
