cancel
Showing results for 
Search instead for 
Did you mean: 

ST-Link STLINK Mass storage Drag-and-Drop programming issues after Windows Update

AM
ST Employee

 

On some target the STLINK supports a basic application programming through Mass storage Drag-and-drop (DnD). A change in Mass Storage host behaviour after recent Windows Update (2023) leads to issues in Drag-and-drop programming with the STLINK.

The result is binary (.bin) application badly programmed (with 0x00 hole section) without FAIL.txt or hex application (.hex) failure during programming.

The issue is linked to the PC sending out of order zero data to the STLINK which is not supported and expected by the Drag-and-Drop feature of the STLINK (which is not a real file system).

The failure is not systematic with a given target/application file and sometimes the PC does not behave the same and the data are sent as expected.

 

For example, the PC sends:

  • 0x40000 bytes of Appli data (part1)
  • 0x40000 bytes of zero data (0x00)
  • 0x20000 bytes of Appli data (part3)
  • 0x40000 bytes of Appli data (part2)

This results in programming:

  • 0x08000000-0x08040000: application data part1
  • 0x08040000-0x08080000: 0x00 zero data
  • 0x08080000-0x080A0000: application data part3

application data part2 are not considered as the full binary size has been received and the Mass storage interface is reset.

 

When the DnD zero-data issue occurs with a hex file, the error message of the STLINK in the FAIL.txt is

"The hex file cannot be decoded. Checksum calculation failure occurred"

When the failure issue occurs with bin file it is not detected (the application is programmed with 0 data hole).

 

This Windows Update issues has been noticed also on other MBED Drag-and-Drop implementation; you may check https://github.com/ARMmbed/DAPLink/issues/1025

According to this link a fix by Windows is expected in September 2023.

 

The workaround is to use another tool to program your application as an example STM32CubeProgrammer tool (STM32CubeProg) or to retry several times, Drag-and-drop programming until success using .hex file instead of .bin file.

Another workaround found in the above link (that seems to work) is to use robocopy with the /z flag, for restartable mode instead of doing the real DnD (see below).

 

You will find details about Drag-and-Drop programming with STLINK (supported .bin .hex format and limitations) in RN00093 STSW-LINK007 firmware upgrade release note. It is available here: https://www.st.com/en/development-tools/stsw-link007.html#documentation ,

RN0093 Firmware upgrade for ST-LINK, ST-LINK/V2, ST-LINK/V2-1 and STLINK-V3 boards

However, for optimal programming of an STM32 target, it is recommended to use a software programming tool such as STM32CubeProgrammer or an IDE that supports all programming cases.

 

Robocopy workaround:

Open a cmd terminal at the path where your appli.hex is located,

Find the drive of the STLINK Mass storage disk.

For example, if STLINK Mass storage disk (NOD_H7...) is mounted as drive D:\:

Launch this command in the terminal (. source directory, D:\ destination directory)

robocopy /z . D:\ appli.hex)

0 REPLIES 0