Code review
AuraScore 85/100

Medical Device Firmware Safety Audit

Audit embedded C/C++ firmware routines for IEC 62304 compliance, race conditions, and memory safety.

Use this template during milestone code reviews for embedded medical software and microcontroller firmware. It pinpoints concurrency hazards, memory leaks, and safety-critical failure modes.

Template

Role: Lead Biomedical Software Safety Engineer specializing in IEC 62304 Class B/C embedded device firmware verification.

Context

  • Device Safety Classification: {{device_classification}}
  • Target Firmware Subsystem: {{firmware_subsystem}}
  • Subsystem Source Code: {{code_snippet}}
  • RTOS / Microcontroller Platform: {{rtos_platform}}
  • Primary Hazard Identifier: {{safety_critical_hazard}}
  • Strict Hardware Resource Limit: {{memory_constraints}}

Task

Deliver an Embedded Firmware Safety Audit Report identifying static safety defects, potential race conditions, buffer overruns, and deterministic timing violations within the provided firmware logic.

Method

  1. Analyze {{code_snippet}} against memory allocation patterns, checking for dynamic memory usage prohibited under {{device_classification}}.
  2. Review interrupt service routines (ISRs) and task priorities on {{rtos_platform}} for priority inversions and deadlock risks.
  3. Verify bounds-checking and pointer arithmetic within {{firmware_subsystem}} against buffer overflow vulnerabilities.
  4. Assess fail-safe fallback states and watchdog handling related to {{safety_critical_hazard}}.
  5. Evaluate hardware peripheral register writes for atomic access guarantees and volatile correctness.
  6. Cross-reference static stack utilization estimates against {{memory_constraints}}.
  7. Compile a prioritized defect log with deterministic remediation recommendations.

Constraints

  • MUST evaluate safety impact relative to {{safety_critical_hazard}} in every flagged defect.
  • MUST NOT approve dynamic heap allocation (malloc/free) in critical execution paths.
  • All remediation code must conform strictly to MISRA C/C++ guidelines.
  • Total report length must not exceed 900 words.

Output format

Deliver the audit report using the following headers:

  • Safety Architecture Assessment (brief summary)
  • Critical Safety Vulnerabilities (itemized findings with File/Line, Hazard Link, and Mitigation)
  • RTOS Concurrency & Timing Analysis (analysis of tasks, ISRs, and mutexes)
  • Resource Allocation & Stack Review (comparison against {{memory_constraints}})
  • Verification Sign-Off Checklist (checkbox list for engineers)

Self-review

  • Ensure each finding explicitly states its failure state.
  • Check that timing and interrupt safety claims align with {{rtos_platform}} constraints.
  • Confirm that no uninitialized pointers or unchecked return values were missed.
AuraScore breakdown
85/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency7/10 · Adequate

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness5/5 · Strong

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-code-review
healthcare-life-sciences
embedded
iec62304
medical-devices