Flasher - Working with Flasher

From SEGGER Knowledge Base
Revision as of 13:54, 13 August 2024 by JanB (talk | contribs) (→‎Stand-alone mode: fixed links)
Jump to navigation Jump to search

This chapter describes functionality and how to use the current Flasher models.


Flasher Portable PLUS

The Flasher Portable PLUS is a portable version of SEGGERs Flasher family, which has been designed to fill the need of an extremely portable, production grade, Flash programmer used for in-field firmware updates. No need to be tethered to an outlet, it is powered by an integrated Li-Ion cell (680mAh). The Flasher Portable PLUS programs flash targets in stand-alone mode or via J-Flash PC software.

Furthermore the Flasher Portable PLUS allows the user to select between 99 data images to be programmed (since V7.90). The images can be easily selected by using the SEL button on the front of the housing. For more information about support for multiple images, please refer to Multiple File Support.
For setup and configuration purposes, the Flasher Portable PLUS connects to a PC via USB interface, running Windows, Linux & MacOS and has a built-in standard 20-pin J-Link target connector.


Note:
Ethernet and RS232 as host interface are not available for the Flasher Portable PLUS.

Housing & Buttons

The Flasher Portable PLUS comes with a display, which is for example used to represent the status of an ongoing flash progress. Furthermore, there are three buttons which allow the user to control Flasher Portable PLUS. For a detailed description of the functions, take a look at the table below:

Flasher Portable PLUS.png

Button Description
Program Start programming process with the currently selected image.
Select image Select the image to be programmed next time the Program button is pressed.
Power on/off Used to power-on / power-off the Flasher Portable PLUS. Please note that to power up the Flasher Portable PLUS, the button should be hold for at least 1 second to make sure software can boot and take control of power circuit, so the Flasher Portable PLUS keeps powered, after releasing the button.

Configuration

The Flasher Portable PLUS has some configuration options the other Flashers do not have.

Option Description Value range Default value
AutoPowerOffOnIdle Specifies the time interval after which the Flasher Portable will turn off without any user action 1 to 3600 60
ShowDatCRCAfterProgramming Activates displaying the data file CRC after the programming in the pop up message 0 = inactive, 1 = active 0

If the Flasher.ini does not contain a [Config] section with the configuration option, the default value is used.

Example:
This sample will show the data file CRC after the programming and the auto power of is set to five minutes (=300 seconds).

[CONFIG]
AutoPowerOffOnIdle = "300"
ShowDatCRCAfterProgramming = "1"

Flasher Portable

The Flasher Portable is a portable version of SEGGERs Flasher family, which has been designed to fill the need of an extremely portable, production grade, Flash programmer used for in-field firmware updates. No need to be tethered to an outlet, it is powered by three standard AAA batteries. The Flasher Portable programs flash targets in stand-alone mode or via J-Flash PC software.

Furthermore the Flasher Portable allows the user to select between four data images to be programmed. The images can be easily selected by using the arrow buttons on the front of the housing. For more information about support for multiple images, please refer to Multiple File Support.
For setup and configuration purposes, the Flasher Portable connects to a PC via USB interface, running Windows, Linux & MacOS and has a built-in standard 20-pin J-Link target connector.


Note:
Ethernet and RS232 as host interface are not available for the Flasher Portable.

Housing & Buttons

The Flasher Portable comes with several leds which are for example used to represent the status of an ongoing flash progress. Furthermore, there are three buttons which allow the user to control Flasher Portable. For a detailed description of the functions, take a look at the two tables below:

Flasher Portable Top 2.png

LED Description
ACTIVE GREEN. Blinks while the Flasher Portable is busy / performs operations on the target.
PASS/FAIL GREEN/RED. Indicates, if the last flashing cycle was successful.
  • GREEN: Flashing cycle completed successfully.
  • RED: Flashing cycle completed with error.
1/2/3/4 GREEN: Indicates which image is currently selected for programming. For more information about multiple image support, please refer to Multiple File Support.
POWER GREEN: Indicates if Flasher is currently powered. Blinks while Flasher Portable tries to enumerate via USB.
LO BAT 1) The LED is off, meaning battery voltage is > 3.3V
2) The red LED is constant on if battery voltage is low (<= 3.3V). In this mode, Flasher still allows programming.
3) The red LED starts blinking in case of the battery voltage is below 3.0V. Flasher refuse programming attempts.
Button Description
Program Start programming process with the currently selected image.
Select image Select the image to be programmed next time the Program button is pressed.
Power on/off Used to power-on / power-off the Flasher Portable. Please note that to power up the Flasher Portable, the button should be hold for at least 1 second to make sure software can boot and take control of power circuit, so the Flasher Portable keeps powered, after releasing the button

File system

The current generation of Flasher models support filenames (as well as directory names) up to 235 characters in length.
The whole path of a file (or directory) can be up to 259 characters in length.
Only characters from the CP437 character set (latin characters) may be used in file or directory names.


Note:

Support for long filenames (LFN) was added with hardware version 5. Flashers with hardware version 4 and lower support 8.3 filenames only (8 characters filename, 3 characters file extension).

On Flasher units without LFN support, using long filenames may result in incorrect operation. Integrated functions, like the FTP server or the terminal server, will refuse writing files with long filenames on units that do not support it.

Setting up the IP interface

Setting up the IP interface Some of the Flasher models come with an additional Ethernet interface to communicate with the host system. These Flashers also come with a built-in webserver which allows some basic setup of the emulator, e.g. configuring a default gateway which allows using it even in large intranets. For more information, please refer to TCP Services.

Connecting the first time

When connecting Flasher the first time, it attempts to acquire an IP address via DHCP. The recommended way for finding out which IP address has been assigned to Flasher is, to use the J-Link Configurator. The J-Link Configurator is a small GUI-based utility which shows a list of all emulator that are connected to the host PC via USB and Ethernet. For more information about the J-Link Configurator, please refer to UM08001_JLink.pdf (J-Link / J-Trace user guide), chapter Setup, section J-Link Configurator. The setup of the IP interface of Flasher is the same as for other emulators of the J-Link family. For more information about how to setup the IP interface of Flasher, please refer to UM08001, J-Link / J-Trace User Guide, chapter Setup, section Setting up the IP interface. For more information about how to use Flasher via Ethernet or prepare Flasher via Ethernet for stand-alone mode, please refer to Operating modes.

Operating modes

All Flashers except the Flasher ATE are able to boot in 3 different modes:

  • PC-based mode
  • Stand-alone mode
  • File access mode


Note:
The Flasher ATE only supports the stand-alone mode.

Definition PC-based mode
Flasher is connected to a PC via USB/Ethernet and controlled by a PC application (J-Flash). If there is an RS232 connection to a PC, does not have any influence on if PC-based mode is entered or not. In this mode, Flasher can be used as a J-Link and controlled by the software in the J-Link software and documentation package (J-Link Commander, J-Flash, ...)
More information

Definition Stand-alone mode
This mode is entered when there is no active USB/Ethernet connection to a host PC, e.g. if Flasher is only powered via a USB power supply.
More information

Definition file access mode
Entered only if Flasher Start/Stop button (on Flasher Portable the "PROG" button) is kept pressed for at least 2 seconds while connecting the Flasher via USB. In this mode, Flasher enumerates as a mass storage device (like an USB Stick) at the host PC. In this mode, configuration + data files can be manually placed on the Flasher and the Flasher logfile can be read out. If you are using a self-powered Flasher such as the Flasher Portable Plus, the Flasher must be turned off before connecting it.
More information

PC-based mode

If you want to use Flasher for the first time you need to install the Flasher software and documentation package. After installation, connect Flasher to the host PC via USB or Ethernet. For more information about how to install the Flasher software and documentation package please refer to Flasher Software and Documentation Package.

Connecting the target system

Power-on sequence
In general, Flasher should be powered on before connecting it with the target device. That means you should first connect Flasher with the host system via USB / Ethernet and then connect Flasher with the target device via JTAG or SWD. Power-on the device after you connected Flasher to it. Flasher will boot in "PC-based mode".

Verifying target device connection with J-Link.exe
If the USB driver is working properly and your Flasher is connected with the host system, you may connect Flasher to your target hardware. Then start the J-Link command line tool JLink.exe, which should now display the normal Flasher related information and in addition to that it should report that it found a JTAG target and the targets core ID. The screenshot below shows the output of JLink.exe.

flasher jlinkmode.gif

LED status indicators

In PC-based mode, there are also certain LED status codes defined:

# Status of LED Meaning
0 GREEN
high frequency blinking
(On/Off time: 50ms => 10Hz)
Flasher is waiting for USB enumeration or ethernet link. As soon as USB has been enumerated or ethernet link has been established, the green LED stops flashing and is switched to constant green.
0 GREEN
constant
Flasher enumeration process is complete and it is ready to be controlled by a PC application.

Stand-alone mode

In order to use Flasher in "stand-alone mode", it has to be configured first, as described in Setting up Flasher for stand-alone mode. To boot Flasher in the "stand-alone mode", only the power supply to Flasher has to be enabled (Flasher should not be connected to a PC). In the "stand-alone mode" Flasher can be used as a stand-alone flash programmer.
The Flasher can be controlled remotely as described here: remote control


Note:
Flasher can only program the target device it was configured for. In order to program another target device, you have to repeat the steps described in Setting up Flasher for stand-alone mode.

LED status indicators

Progress and result of an operation is indicated by Flasher's LEDs. The behavior is different for J-Link and stand-alone mode. For a definition of the different modes, please refer to Operating modes. The following table describes the behavior of the LEDs in stand-alone mode.

# Status of LED Meaning
0 GREEN
constant
Flasher waits for a start trigger to perform an operation in stand-alone mode.
1 GREEN
slow blinking
Flashing operation in progress:
  • Erasing (slow blinking on/off time: 80 ms => 6.25 Hz)
  • Programming (slow blinking on/off time: 300ms => ~1.67 Hz)
  • Verifying (slow blinking, on/off time: 100ms => 5 Hz)
2 GREEN: constant
RED: off or constant
GREEN constant, RED off: Operation successful.
GREEN constant, RED constant: Operation failed
Goes back to state #0 automatically, but in case of operation failed, RED remains on until state #1 is entered the next time.

Older Flasher models have a different behavior. The following serial number ranges behave different from the table above Flashers with the following serial number ranges behave different and comply to the table below:

  • 1621xxxxx (Flasher ARM V2)
  • 1630xxxxx (Flasher ARM V3)
  • 4210xxxxx (Flasher PPC V1)
  • 4110xxxxx (Flasher RX V1)
# Status of LED Meaning
0 GREEN
high frequency blinking
(On/Off time: 50ms => 10Hz)
Flasher is waiting for USB enumeration or ethernet link. As soon as USB has been enumerated or ethernet link has been established, the green LED stops flashing and is switched to constant green. In stand-alone-mode, Flasher remains in the high frequency blinking state until state #1 is reached.
Flasher goes to state #1 as soon as a #START command has been received via the ASCII interface or the Start button has been pushed.
1 GREEN
constant
Connect to target and perform init sequence.
2 GREEN
slow blinking
Flashing operation in progress:
  • Erasing (slow blinking on/off time: 80 ms => 6.25 Hz)
  • Programming (slow blinking on/off time: 300ms => ~1.67 Hz)
  • Verifying (slow blinking, on/off time: 100ms => 5 Hz)
3 GREEN: constant
RED: off or constant
GREEN constant, RED off: Operation successful.
GREEN constant, RED constant: Operation failed
Goes back to state #0 automatically, but in case of operation failed, RED remains on until state #1 is entered the next time.

File access mode

When pressing the Start/Stop button (for Flasher Portable PLUS PRG button) of the Flasher while connecting it to the PC, Flasher will boot in the "file access mode". If you are using a self-powered Flasher such as the Flasher Portable Plus, the Flasher must be turned off before connecting it. This mode can be used to downdate a Flasher firmware version if a firmware update did not work properly and it can be used to configure Flasher for the "stand-alone mode", without using J-Flash. If Flasher has been configured for "stand-alone mode" as described in the section above, there will be four files on the drive, FLASHER.CFG, FLASHER.DAT, FLASHER.LOG, SERIAL.TXT.

flasher mode msd.gif

FLASHER.CFG contains the configuration settings for programming the target device and FLASHER.DAT contains the data to be programmed. FLASHER.LOG contains all logging information about the commands, performed in stand-alone mode. The SERIAL.TXT contains the serial number, which will be programmed next. J-Flash supports to configure Flasher for automated serial number programming.

Currently, J-Flash does not support to configure Flasher for automated serial number programming.

If you want to configure multiple Flasher for the same target you do not have to use J-Flash all the time. It is also possible to copy the FLASHER.CFG and the FLASHER.DAT files from a configured Flasher to another one. To copy these files boot Flasher in "file access mode".

Setting up Flasher for stand-alone mode

Note:
All Options how to set up the Flasher for stand-alone mode you can find here: Download project to the Flasher

In order to set up Flasher for the stand-alone mode it needs to be configured once using the J-Flash software. For more information about J-Flash, please refer to the J-Flash User Guide.

After starting J-Flash, open the appropriate J-Flash project for the target Flasher shall be configured for, by selecting File -> Open Project. If J-Flash does not come with an appropriate sample project for the desired hardware, a new project needs to be created by selecting File -> File -> New Project.

After the appropriate project has been opened / created, the data file which shall be programmed needs to be loaded, by selecting File -> Open. After this J-Flash should look like in the screenshot below.

jflash projectfile datafile.gif

Before downloading the configuration (project) and program data (data file) to Flasher, the connection type (USB/IP) needs to be selected in the project. These settings are also saved on a per-project basis, so this also only needs to be setup once per J-Flash project. The connection dialog is opened by clicking Options -> Project settings -> General.

jflash connection dialog.gif

The connection dialog allows the user to select how to connect to Flasher. When connecting to a Flasher via TCP/IP it is not mandatory to enter an IP address. If the field is left blank and File -> Download to programmer is selected, an emulator selection dialog pops up which shows all Flasher which have been found on the network. The user then can simply select the Flash he wants to download the configuration to.

EmuSelectionDialog.gif

In order to download the configuration and program data to the Flasher, simply select File -> Download config & data file to Flasher.

jflash download to emul.gif

The J-Flash log window indicates that the download to the emulator was successful.

jflash download to emu succ.gif

From now on, Flasher can be used in stand-alone mode (without host PC interaction) for stand-alone programming.

Preparing for stand-alone operation manually

As an alternative, J-Flash can also be used to save config and data file to a hard drive.

This files can later be copied to a Flasher without using J-Flash, which is useful to prepare additional Flasher for stand-alone programming, if for example a company plans to widen its production, new Flasher units can be bought and used in production by simply copying the files to the new units.

Creating config and data files
J-Flash config (*.CFG) and data (*.DAT) files can be created by using the "Save Flasher config file..." and "Save Flasher data file..." options in the "File" menu.

For some devices, additional files (*.PEX) are needed. J-Flash will create a subdirectory (in the same directory as the config file) with the same name as the config file and place the files needed in this directory.

About *.PEX files
When using the "Save Flasher config file..." menu point or when using the "multiple configurations stored on Flasher" feature (See Multiple File Support.) feature, the following needs to be taken care of:

For some devices, special connect, reset etc. sequences are necessary which are stored in so-called *.PEX files on the Flasher.

When using the "Download config & data file to Flasher", J-Flash takes care of correct use and download of these files to Flasher.

When creating the config files manually and later download them to the Flasher manually, it is user's responsibility to put them at the right place.
The *.PEX files need to be placed in a subdirectory with the same name as the corresponding *.cfg file. J-Flash creates a directory with the correct name automatically when a config file is created.

Example:

MyConf0 is a project for a device that requires a *.PEX file for connect.
MyConf1 is a project for a device that requires no *.PEX file at all.

PEX File Flasher.png

Universal Flash Loader mode

As an alternative to the stand-alone mode, configured via J-Flash, there is the Universal Flash Loader mode. While the normal stand-alone mode relies on using the debug interface of the device, the Universal Flash Loader mode uses device or vendor specific programming interfaces and protocols and therefore it is independent of the CPU core.

The Universal Flash Loader is available for the following Flasher models:

  • Flasher PRO
  • Flasher Compact
  • Flasher Portable PLUS

For some of the supported devices, SEGGER offers specific adapters.

Preparing manually

The Universal Flash Loader uses an configuration file (*.UNI), a device specific flash programming algorithm (*.PEX) and a data file (*.DAT).

Preparing using the PC utility

In order to set up Flasher for the Universal Flash Loader mode, a PC utility called SEGGER Universal Flash Loader Configurator is available for download.

Universal Flash Loader.png

The Universal Flash Loader Configurator comes with a large list of devices and flash programming algorithms. If you are going to use a device from one of the supported families which currently is not available in the utility, feel free to contact the support.

Multiple File Support

It is also possible to have multiple data files and config files on Flasher, to make Flasher more easy to use in production environment. To choose the correct configuration file and data file pair, a FLASHER.INI file is used. This init file contains a [FILES] section which describes which configuration file and which data file should be used for programming. A sample content of a FLASHER.INI file is shown below:

[FILES]
DataFile = "Flasher1.dat"
ConfigFile = "Flasher1.cfg"

Using this method all configuration files and data files which are used in the production only have to be downloaded once. From there on a configuration file / data file pair can be switched by simply replacing the FLASHER.INI by a new one, which contains the new descriptions for the configuration file and data file. The FLASHER.INI can be replaced in two ways:

  1. Boot Flasher in file access mode in order to replace the FLASHER.INI
  2. If Flasher is already integrated into the production line, runs in stand-alone mode and can not be booted in other mode: Use the file I/O commands provided by the ASCII interface of Flasher, to replace the FLASHER.INI. For more information about the file I/O commands, please refer to File I/O commands.

Flasher Portable specifics

Flasher Portable allows to choose between four configuration and data file pairs during runtime by using the select/arrow button on the front of Flasher Portable.

Which config / data file pair is used for which image selection position is determined by the contents of the FLASHER.INI. For this, the FLASHER.INI contents in the [FILES] section have been extended. The sample below shows how to enable the user to select between four different images on the Flasher portable via the select / arrow button:

[FILES]
DataFile = "First.dat"
ConfigFile = "First.cfg"
DataFile1 = "Second.dat"
ConfigFile1 = "Second.cfg"
DataFile2 = "Third.dat"
ConfigFile2 = "Third.cfg"
DataFile3 = "Fourth.dat"
ConfigFile3 = "Fourth.cfg"

Using this method, all configuration files and data files which are used in the production only have to be stored on Flasher Portable via file access mode. From there on, switching between the files can be done by simply using the selection button of Flasher Portable.

Example

1 Target, 2 Datafiles (e.g. boot loader und application) --> same configuration file (*.CFG) but different data files (*.DAT) should be used.

  • Open pre-configured J-Flash project
  • File -> Save Flasher config file ... (DEFAULT.CFG)
  • Open data file 1 (boot loader)
  • File -> Save Flasher data file ... (BOOT.DAT)
  • Open data file 2 (application)
  • File -> Save Flasher data file ... (APP.DAT)
  • Create the a FLASHER.INI file (content see below)
  • Connect the Flasher in file access mode to the PC
  • Copy DEFAULT.CFG, BOOT.DAT, APP.DAT and FLASHER.INI on the Flasher

FLASHER.INI content:

[FILES]
DataFile    = "BOOT.DAT"
ConfigFile  = "DEFAULT.CFG"
DataFile1   = "APP.DAT"
ConfigFile1 = "DEFAULT.CFG"

Flasher Portable PLUS specifics

Flasher Portable PLUS allows to choose between 99 configuration and data file pairs during runtime by using the select button on the front of Flasher Portable PLUS.

Which config / data file pair is used for which image selection position is determined by the contents of the FLASHER.INI. For this, the FLASHER.INI may contain several [BATCH] sections. The sample below shows how to enable the user to select between five different images on the Flasher Portable PLUS via the select / arrow button:

[BATCH]
DataFile = "First.dat"
ConfigFile = "First.cfg"
[BATCH1]
DataFile = "Second.dat"
ConfigFile = "Second.cfg"
[BATCH2]
DataFile = "Third.dat"
ConfigFile = "Third.cfg"
[BATCH7]
DataFile = "Proj_8.dat"
ConfigFile = "Proj_8.cfg"
[BATCH15]
DataFile = "Proj_16.dat"
ConfigFile = "Proj_16.cfg"

Using this method, all configuration files and data files which are used in the production only have to be stored on Flasher Portable PLUS via file access mode. From there on, switching between the files can be done by simply using the selection button of Flasher Portable PLUS.

Please also consider the chapter Batch Programming in stand-alone mode.


Note:
There the Flasher Portable PLUS checks if the files exist on its flash storage. If the a file is missing the entry will be skip and the selection jumps directly to the next entry in the list.
Note:
You may have gaps in the list. The missing entries will be skipped when selecting the next configuration.
Note:
The [Files] section is supported by the Flasher Portable PLUS, too. But the number of configuration is limited to four.

Example

1 Target, 2 Datafiles (e.g. boot loader und application) --> same configuration file (*.CFG) but different data files (*.DAT) should be used.

  • Open pre-configured J-Flash project
  • File -> Save Flasher config file ... (DEFAULT.CFG)
  • Open data file 1 (boot loader)
  • File -> Save Flasher data file ... (BOOT.DAT)
  • Open data file 2 (application)
  • File -> Save Flasher data file ... (APP.DAT)
  • Create the a FLASHER.INI file (content see below)
  • Connect the Flasher in file access mode to the PC
  • Copy DEFAULT.CFG, BOOT.DAT, APP.DAT and FLASHER.INI on the Flasher

FLASHER.INI content:

[BATCH]
DataFile    = "BOOT.DAT"
ConfigFile  = "DEFAULT.CFG"
DisplayName = "Bootloader"
[BATCH1]
DataFile   = "APP.DAT"
ConfigFile = "DEFAULT.CFG"
DisplayName = "Application"
[BATCH2]
DataFile    = "BOOT.DAT"
ConfigFile  = "DEFAULT.CFG"
DataFile1   = "APP.DAT"
ConfigFile1 = "DEFAULT.CFG"
DisplayName = "BL and App"

Custom labels

Flasher supports to assign custom labels to configurations ("Project Display Text" in U-Flash). This allows to specify easy to remember names for configurations that are stored on the Flasher.

Hardware and software requirements

This feature is supported by the following models:

  • Flasher Portable PLUS

This feature is supported since V6.30e of the software package and firmware

Assigning labels

The configuration and data file pairs are specified in the FLASHER.INI file:

[FILES]
DataFile    = "IMAGE0.dat"
ConfigFile  = "IMAGE0.cfg"
DataFile1   = "IMAGE1.dat"
ConfigFile1 = "IMAGE1.cfg"

By default, Flasher will show the names of the configuration and data file: FW1 smartwatch nolabel.png FW2 smart meter nolabel.png

By adding DisplayName, DisplayName1, ... keys to the FLASHER.INI, a custom label can be shown instead:

[FILES]
DisplayName  = "FW smartwatch"
DataFile     = "IMAGE0.dat"
ConfigFile   = "IMAGE0.cfg"
DisplayName1 = "FW smart meter"
DataFile1    = "IMAGE1.dat"
ConfigFile1  = "IMAGE1.cfg"

The images will now be shown as follows: FW1 smartwatch label.png FW2 smart meter label.png

Considerations

  • The maximum length of a custom label is 32 characters. If this length is exceeded, the label is ignored and Flasher switches back to default mode for the affected configuration.

Programming multiple targets

It is possible to program multiple targets which are located in a JTAG chain. The targets will be programmed each with a configuration and a data file.
The configuration for the desired target must be selected before it can be programmed, this can be done with the #SELECT command. For more information how to use the #SELECT command please refer to the ASCII command interface.

Example
Three devices should be programmed.

JTAG Chain: TDI --> Device2 --> Device1 --> Device0 --> TDO

Three configurations would be stored on the flasher:

Config 0: Configured to program Device0 (DEVICE0.CFG, DEVICE0.DAT)
Config 1: Configured to program Device1 (DEVICE1.CFG, DEVICE1.DAT)
Config 2: Configured to program Device2 (DEVICE2.CFG, DEVICE2.DAT)

Selection and programming of the target will be done via the ASCII interface:

#SELECT DEVICE0
#AUTO
#SELECT DEVICE1
#AUTO
#SELECT DEVICE2
#AUTO

Programming multiple targets with J-Flash

Programming multiple targets can also be done via J-Flash using the command line interface. For this each target must be handled with its own project file.

Example

JFlash.exe -openprj"Device0.jflash" -open"Device0.hex" -auto -exit
JFlash.exe -openprj"Device1.jflash" -open"Device1.hex" -auto -exit
JFlash.exe -openprj"Device2.jflash" -open"Device2.hex" -auto -exit

Batch Programming in stand-alone mode

Batch programming allows to execute different stand-alone mode jobs in batch to be executed in immediate succession, without any user interaction in between. This can be used for example to program multiple targets in a JTAG-Chain or multiple data files to a target.
A batch may contains an unlimited number of configurations which consist of a data file (*.DAT) and config file (*.CFG). For further information regarding config and data files, please refer to Preparing for stand-alone operation manually.
In order to specify the batch jobs, a FLASHER.INI file is used. This init file contains a [BATCH] section which describes which configuration pairs (*.DAT and *.CFG file) should be used for each batch job. A sample content of a FLASHER.INI file is shown below:

[BATCH]
DataFile = "Flasher0.dat"
ConfigFile = "Flasher0.cfg"
DataFile1 = "Flasher1.dat"
ConfigFile1 = "Flasher1.cfg"

Batch Jobs.bmp

The Flasher Portable PLUS screen will show that the number of jobs contained in the batch and the configuration file name of the first job.


Batch Programming.bmp The progress will be shown during the flashing action. The Flasher lists the current job of the batch, the current sector address and the percentage of the currently executed action.


Batch Result.bmp The result of the programming will be shown on the screen after finishing all jobs.


Creating / Replacing of the FLASHER.INI file can done in two ways:

  1. Boot Flasher in file access mode in order to replace the FLASHER.INI
  2. If Flasher is already integrated into the production line, runs in stand-alone mode and can not be booted in other mode: Use the file I/O commands provided by the ASCII interface of Flasher, to replace the FLASHER.INI . For more information about the file I/O commands, please refer to File I/O commands. In case of an error occurred during execution, the Flasher terminates the entire batch processing.
Note:
  1. The batch programming feature can not be used with the multiple file support feature. Therefore, neither the #SELECT ASCII command nor the [FILES] tag in the FLASHER.INI file can be used.
  2. For information on restrictions for file and directory names, refer to: File system.

Flasher Portable specifics

Flasher Portable allows to choose between four different batches during runtime by using the select/arrow button on the front of Flasher Portable. Which batch configuration is used for which image selection position is specified in the FLASHER.INI. For this, the FLASHER.INI contents in the [BATCH] section have been extended. The sample below shows how to enable the user to select between four different batches on the Flasher Portable via the select / arrow button:

[BATCH]
DataFile = "Flasher0.dat"
ConfigFile = "Flasher0.cfg"
DataFile1 = "Flasher1.dat"
ConfigFile1 = "Flasher1.cfg"
DataFile2 = "Flasher2.dat"
ConfigFile2 = "Flasher2.cfg"
[BATCH1]
DataFile = "TEST.dat"
ConfigFile = "Test.cfg"
[BATCH2]
DataFile = "VALIDATE.dat"
ConfigFile = "Flasher0.cfg"

Using this method allows to have different batches for different setups used in the production to be stored once on the Flasher Portable via file access mode. From there on, switching between the batches can be done by simply using the selection button of Flasher Portable.


Examples

Example 1: Programming two Data files to the same target

  • Open your J-Flash project.
  • Use File -> Save Flasher config file... to save the .CFG file (in this example: STM32F4.CFG).
  • Select the first binary and use File -> Save Flasher Data file... to save the first .DAT file (in this example: DATA0.DAT).
  • Select the second binary and use File -> Save Flasher Data file... to save the second data file .DAT file (in this example: DATA1.DAT).
  • Copy the Files to the Flasher e.g. by using file access mode.
  • Create a FLASHER.INI file in the root directory of the Flasher.
  • Exemplary content of FLASHER.INI:
[BATCH]
DataFile = "DATA0.dat"
ConfigFile = "emPower.cfg"
DataFile1 = "DATA1.dat"
ConfigFile1 = "emPower.cfg"


Example 2: Programming one Data file to the first target in a JTAG-Chain and then programming two data files to another device in the JTAG chain.
Example scenario: 2 Devices in a JTAG chain, a STM32F1 and a STM32F4.

  • Follow the same as described before and additionally:
  • Create one project file per target (and create a .CFG file of each one).
  • Make sure each project file is configured correctly, especially the JTAG-Chain position (See UM8003 "J-Flash" for more detailed info).
  • Exemplary content of FLASHER.INI:
[BATCH]
DataFile = "F1DATA.dat"
ConfigFile = "STM32F1.cfg"
DataFile1 = "F4DATA0.dat"
ConfigFile1 = "STM32F4.cfg"
DataFile2 = "F4DATA1.dat"
ConfigFile2 = "STM32F4.cfg"

Example 3: Using multiple Batch sections with Flasher Portable.
Example scenario: 2 Devices in a JTAG chain, a STM32F1 and a STM32F4.
Selection 1 will program the STM32F1 target.
Selection 2 will program the STM32F4 target using "F4DATA0.dat".
Selection 3 will program the STM32F4 target using "F4DATA1.dat".
Selection 4 will execute 1, 2 and 3 in sequence.

  • Exemplary content of FLASHER.INI:
[BATCH]
DataFile = "F1DATA.dat"
ConfigFile = "STM32F1.cfg"
[BATCH1]
DataFile = "F4DATA0.dat"
ConfigFile = "STM32F4.cfg"
[BATCH2]
DataFile = "F4DATA1.dat"
ConfigFile = "STM32F4.cfg"
[BATCH3]
DataFile = "F1DATA.dat"
ConfigFile = "STM32F1.cfg"
DataFile1 = "F4DATA0.dat"
ConfigFile1 = "STM32F4.cfg"
DataFile2 = "F4DATA1.dat"
ConfigFile2 = "STM32F4.cfg"

Serial number programming

Flasher supports programming of serial numbers. In order to use the serial number programming feature, the J-Flash project to be used as well as some files on the Flasher (depending on the configuration) need to be configured first.

In general, Flasher supports two ways of programming a serial number into the target:

    • Programming continuous serial numbers.
    • The serial number is 1-4 bytes in size.
    • The start serial number, increment, serial number size, and address are configured in the J-Flash project.
    • Programming custom serial numbers from a serial number list file.
    • The start line within the serial number list file to get the next serial number bytes, line increment, serial number size, and address is configured in the J-Flash project.
    • The serial number list file needs to be specified and created by the user.


Note:
Full serial number programming support has been introduced with V4.51d of the J-Flash software and the Flasher firmware that comes with it.

Serial number settings

In order to enable the programming of serial numbers in stand-alone mode, the J-Flash project has to be configured to enable programming a serial number at a specific address. This is done by enabling the Program serial number option as shown in the screenshot and table below:

UM08039 SN Sample JFlashSettings.png

Setting Meaning
Address The address the serial number should be programmed at.
Length

The length of the serial number (in bytes) that should be programmed.

  • If no serial number list file is given, J-Flash allows to use a 1-4 byte serial number. In case 8 is selected as length, the serial number and its complement are programmed at the given address.
  • In case a serial number list file is given, the Flasher will take the serial number bytes from the list file. If a serial number in the list file does not define all bytes of Length, the remaining bytes are filled with 0s. No complements etc. are added to the serial number.
Next SN
  • In case no serial number list file is given, Next SN is the next serial number which should be programmed. The serial number is always stored in flash memory in little-endian format.
  • In case a serial number list file is given, Next SN describes the line of the serial number list file where to read the next serial number bytes from. The Flasher starts counting at line 0, so in order to start serial number programming with the first line of the SNList.txt, Next SN needs to be set to 0.
Increment Specifies by how much Next SN is incremented.

Serial number file

When selecting File -> Download serial number file to Flasher, J-Flash will create a serial number file named as <JFlashProjectName>_Serial.txt. This file is downloaded as Serial.txt on the Flasher. The file is generated based on the serial number settings in the J-Flash project and will contain the value defined by the Next SN option. The serial number file can also be manually edited by the user since the serial number is written ASCII encoded in the Serial.txt file.

Serial number list file

In order to program custom serial numbers which can not be covered by the standard serial number scheme provided by J-Flash (e.g. when programming non-continuous serial numbers or having gaps between the serial numbers), a so called serial number list file needs to be created by the user.

When selecting File -> Download serial number file to Flasher, J-Flash will look for a serial number list file named as <JFlashProjectName>_SNList.txt in the directory where the J-Flash project is located. This file is downloaded as SNList.txt on the Flasher. The serial number list file needs to be created manually by the user and has the following syntax:

  • One serial number per line
  • Each byte of the serial number is described by two hexadecimal digits.

Example
A 8-byte serial number should be programmed at address 0x08000000.

It should be programmed as follows in the memory:

0x08000000: 0x01 0x02 0x03 0x04 0x55 0x66 0x77 0x88

The serial number list file should look as follows:

0102030455667788

SN SNList.gif

The number of bytes to read per line is configured via the Len option in J-Flash. For more information, please refer to Serial number settings.

Which line Flasher will read at the next programming cycle, is configured via the Next SN option in J-Flash. For more information, please refer to Serial number settings. In this case Next SN needs to be set to 0, since programming should be started with the serial number bytes defined in the first line of the file.


Note:
If the number of bytes specified in a line of the serial number list file is less than the serial number length defined in the project, the remaining bytes filled with 0s by Flasher.
Note:
If the number of bytes specified in a line of the serial number list file is greater than the serial number length defined in the J-Flash project, the remaining bytes will be ignored by Flasher.

Programming process

Flasher will increment the serial number in SERIAL.TXT by the value defined in Increment, after each successful programming cycle.

For each programming cycle, the FLASHER.LOG on the Flasher is updated and contains the value from SERIAL.TXT that has been used for the programming cycle.


Note:

The serial number in SERIAL.TXT will also be incremented in case if serial number programming is disabled, to make sure that for the Flasher logfile there is a reference which programming cycle passed and which not.

As long as serial number programming has not been enabled in the J-Flash project, Flasher does not merge any serial number data into the image data to be programmed.

Downloading serial number files to Flasher

Downloading the serial number files needs to be done explicitly by selecting File-> Download serial number file to Flasher. Please note that the File -> Download config & data file to Flasher option does only download the configuration and data file to Flasher since usually the current serial number used for programming shall not be reset/overwritten when just updating the image Flasher shall program.

Sample setup

In the following a small sample is given how to setup Flasher for serial number programming. In the following sample, 4-byte serial numbers starting at 1234567 (0x12D687) shall be programmed at address 0x08001000.

Defining serial number address, length and start value
In the J-Flash project the following needs to be defined:

  • Address is 0x08001000
  • Next SN is 1234567
  • Increment is 1
  • Len is 4 (bytes)

SN Sample JFlashSettings.gif

Downloading configuration, data and serial number to Flasher.
After setting up the rest of the configuration (Target interface etc.) and selecting an appropriate data file, the configuration, data and serial number file is downloaded into Flasher via the File -> Download config & data file to Flasher and File-> Download serial number file to Flasher option.

SN Sample DownloadToFlasher.gif

After downloading the serial number to Flasher, J-Flash also created the <JFlashProjectName>_Serial.txt.

SN Sample SerialFileCreated.gif

Now Flasher is prepared to program the 8-byte serial number.

Patch file support

In stand-alone mode Flasher supports patch files which allows to patch the content of the data to be programmed. Patches for undefined memory locations will be ignored, so there need to be placeholders in the data file. Before starting programming process in stand-alone mode, Flasher will look for a file named Patches.txt being present on the Flasher. This file includes the patches. If this file is present, the number in Serial.txt describes the line number of the Patches.txt that will be used for the current cycle (line counting starts at 0).

Each line in the Patches.txt can hold up to 4 patches, where each patch can be up to 32 bytes in length.

Syntax
Each line begins with <NumPatches> followed by each patch <Addr>,<NumBytes>:<Data> in sequence and separated by commas. So the syntax for <NumPatches> = = 4 would be as follows:

<NumPatches>,<Addr>,<NumBytes>:<Data>,<Addr>,<NumBytes>:<Data>,<Addr>,<NumBytes>:<Data>,<Addr>,<NumBytes>:<Data>\r\n

Find below a table which describes each parameter.

Parameter Description
<NumPatches> Describes the number of patches in this patch line. Max. value is 4.
<Addr> Describes the address to be patched. Value is expected in hex.
<NumBytes> Number of bytes for the current patch. Max. value is 20h (32 in decimal). Value is expected in hex.
<Data> Describes the data to be patched. <Data> is always expected as 2 hexadecimal characters per byte.


Note:

All values are expected in hexadecimal format (hex).

<Data> section is always preceded by ":", not ",".

Example
Below is an example patch.

1,18,4:01020304\r\n

Patching the following data:

data before.png

with the example patch will result in the following data:

data afterwards.png

Please note that as mentioned earlier patching undefined memory locations will be ignored.
Applying the example patch to the following data:

undefined mem before.png

Causes no data to be patched, as can be seen in the following image:

undefined mem no token.png

Therefore it is necessary to first write placeholder data to the memory locations which are supposed to be patched.
An example for such a placeholder can be seen here:

undefined mem token.png

Please note that the actual data inside the placeholder does not matter to the Flasher, because it is overwritten during patching.
Applying the example patch will now work as expected:

undefined mem after.png

Single patch via RS232
Alternatively, you can start a programming cycle with patch data that is only valid for this one cycle (no need for a Patches.txt file):

Send the #AUTO PATCH <NumPatches>,<Addr>,<NumBytes>:<Data>

command via Flasher ASCII interface. The parameters have the same function as described in the table above.

Newline encoding

In general, for all patch files, init files etc. Flasher supports both newline encodings:

  • Windows: \r\n
  • Unix/Mac: \n

All parser functionality etc. are written to be independent from the host operating system.

Limiting the number of programming cycles

Flasher provides a mechanism to limit the number of programming cycles that can be performed in stand-alone mode with the configuration that is stored on the Flasher. To make use of this feature, a file called Cntdown.txt needs to be placed on the Flasher. This file simply contains a decimal number (32-bit unsigned integer) that describes how many programming cycles can be performed with the current setup.

File:CntdownTxtContent.jpg

This feature especially makes sense when used in combination with authorized flashing. For more information about authorized flashing, please refer to Authorized flashing.


Note:
The number in the Cntdown.txt is only updated on a successful programming cycle. Programming cycles that failed, do not affect the Cntdown.txt.

Changed fail/error LED indicator behavior

In case a Cntdown.txt is found at boot time, the fail/error LED of Flasher behaves different from normal. If the number of programming cycles left is 10 or below, the following will happen:

  • The red error/fail LED will lit for 1 second
  • After this, it will blink/toggle x times @ 5 Hz, indicating the number of programming cycles left. (blinking 5 times for 5 cycles left, ...)

Required Flasher hardware version for Cntdown.txt support

Older Flasher models do not support the limiting of programming cycles. The Flashers with the following serial number ranges do not support limiting of programming cycles:

  • 1621xxxxx (Flasher ARM V2)
  • 1630xxxxx (Flasher ARM V3)
  • 4210xxxxx (Flasher PPC V1)
  • 4110xxxxx (Flasher RX V1)

All other models / hardware versions support limiting of programming cycles.

Authorized flashing

Current hardware versions of Flasher support creation of a so called secure area which allows to pre-configure the Flasher with a given setup and then give it to external production facilities etc. without the possibility to read out the Flasher contents via file access mode, FILE I/O functionality (J-Link Commander) or RS232 commands. This section describes how to setup a secure area on a Flasher and how to move the configuration/data file(s) into it.

Creating / Adding the secure area

By default, Flashers are shipped with a public area only (full Flasher flash size accessible via file access mode etc.). The secure area has to be activated / created once, to make use of it. This will reserve half of the Flasher storage size (on current models this will be ~64 MB) for the secure area. The secure area can be removed at any time, providing the full flasher storage to the public area again. The secure area can be created / removed via J-Link Commander, which is part of the software package that comes with Flasher.

File:CreateSecArea.jpg

The following secure area related commands are available in J-Link Commander:

  • securearea create
  • securearea remove


Note:

When creating or removing the secure area, all configuration and data files being stored on the Flasher, are lost.

Please make sure that they are not needed anymore, before adding / removing the security area.

Moving files to the secure area

Before moving configuration + data to the secure area, proper functionality of the setup should be tested in stand-alone mode. Once the setup is working as expected, do the following, to move the configuration + data into the secure area:

FilesBeforeSecure.png

  • Create a folder "_SECURE"
  • Move all files that shall be moved to the secure area, into this folder

FilesAfterSecure.png

  • Reboot Flasher (Do not enter file access mode again, yet! Otherwise, contents will not be moved). Now, depending on the configuration and data file size, it may take a bit, before the Flasher Power LED lit.
    Once it lit, all contents have been moved to the secure area and the _SECURE folder in the public area has been deleted.
  • Now Flasher can be used in stand-alone mode, as normal, but the files cannot be read back by the user / operator.

Considerations to be taken when using the secure area

When using the secure area, some things need to be considered:

  • All features like multiple file support, patch file support etc. can also be used when operating from the secure area.
  • The secure area cannot be read back by any utility. Solely the FLASHER.LOG is always placed and updated in the public area, even when Flasher operates from the secure area.
  • If there is any file/folder in the public area, except the FLASHER.LOG and there is also any configuration / data present in the secure area, stand-alone flashing will fail because it is not unambiguous which configuration / data shall be used.
    In such cases, Flashers with Ethernet / RS232 interface will output an appropriate error message on programming. All Flasher models will output an appropriate error message in the FLASHER.LOG.
  • Moving files from the public into the secure area can be done multiple times, as explained in Moving files to the secure area.
    Each time files are moved from the public area to the secure area, all contents of the secure area are erased first, to make sure that no previous configuration is present there.

Required Flasher hardware version

Older Flasher models do not support authorized flashing. The Flashers with the following serial number ranges do not support authorized flashing:

  • 1621xxxxx (Flasher ARM V2)
  • 1630xxxxx (Flasher ARM V3)
  • 4210xxxxx (Flasher PPC V1)
  • 4110xxxxx (Flasher RX V1)

All other models / hardware versions support authorized flashing.

Target interfaces

The table below shows the supported target interfaces of the different Flasher models.

Hardware Supported interfaces
Flasher PRO JTAG, SWD
Flasher Compact JTAG, SWD
Flasher ARM JTAG, SWD
Flasher RX JTAG
Flasher PPC JTAG

For more information about the target interfaces itself, please refer to:

  • UM08001, chapter "Working with J-Link and J-Trace", section "JTAG interface"
  • UM08001, chapter "Working with J-Link and J-Trace", section "SWD interface"

Supported architectures

Flasher supports programming of the internal flash of a large number of different microcontrollers. The number of supported devices is steadily growing. You can always find the latest list of supported devices on our website:

http://www.segger.com/supported-devices.html

Sometimes, especially early in MCU development, only a few samples/boards are available and may not be made available to third parties (e.g. SEGGER) to add support for a new device. Also the existence of the device may have confidential status, so it might not be mentioned as being supported in public releases yet. Therefore it might be desirable to be able to add support for new devices on your own, without depending on SEGGER and a new release of the J-Link Software an Documentation Pack being available.

The J-Link DLL allows customers to add support for new devices on their own. It is also possible to edit / extend existing device support by for example adding new flash banks (e.g. to add support for internal EEPROM programming or SPIFI programming). The following article in our Wiki Open_Flashloader explains how new devices can be added to the DLL and how existing ones can be edited / extended.

If a device is not supported, you can always contact us. We will be happy to provide you with an offer.

External flashes

In general our Flashers support programming of external flashes listed below:
(Can differ between Flasher models and hardware versions)

If the parallel NOR flash device which is used is not CFI-compliant you have to select the flash device in J-Flash explicitly, for a list of all parallel NOR flash devices which can be explicitly selected in J-Flash, please refer to UM08003, J-Flash User Guide, chapter Supported Flash Devices.

Since the connection of the flash to the CPU can be different for each of the other flash types mentioned above, a suitable Open Flashloader can be used in such a case. The J-Flash software comes with sample projects for Open Flashloader. For a complete list of all Open Flashloader projects for use with J-Flash software, see also:
http://www.segger.com/supported-devices.html

Note:
Complete Information about Open Flashloaders can be found in our Wiki:
Open_Flashloader

Cores

Flasher ARM

Flasher ARM supports and has been tested with the following cores, but should work with any ARM7/9, Cortex-M0/M1/M3/M4 core. If you experience problems with a particular core, do not hesitate to contact Segger.

  • ARM7TDMI (Rev 1)
  • ARM7TDMI (Rev 3)
  • ARM7TDMI-S (Rev 4)
  • ARM920T
  • ARM922T
  • ARM926EJ-S
  • ARM946E-S
  • ARM966E-S
  • Cortex-M0
  • Cortex-M1
  • Cortex-M3
  • Cortex-M4

Flasher RX

Flasher RX supports and has been tested with the following cores. If you experience problems with a particular core, do not hesitate to contact Segger.

  • RX610
  • RX621
  • RX62N
  • RX62T

Flasher PPC

Flasher PPC supports and has been tested with the following cores. If you experience problems with a particular core, do not hesitate to contact Segger.

  • e200z0

Flasher PRO/Compact/Portable PLUS

All of the above cores using J-Flash. Many more and constantly growing by means of Universal Flash Loader https://www.segger.com/supported-devices/flasher/.

Programming multiple targets in parallel

To program multiple targets in parallel there are the following possibilities:

  • Using a Flasher gang, or
  • Using multiple Flashers, each connecting to one CPU.

Devices for gang programming are:

When using multiple flashers, this can be done with the J-Flash production programming software. For further information, please refer to Chapter "Command Line Interface" Sub-chapter "Programming multiple targets in parallel" of the J-Flash User Guide (UM08003_JFlash.pdf) which is part of the Flasher Software and Documentation package. https://www.segger.com/downloads/flasher/#FlasherSoftwareAndDocumentationPack

Logfiles and Quality Management

All Flasher models keep a log file named Flasher.log which logs each programming attempt. This file contains the serial number of the device, the result of the programming attempt, and the programming duration for quality tracking purposes. An example of a Flasher.log file might look like the following:

SN: 1 - Failed
SN: 1 - Failed
SN: 2 - O.K. (931 ms)
SN: 3 - O.K. (931 ms)
SN: 4 - O.K. (933 ms)
SN: 5 - O.K. (932 ms)

If applicable, the logfile contains more detailed error messages. For example:

ERROR: Programming failed @ address 0x00000000 (1)
ERROR: Cannot connect to CPU. Target interface speed too high?

The Flasher Portable PLUS creates an additional log file named UNIERROR.LOG for Universal Flash Loader projects. This file contains error messages that would otherwise have been displayed by the other flashers on the terminal. For example:

Verify error config word area @
config word
config word read back
Verify error flash area @
data from file
data read back
Note:
These log files can be accessed by booting the flasher into file access mode or directly via FTP if the flasher has an appropriate network interface.

UM08022 Chapters