FlasherControl

From SEGGER Wiki
Jump to: navigation, search

Purpose

The Flasher Compact provides a serial connection via the assigned emulated serial port device (Character Device Class; under Windows: e.g. JLink CDC UART Port) when connected to a host PC via USB. This connection allows access to the command line interface (CLI), through which all possibilities of the standalone mode of the Flasher can be used.

Sometimes access via this communication channel is difficult or not possible. For such cases, FlasherControl.exe offers a possibility to access the CLI of the Flasher via USB. It is primarily intended for use with Flasher Compact in solitary mode (without FLasher Hub) or generally for troubleshooting when the CLI of Flasher products is not available via an Ethernet or serial communication channel. It also contains a rudimentary terminal mode, which makes the use of a special terminal program unnecessary in simple cases.

Since the Flasher Compact in stand-alone mode has neither an Ethernet nor a dedicated serial interface — these are otherwise provided centrally by the Flasher Hub for all connected devices — control by an automation or test computer is sometimes not easy.

One obvious option is to use the Flasher Compact in host-controlled mode in conjunction with J-FLash. In this case, the connected Flasher is controlled directly by J-FLash. For MCUs that are only supported by U-Flash, this option is not available, as direct control of a flasher via U-FLash is not (yet) supported.

FlasherControl is a simple way of integrating the Flasher Compact in stand-alone mode via scripts — by simply calling a utility program — into an automation system.

In any case, a separate instance of the control programme must be started for each connected flasher if several targets are to be programmed simultaneously and in parallel.

Installation

The program is part of the "Flasher Software and Documentation Package" from version 7.86i.

You can also download the FlasherControl.exe from here:

Operation

Command line arguments

FlasherControl command line arguments
argument description
-SN Use Flasher with given serial number.
-P Select given project name before programming.
-I Interactive terminal-like mode.
-C The command to be sent to the Flasher to be executed instead of #auto. (Flasher commands has to be prefixed by #)
-T The program ends when the termination string is found in the Flasher response.
FlasherControl.exe command line parameters

Parameter SN

If more than one flasher is connected to the PC, this parameter can be used to specify which flasher is to be used. If it is omitted in such a case, a dialogue for selecting a Flasher is displayed to the user instead.

Syntax

-SN serial number

Example

FlasherControl.exe -SN 844200006

Parameter I

This parameter causes the program to operate in interactive operation mode. If not specified, the program operates in automatic mode

Syntax

-I

Example

FlasherControl.exe -SN 844200006 -I

Parameter C

This parameter sets the command to send to Flasher, when operating in automatic mode. When omitted, #auto is used.

Syntax

-C #flasher command

Example

FlasherControl.exe -SN 844200006 -P boot.UNI -C #read

Parameter P

When using the #Automatic_mode the project name specified with this parameter is sent as #select before the command. This selects the project to use on Flasher. I.e. one must specify the name of the CFG file ('without extension '.cfg' for J-Flash projects or the name of the UNI file (with extension *.uni).

Syntax

-P project name

Example

FlasherControl.exe -SN 844200006 -P boot.UNI -C #read

Parameter T

When using the #Automatic_mode, this argument specifies the string when received from the flasher, the programme is terminated.

Syntax

-T termination string

Example

FlasherControl.exe -SN 844200006 -P boot.UNI -C #read -T ERR:

Operation modes

The FlasherControl program supports two modes of operation, automatic and interactive.

Interactive mode

The interactive mode is started by the call parameter -I.

FlasherControl.exe example for interactive mode

In interactive mode, a user can control the Flasher via the CLI as if it were a terminal program.

FlasherControl.exe example for interactive #read command

The interactive mode ends on reception of the BREAK signal followed by ENTER (CTRL-C, ENTER on most PC).

Automatic mode

In automatic mode a single command is sent to Flasher and the response from the Flasher is captured.

The command can be specified by the -C argument; #auto is sent by default.

FlasherControl.exe example for automatic mode with #auto command

Optionally an additional preceding #select command can be issued. This #select project name is set by -P project name

FlasherControl.exe example for automatic mode with pre-selected project

The capture ends - like in interactive mode - with BREAK signal followed by ENTER. Additionally it ends after reception of a response from Flasher containing the specified terminator. The terminator string can be specified by -T terminator string.

When the terminator is received, the processing of communication ends .

Post-processing output

All fetched content is output via STDOUT.

Additionally as state messages from FlasherControl itself are also output on STDERR.

To process the output of the Flasher the output can easily be redirected to files

FlasherControl.exe … >filename

or piped to other post-processing tools

FlasherControl.exe … | other post processing-tool

To process the FlasherControl state messages, STDERR can be redirected by 2>. Piping STDERR is a little bit more complicated. First redirect STDERR to STDOUT — the pipe; then redirect STDOUT to NUL (without changing where STDERR is going):

FlasherControl.exe … 2>&1 >NUL | other post processing-tool

Both redirection methods can be combined to fetch STDOUT and STDERR to separate files:

FlasherControl.exe … >stdout-filename 2>stderr-filename

To combined output before processing use following construction:

FlasherControl.exe … 2>&1 >combined-filename;