J-Link drag and drop programming

From SEGGER Wiki
Revision as of 09:57, 18 July 2023 by Arne.kulinna (talk | contribs)
Jump to: navigation, search

Drag-And-Drop is an optional J-Link OB intuitive programming feature. It allows programming of your target MCU in a very simple way. J-Link OB with Drag-And-Drop capability appears both as a debug probe and as a flash drive on the user's computer. With the flash drive option it is now as simple as dragging and dropping a file (a Motorola S-record, an Intel Hex, or a plain binary) onto the J-Link drive. There is no need to install application software. Anyone that can drag and drop a file to a USB memory stick can now program the target on an evaluation board.

Windows specifics

Download of large data files

Data files that are 512 KB or larger in size cannot be guaranteed to be programmed correctly.
Known affected Windows versions are:

  • Windows 10: 22H2 OS Builds 1904x.2788 or later
  • Windows 11: 22H2 and 21H2 OS build 22621.1344 or later

Windows intermittently transfers data chunks of larger files in non-sequential order.
Additionally, some data chunks are filled with zeroes.
These sporadically transferred data chunks will be overwritten with valid data in a later transmission.
As for now, the J-Link OB can not handle such behavior due to its limited memory capacity.

Workaround
For copying files to the J-Link drive, Robocopy (Robust File Copy for Windows) with the /z flag can be used:

robocopy <source> <destination> /z

More information about Robocopy can be found at https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy.

macOS specifics

Download of large data files

Data files that are 1 MB (1024 KB) or larger in size cannot be guaranteed to be programmed correctly.
Apple macOS has a scheduler that splits data files writes to the drag & drop drive to 1 MB chunks that are delegated to multiple threads.
This may lead to data being written to the drive non-sequentially because each 1 MB job of each thread may be interrupted by another thread at any time.
Due to limited RAM in J-Link (OB), the drag & drop functionality relies on data for a single file being written sequentially by the host operating system.

Programming of such data files may fail silently (not all data be programmed. Programming stopped after 128 KB without error / FAIL.txt etc.).
The silent fail may happen due to various "end of file" detection mechanisms J-Link must implement to handle the different OSes (Windows, Linux, macOS) as well as to handle *.bin files.
Under various circumstances, an out-of-order write to the drag & drop USB drive indicates the end of a file, rather than the macOS specific multi-threaded download and therefore should not cause a FAIL.txt.

As a workaround, the most recent release version of the J-Link software package for macOS can be downloaded and installed.
Then the loadfile command of J-Link Commander can be used. Alternatively, J-Flash Lite can be used to download a data file to the target.