Flasher/Controlling Flasher via U-Flash and J-Flash CLI

From SEGGER Wiki
Jump to: navigation, search

Introduction

The U-Flash executable (UniversalFlasher.exe) and J-Flash executable (JFlash.exe) are part of the Flasher Software and Documentation Pack. Both applications can be controlled via CLI, e.g. from within scripts, in order to automate the download of projects onto a Flasher which is connected via USB to the host computer.

U-Flash Command line options

This section lists and describes all available command line options. Some options accept additional parameters which are enclosed in angle brackets, e.g. <FILENAME>. If these parameters are optional they are enclosed in square brackets too, e.g. [<SADDR>]. Neither the angle nor the square brackets must be typed on the command line. They are used here only to denote (optional) parameters.

The command line options are evaluated in the order as they are passed to U-Flash, so please ensure that the project and data file have already been opened when evaluating a command line option which requires this.

It is recommended to always use

-openprj <PRJFILENAME> -opendat <FILENAME>[,<SADDR>]

to make sure the correct project and data files are opened.

All command line options return 0 if the processing was successfully. A return value unequal 0 means that an error occurred.

Option Description
-download Downloads the open project configuration to the Flasher.
-exit Exits U-Flash.
--help
-help
-h
Displays the help dialog.
-opendat <FILENAME>[,<SADDR>] Opens a data file.
-openprj <FILENAME> Opens an existing project.
-saveprjas <FILENAME> Saves the current data file in the specified file.
-savecfg <FILENAME> Saves the Flasher configuration file.
-savedat <FILENAME> Saves the Flasher data file.
-saveprj Saves the current project.
-saveprjas <FILENAME> Saves the current project in the specified file.
-sn <SERIALNUMBER Selects the Flasher
-erase Erases the chip with the configured erase method.
-program Programs the chip.
-verify Verifies the programmed data
-auto Executes the selected tasks. The default is usually erase, program, verify.
-read Reads data from the chip and displays it on stdout.

Setting up a Flasher for programming via U-Flash CLI

After the U-Flash project was configured and saved (via the U-Flash GUI). It can be downloaded to the Flasher as follows:

-openprj <PRJFILENAME> -SN <SERIALNUMBER> -download -exit

The project can now be programmed as follows:

-SN <SERIALNUMBER> -auto -exit


J-Flash Command line options

For the J-Flash command line options, please refer to UM08003_JFlash#Command_line_options.