Skip to content

chore(esp32): eliminate runtime esp_rom_printf call sites #2699

Closed

Description

@zackees

Context

esp_rom_printf is already discouraged by FastLED's C++ lint checker: it bypasses FastLED logging, blocks on a slow peripheral, and spreads platform-specific output into code that should use FastLED's logging/IO layer. The current source still has suppressed runtime call sites.

Current scan:

rg -n esp_rom_printf\( examples/AutoResearch src/platforms/esp -g *.h -g *.hpp -g *.cpp

The runtime call sites are grouped in:

  • examples/AutoResearch/AutoResearchWave8Expand.h and examples/AutoResearch/AutoResearchParlioEncode.h: boot-time benchmark output originally routed through ROM printf so AutoResearch output could reach USB-Serial-JTAG.
  • src/platforms/esp/32/drivers/usb_serial_jtag_esp32_idf.hpp and src/platforms/esp/32/detail/io_esp_jtag_or_uart.hpp: USB-Serial-JTAG bootstrap/fallback diagnostics.
  • src/platforms/esp/32/drivers/lcd_spi/lcd_spi_peripheral_esp.cpp.hpp: LCD SPI/clockless error diagnostics from IRAM-sensitive paths.

The lint/checker references and tests should remain; this issue is about eliminating runtime source calls rather than removing the checker.

Proposal

Replace direct runtime esp_rom_printf usage with appropriate FastLED-owned mechanisms:

  • Route AutoResearch benchmark output through FL_PRINT, fl::print, or an AutoResearch serial helper once USB-Serial-JTAG routing is reliable.
  • Replace USB-Serial-JTAG bootstrap logs with a FastLED-owned platform output abstraction, or make the initialization path report state after the normal logging sink is available.
  • For IRAM/error paths such as LCD SPI, record error state/counters in the ISR/IRAM path and emit logs from task/poll context instead of printing directly from the low-level transmit path.
  • Remove // ok esp_rom_printf suppressions from runtime source files as each call site is replaced.

Acceptance criteria

  • rg -n esp_rom_printf\( examples/AutoResearch src/platforms/esp -g *.h -g *.hpp -g *.cpp finds no runtime source call sites.
  • esp_rom_printf remains allowed only in lint/checker code, tests that verify the checker, or documentation that explains the ban.
  • AutoResearch benchmark output remains visible to the host on supported ESP32 USB-Serial-JTAG boards.
  • USB-Serial-JTAG bootstrap/fallback diagnostics are still available through FastLED-owned logging/IO or through explicit non-runtime state reporting.
  • LCD SPI/clockless failure paths do not log from ISR/IRAM-sensitive code; failures are surfaced from task-safe context.
  • The existing EspRomPrintfChecker continues to reject new raw esp_rom_printf runtime calls.

Open questions

  • Should a very early ESP32 bootstrap path have a dedicated FastLED emergency sink, or should bootstrap diagnostics be deferred until normal logging is initialized?
  • Should the lint checker become stricter by disallowing // ok esp_rom_printf suppressions in runtime source after this cleanup lands?

Related issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions