>
section 15 of 182 min read

15. Worked Mini-Cases

15.1 STM32F4 drone flight controller

  • 168 MHz Cortex-M4F, 1 MB flash, 192 KB RAM.
  • FreeRTOS, ~1 ms tick.
  • Tasks: IMU (1 kHz, prio 5), state estimator (500 Hz, prio 5), PID (500 Hz, prio 5), motor PWM (500 Hz, prio 4), RC RX (50 Hz, prio 3), telemetry (10 Hz, prio 2), logging (100 Hz, prio 1).
  • DMA: SPI to IMU (no CPU), UART to RX, SDIO to log card.
  • SWD for development; production lockable via RDP.

The choreography hinges on an exit-criticality discipline: highest-priority sensing, then control, then I/O, then optional work.

15.2 ESP32 smart bulb

  • Dual-core Xtensa at 240 MHz, 4 MB flash, ~520 KB RAM.
  • ESP-IDF + FreeRTOS.
  • Wi-Fi (Tuya, Matter), MQTT, OTA.
  • PWM on three channels for RGB LED.
  • Bootloader: ESP-IDF v2 secure boot, signed images, encrypted flash.
  • Power: drawn from mains, no battery considerations.
  • Security: factory-installed device key, OTA over TLS, anti-rollback in eFuses. Reality: many cheap clones ship without these enabled. ESP32 secure boot v1 was bypassed via voltage glitching.

15.3 Pacemaker

  • ARM Cortex-M0+ at 8 MHz, sub-microamp average current.
  • Custom RTOS, IEC 62304 Class C development.
  • Watchdog + redundant supervisors.
  • Sensing: charge-amplifier on heart electrodes, ADC.
  • Pacing: capacitor-discharge pulse on demand.
  • Telemetry: short-range RF to programmer wand.
  • Battery: 1.5-3 Ah lithium, must last 7-10 years.
  • Security: signed firmware update with physical proximity required (regulator-mandated since 2017 advisories).

15.4 Industrial PLC

  • Linux on ARM Cortex-A7, real-time kernel patches.
  • CODESYS or proprietary IEC 61131-3 runtime.
  • Modbus TCP, EtherCAT, PROFINET.
  • 25-year lifecycle, repairable hardware.
  • Field firmware update via web UI, signed.