J-Link comes with a set of flash loaders which permits the download of your application directly into the flash memory of your target system from your development environment. The J-Link flash loaders are highly optimized for fast flash programming and the feature itself is optimized to make it as simple as possible to use it. Moreover the flash download feature of J-Link can be used free of charge.
The J-Link flash download feature makes the flash of the target device behave as RAM in the debugger. You simply have to select the device, you want to program, in the debugger and when the debugger writes to the target memory, the J-Link DLL automatically detects if the memory range which is written is flash memory or not. If the affected memory area is in flash memory, the J-Link flashloader will become active and performs the programming of the flash memory automatically in a very short time.
Currently the flash download feature of J-Link is supported directly by the following debuggers/workbenches:
But in general, the flash download feature can be used with every workbench which supports J-Link, since even if it is not possible to select your target device in the debugger, you can always select it in the J-Link control panel, which is opened when a debug session starts.
Note: Currently the flash download feature of J-Link allow download into the internal flash of a wide range of popular microcontrollers only,
but flash programming support for external CFI-compliant flash memories is planned for the near future.
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 endianness 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. The data (or part of it) is downloaded to a different 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.