Skip to content

Python API to flash STMicroelectonics Microcontrollers using ST-LINK/V2 CLI Utility

Notifications You must be signed in to change notification settings

mirzafahad/pystlink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ST-Link Utility Automation

License Blog

⭐ Star me on GitHub — it helps!

Python API to automate STMicroelectonics flash using ST-Link CLI Utility.

Required Packages:

  • pywin32
  • pypiwin32

Hardware used

ST-Link V2 that comes with STMicroelectronics Nucleo development boards. These ST-Links also provide USB-to-Serial ports.

Download

Download ST-Link Utility and install. Make sure to add the "ST-LINK_CLI.exe" 's directory in the PATH.

Supported programmers

Check ST-Link Utility guide.

How to install and use

There aren't any installations. Clone the repository and use the methods. There are only two public methods:

  • findall()
    This method returns all the ST-Link Probe number and corresponding COM port number.
  • flash(hex_path, probe_no)
    This method takes the hex file path and the probe number (default = 0). It returns status ('successful' / 'failed') and the checksum of the hex/binary file.

Example

import stlink

if __name__ == '__main__':
    print(stlink.findall())
    status, checksum = stlink.flash('G:\\test.hex')
    print(status)

Output:

[{'probe': '0', 'com': 'COM4'}]
successful

About

Python API to flash STMicroelectonics Microcontrollers using ST-LINK/V2 CLI Utility

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages