Segger Logo Embedded Software Solutions
Software productsHardware productsDownloadsPricesCustomersOur PartnersSitemapForumAbout us
J-Link: Flash programming
| J-Link overview | Performance comparison | J-Link Pricing | J-Link non-commercial use | J-Link flash programming overview | J-Link FAQs | Using J-Link with IAR "C"-Spy | J-Link USB driver installation | Troubleshooting | J-Link adapters | J-Link JTAG Isolator | J-Link GDB Server | J-Flash ARM | J-Link ARM RDI software | J-Link developer DLL (J-Link SDK) | J-Link Flash SDK | J-Link dedicated flash programming utilities | J-Mem |

J-Link comes with a DLL, which allows - amongst other functionalities - reading and writing RAM, CPU registers, starting and stopping the CPU and setting breakpoints. The standard DLL does not have API functions for flash programming. However, the functionality offered can be used to program the flash. In that case a flashloader is required.

How does flash programming via J-Link work ?

This requires extra code. This extra code typically downloads a program into the RAM of the target system, which is able to erase and program the flash. This program is called Ram code and "knows" how to program the flash; it contains an implementation of the flash programming algorithm for the particular flash. Different flash chips have different programming algorithms; the programming algorithm also depends on other things such as endianess of the target system and organization of the flash memory (e.g. 1*8 bits, 1 * 16 bits, 2*16 bits or 32 bits) The Ram code requires data to be programmed into the flash memory. There are 2 ways of supplying this data.

Data download to RAM

The data (or part of it) is downloaded to an other part of the RAM of the target system. The Instruction pointer (R15) of the CPU is then set to the start address of the Ram code, the CPU is started, executing the RAM code. The RAM code, which contains the programming algorithm for the flash chip, copies the data into the flash chip. The CPU is stopped after this. This process may have to be repeated until the entire data is programmed into the flash.

Data download via DCC

In this case, the RAM code is started as described above before downloading any data. The RAM code then communicates with the PC (via DCC, JTAG and J-Link), transferring data to the target. The RAM code then programs the data into flash and waits for new data from the host. The WriteMemory functions of J-Link are used to transfer the RAM code only, but not to transfer the data. The CPU is started and stopped only once. Using DCC for communication is typically faster than using WriteMemory for RAM download since the overhead is lower.

Available options for flash programming

There are different solutions available to program internal or external flashes connected to ARM cores using J-Link. The different solutions have different fields of application, but of course also some overlap.

  1. The JLinkARM.dll has has a flash download feature which only can be used with RDI, J-Link GDB Server and IAR Embedded Workbench (since version 5.20). For more information about using the JLinkARM.dll flash download feature with other software components as listed before, please get in touch with info@segger.com. In order to use the flash download feature you need to purchase a license from SEGGER.
  2. J-Flash - Complete flash programming solution.

    J-Flash is a stand-alone Windows application, which can read / write data files and program the flash in almost any ARM-system. J-Flash requires an extra license from SEGGER.

  3. Flash SDK - A DLL with flash programming capabilities.

    An enhanced version of the J-Link SDK, which has add. API functions. The add. API functions allow loading and programming a data file. This DLL comes with a sample executable, as well as the source code of this executable and a project file.
    This can be an interesting option if you want to write your own programs for production purposes.

    This DLL also requires an extra license from SEGGER; please contact us for more information.

    Output of Sample program:

    SEGGER JLinkARMFlash for ST STR710FR2T6 V1.00.00
    Compiled 11:16:22 on May  4 2005.
    
    This program and the DLL are (c) Copyright 2005 SEGGER, www.segger.com
    
    Connecting to J-Link
    Resetting target
    Loading data file... 1060 bytes loaded.
    Erasing required sectors... O.K. - Completed after 0.703 sec
    Programming... O.K. - Completed after 0.031 sec
    Verifying... O.K. - Completed after 0.031 sec
  4. RDI flash loader: Allows Flash download from any RDI-compliant tool chain.

    RDI, (Remote debug interface) is a standard for "debug transfer agents" such as J-Link. It allows using J-Link from any RDI compliant debugger. RDI by itself does not include download to flash. In order to debug in Flash, you need to somehow program your application program (debuggee) into the flash. You can use J-Flash for this purpose, use the flash loader supplied by the debugger company (if they supply a matching flash loader) or use the flash loader integrated in the J-Link RDI software. The RDI software as well as the RDI flash loader require licenses from SEGGER.

  5. Flash loader of compiler / debugger vendor such as IAR.

    A lot of debuggers (some of them integrated into a workbench / IDE) come with their own flash loaders. The flash loaders can of course be used if they match your flash configuration, which is something that needs to be checked with the vendor of the debugger.

  6. Implement your own flash loader using the functionality of the JLinkARM.dll as described above.

Copyright SEGGER Microcontroller GmbH & Co.KG. All rights reserved.
For more information, please visit our web site www.segger.com or contact us at info@segger.com
Last update: January 8, 2008