Skip to content

feat(tools): integration of automated firmware flashing and protocol testing - #1

Open
q23818 wants to merge 5 commits into
chenlongos:mainfrom
q23818:main
Open

feat(tools): integration of automated firmware flashing and protocol testing#1
q23818 wants to merge 5 commits into
chenlongos:mainfrom
q23818:main

Conversation

@q23818

@q23818 q23818 commented Jul 16, 2026

Copy link
Copy Markdown

This PR integrates automated firmware deployment with physical hardware protocol validation for the ESP32-C3 chassis controller, resolving dynamic port mapping limitations on macOS/Linux hosts and establishing an unattended flashing-to-testing pipeline.

Issues Addressed & Solutions

  1. Host Serial Port Hardcoding

    • Problem: tests/test_uart.py previously hardcoded /dev/ttyS1, causing immediate connection failures on macOS targets.
    • Solution: Replaced static configuration with argparse to allow dynamic runtime port injection (e.g., /dev/cu.usbmodem*).
    • Addition: Added active buffer clearance and an explicit CMD_RESET guard in the connection finally block to prevent lingering hardware spin states post-execution.
  2. Decoupled Flash-Test Pipeline

    • Problem: In high-throughput flashing scenarios, flashing and quality control (PQC) required distinct manual interventions, slowing down deployment.
    • Solution: Added a --test flag to tools/batch_burner.py. When enabled, the runner automatically spawns the updated test_uart.py subprocess 1.0 second after a successful flash (allowing host USB subsystem renegotiation).
  3. Documentation Debt

    • Problem: Lack of standardized SOPs for production and environment bootstrapping.
    • Solution: Rewrote README.md to define standard project topology, Espressif asset mirror configs (solving high-latency GitHub downloads in domestic networks), and detailed SOPs for standalone tests and automated pipeline stages.

File Changes

  • tools/batch_burner.py:
    • Implemented --test argument parser logic.
    • Added sys.executable subprocess invocation targeting the dynamically discovered test_uart.py path.
    • Added pre-flight safety checks validating environment existence of pyserial and test assets.
  • tests/test_uart.py:
    • Refactored CLI parser to capture platform-specific tty nodes.
    • Added I/O buffer purge sequence before interface release.
  • README.md:
    • Added bootstrap environment variables, flashing pipelines, and QC exit-code expectations.

Verification & Test Run

Executed end-to-end regression tests on macOS 15.x target:

  1. Dynamic Testing Validation:

    $ python3 tests/test_uart.py /dev/cu.usbmodem11101

    Result: Successfully passed all 26 assertions regarding init handshakes, velocity control, bad-checksum rejection, and out-of-bounds error state machine blocks.

  2. Pipeline Integration Validation:

    $ python3 tools/batch_burner.py --test

    Result: Target detected -> Flashed successfully at 921600 bps -> Subprocess executed -> 26 assertions passed on live hardware -> Safe disconnect.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant