The new fr_comm library gives Python 3.10 and later full control of FlashRunner 2.0 on Windows, Linux and ARM Linux, with no C/C++ or C# wrapper layer in between.

Modern production lines and automated test environments rely more and more on Python. It runs natively on embedded Linux boards, integrates directly into CI/CD pipelines, and powers the automation layer of countless in-house factory tools. Until now, however, connecting those environments to FlashRunner 2.0 meant bridging through a C/C++ or C# integration layer — an additional dependency that not every team can afford to maintain over the long term.

The fr_comm Python library removes that constraint. Delivered as a standard pip-installable package (wheel), it gives you the complete FlashRunner communication interface — device commands, file transfers, project execution, data encryption and real-time logging — directly from Python 3.10 or later, on Windows, Linux and ARM Linux.

  • Full device control over LAN and USB/serial, at up to 3 Mbaud
  • Runs on Windows, Linux and ARM Linux
  • Installed with a single pip command; only two runtime dependencies
  • Follows the conventions of the C/C++ and C# libraries, so existing integrators have almost nothing new to learn
  • Requires Python 3.10 or later

Getting started

Install the wheel:

python -m pip install fr_comm_python-1.0.0.0-py3-none-any.whl

Verify the installation:

python -c "import fr_comm; print('import ok')"
python -c "from fr_comm import FR_GetDllVersion; print(FR_GetDllVersion())"

That is all the setup required. The minimal example below opens a LAN session, queries the device status and handles errors, and can be extended directly into a full volume-production script:

from fr_comm import FlashRunner, FR_Comm_Exception

try:
  with FlashRunner("LAN", "192.168.1.100:1234") as fr:
      fr.FR_SendCommand("#GETENGSTATUS")
      print(fr.FR_GetAnswer(1500))
except FR_Comm_Exception as exc:
  print(exc)

A small, stable public API

Client applications work through just six public symbols. The interface is deliberately small, which keeps integrations simple and upgrade paths clear:

  • FlashRunner — the main class; opens the device session and provides all operations.
  • FR_Logger — an independent real-time logging client, available over LAN.
  • FR_Comm_Exception — a single exception type shared by all communication and protocol errors.
  • FR_FileType — enumeration of the supported file types: FRB, PRJ, LIC, LOG, LIB.
  • ProgressHandler — an optional callback interface for reporting file transfer progress.
  • FR_GetDllVersion() — returns the library version string for runtime validation.

Flexible connections

A FlashRunner object opens the connection as soon as it is created. Using a with block is the recommended pattern: the session is closed automatically and correctly even if an exception occurs during an operation.

FlashRunner("LAN", "192.168.1.100:1234")   # LAN, the most common production setup
FlashRunner("COM3", "115200")              # USB/serial on Windows
FlashRunner("/dev/ttyUSB0", "115200")      # USB/serial on Linux

Both 115200 and 3000000 baud are supported. FlashRunner starts at 115200 by default; to switch to 3 Mbaud, first send #55*SETSERIALBAUDRATE HIGH at 115200, then set the host to the same baud rate before continuing. This makes high-throughput transfers possible even over a direct USB connection.

Device operations

Command execution follows a simple send/receive pattern. FR_SendCommand() sends any FlashRunner command string, and FR_GetAnswer() collects the device response within a configurable timeout:

fr.FR_SendCommand("#GETENGSTATUS")
answer = fr.FR_GetAnswer(1500)   # timeout in milliseconds

For multi-channel scenarios, FR_SendCommand_Ex() takes an explicit channel list and builds the channel header automatically, so the calling code does not have to assemble strings by hand:

fr.FR_SendCommand_Ex([1, 2], "RUN Project.prj")
answer = fr.FR_GetAnswer(1500)

File transfer works in both directions. The optional ProgressHandler reports percentage progress, which is useful for console messages or progress bars in a user interface during longer transfers:

fr.FR_SendFile(r"C:\FlashRunner\app.frb", FR_FileType.FRB)
fr.FR_GetFile("app.frb", r"C:\FlashRunner\dest", FR_FileType.FRB)

Running a project takes a single call. FR_RunProject() waits until all channels have finished or the timeout expires. With the optional per-channel callback, results can be fed straight into an MES or test reporting system:

def on_done(channel: int, result: bool) -> None:
  print(f"channel {channel}: {'OK' if result else 'FAIL'}")

fr.FR_RunProject("demo.prj", [1, 2, 3], 120000, on_done)

Built-in data encryption for dynamic memory

Applications that need to write protected content to FlashRunner’s dynamic memory can perform RSA/AES encryption entirely within Python, with no external tools. FR_GetPublicKey() retrieves and stores the device’s public key; two encryption modes are then available, depending on the workload:

  • Single-shot encryption (FR_EncryptData) — each call generates a new AES key and IV, and returns both the encrypted data and the RSA-wrapped header. The header must be sent to the device before each data block. Simple and self-contained, and well suited to occasional or infrequent writes.
  • Session encryption (FR_DynMem*) — FR_DynMemBeginEncryption() establishes the session key once and returns a single header to send to the device. FR_DynMemEncryptData() then encrypts multiple consecutive blocks with automatic CBC IV chaining, so there are no repeated header transfers and no session management overhead. FR_DynMemResetEncryption() ends the session. This is the recommended approach when writing a sequence of blocks to the same dynamic memory area.

Typical use cases

  • Automated test fixtures: program firmware, run a validation project on multiple channels, and feed pass/fail results into a test framework or MES — entirely over LAN, with no Windows host required.
  • Production line controllers running on embedded Linux boards: manage FlashRunner sessions and report programming results to a central system in real time.
  • CI/CD pipelines: upload updated firmware files to FlashRunner, trigger programming, and check the result programmatically during build verification.
  • A migration path for existing in-house Python tools: add FlashRunner support without bringing a C/C++ or C# dependency into the project.

Key benefits

  • Cross-platform, with no code changes: the same wheel runs on a Windows workstation, a Linux server and an embedded Linux board on the factory floor.
  • Minimal integration cost: one pip command, two dependencies, one import — from zero to a working device connection in minutes.
  • A familiar API: it follows the conventions of the existing C/C++ and C# libraries, so teams already using FlashRunner can move to Python without relearning how to integrate.
  • Session-oriented design: a single FlashRunner object manages the whole lifetime of the connection, keeping integration code clean and predictable.
  • Structured error handling: every failure surfaces as an FR_Comm_Exception, optionally with a machine-readable error code, which makes automated error classification simple.

The fr_comm library extends FlashRunner 2.0 to Python-based production and test environments without compromise. Every operation available through the C/C++ and C# libraries — commands, file transfers, project execution, encryption and real-time logging — is available through this single pip package, on any platform that runs Python 3.10.

For teams building automation around FlashRunner, this means shorter integration cycles, fewer toolchain dependencies, and a direct path from a Python script to a fully controlled programming station — whether that station sits on a development workstation or is embedded in a production line.