{"id":20130308,"url":"https://github.com/pavelrevak/pystlink","last_synced_at":"2025-09-21T11:06:51.412Z","repository":{"id":35437286,"uuid":"39703542","full_name":"pavelrevak/pystlink","owner":"pavelrevak","description":"Python tool for flashing and debugging STM32 devices using ST-LINK/V2","archived":false,"fork":false,"pushed_at":"2022-10-10T06:40:30.000Z","size":217,"stargazers_count":223,"open_issues_count":16,"forks_count":60,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-05-20T12:06:46.518Z","etag":null,"topics":["debugger","flash","linux","macos","python","python3","stlink","stm32","swd","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pavelrevak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-25T21:30:33.000Z","updated_at":"2025-03-22T17:59:13.000Z","dependencies_parsed_at":"2022-09-17T19:04:45.455Z","dependency_job_id":null,"html_url":"https://github.com/pavelrevak/pystlink","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pavelrevak/pystlink","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavelrevak%2Fpystlink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavelrevak%2Fpystlink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavelrevak%2Fpystlink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavelrevak%2Fpystlink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pavelrevak","download_url":"https://codeload.github.com/pavelrevak/pystlink/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavelrevak%2Fpystlink/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276229766,"owners_count":25606954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-21T02:00:07.055Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debugger","flash","linux","macos","python","python3","stlink","stm32","swd","windows"],"created_at":"2024-11-13T20:38:07.734Z","updated_at":"2025-09-21T11:06:51.372Z","avatar_url":"https://github.com/pavelrevak.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PYSTLINK\n\nPython tool for manipulating with STM32 MCUs using **ST-Link** in-system programmer and debugger.\n\n## Goal\n\nGoal of this project is to bring more flexible support for different MCUs, very simple command line interface, easier integration into Makefile for direct flashing or uploading program into SRAM and many more, simplest way to add support for new MCUs. Also any suggestions are welcome.\n\n## Features\n\n- running on **Linux**, **Mac OS/X** and **Windows**\n- simple command line interface\n- detect MCU\n- dump registers and memory\n- write registers\n- download memory to binary file\n- upload binary or SREC file into memory\n- FLASH binary or SREC file to all **STM32**\n- basic runtime control: reset, halt, step, run\n- support **ST-Link/V2**, **ST-Link/V2-1** and **ST-Link/V3**\n\n### Planed features\n\n- FLASH support for other MCU types (STM32L)\n- FLASH information block (system memory, option bytes and OTP area)\n- connecting under RESET\n- stop Watchdog in debug mode to prevent device restart\n- allow to control breakpoints or watchpoints\n- support for more ST-Link devices connected at once\n- other file formats (SREC, HEX, ELF, ...)\n- pip installer\n- proxy to GDB\n- and maybe GUI\n- support for ST-Link/V1 is NOT planed, use ST-Link/V2 or V2-1 instead\n\n## Install\n\n### Requirements\n\n- **Python v3.7+** (tested with 3.8)\n- [**pyusb**](https://github.com/walac/pyusb)\n- [**libusb**](https://github.com/libusb/libusb) or any other libusb driver\n  - for Windows download [latest windows binaries](https://github.com/libusb/libusb) and copy libusb-1.0.dll into Windows/System32 directory\n\n### pystlink\n\n- [Download](https://github.com/pavelrevak/pystlink/archive/master.zip) and unpack or `git clone https://github.com/pavelrevak/pystlink.git`\n- Connect ST-LINK\n- Run `./pystlink.py --help` (or `python3 pystlink.py ...` - depend on python installation and architecture)\n\n## Help\n```\nusage: pystlink [-h] [-q | -i | -v | -d] [-V] [-c CPU] [-r] [-u]\n                [action [action ...]]\n\npystlink v0.0.0 (ST-LinkV2)\n(c)2015 by pavel.revak@gmail.com\nhttps://github.com/pavelrevak/pystlink\n\noptional arguments:\n  -h, --help         show this help message and exit\n  -V, --version      show program's version number and exit\n  -c CPU, --cpu CPU  set expected CPU type [eg: STM32F051, STM32L4]\n  -r, --no-run       do not run core when program end (if core was halted)\n  -u, --no-unmount   do not unmount DISCOVERY from ST-Link/V2-1 on OS/X platform\n\nset verbosity level:\n  -q, --quiet\n  -i, --info         default\n  -v, --verbose\n  -d, --debug\n\nactions:\n  action             actions will be processed sequentially\n\nlist of available actions:\n  dump:core              print all core registers (halt core)\n  dump:{reg}             print core register (halt core)\n  dump:{addr}:{size}     print content of memory\n  dump:sram[:{size}]     print content of SRAM memory\n  dump:flash[:{size}]    print content of FLASH memory\n  dump:{addr}            print content of 32 bit memory register\n  dump16:{addr}          print content of 16 bit memory register\n  dump8:{addr}           print content of 8 bit memory register\n\n  set:{reg}:{data}     set register (halt core)\n  set:{addr}:{data}    set 32 bit memory register\n\n  read:{addr}:{size}:{file}      read memory with size into file\n  read:sram[:{size}]:{file}      read SRAM into file\n  read:flash[:{size}]:{file}     read FLASH into file\n\n  fill:{addr}:{size}:{pattern}   fill memory with a pattern\n  fill:sram[:{size}]:{pattern}   fill SRAM memory with a pattern\n\n  write:{file.srec}     write SREC file into memory\n  write:{addr}:{file}   write binary file into memory\n  write:sram:{file}     write binary file into SRAM memory\n\n  flash:erase            complete erase FLASH memory aka mass erase\n  flash[:erase][:verify]:{file.srec}     erase + flash SREC file + verify\n  flash[:erase][:verify][:{addr}]:{file} erase + flash binary file + verify\n\n  reset                  reset core\n  reset:halt             reset and halt core\n  halt                   halt core\n  step                   step core\n  run                    run core\n\n  sleep:{seconds}        sleep (float) - insert delay between commands\n\n  (numerical values can be in different formats, like: 42, 0x2a, 0o52, 0b101010)\n\nexamples:\n  pystlink.py --help\n  pystlink.py -v --cpu STM32F051R8\n  pystlink.py -q --cpu STM32F03 dump:flash dump:sram\n  pystlink.py dump:0x08000000:256\n  pystlink.py set:0x48000018:0x00000100 dump:0x48000014\n  pystlink.py read:sram:256:aaa.bin read:flash:bbb.bin\n  pystlink.py -r reset:halt set:pc:0x20000010 dump:pc core:step dump:all\n  pystlink.py flash:erase:verify:app.bin\n  pystlink.py flash:erase flash:verify:0x08010000:boot.bin\n````\n\n## Supported programmers\n\nFrom ST exists actually three different SWD programmers:\n\nFull support:\n- **ST-Link/V2**\n- **ST-Link/V2-1**\n- **ST-Link/V3**\n\nNot supported:\n- ST-Link/V1\n\nMinimum recommended firmware version of ST-Link is **V2J32xx** or newer. Otherwise is recommended upgrade using [ST-LINK firmware upgrade tool](https://www.st.com/en/development-tools/stsw-link007.html).\n\n## Supported MCUs\n\nCurrently almost all **ST32** MCUs. There is script `list_new_stm32.py` which compare supported MCUs with all listed on st.com.\n\n**Not all MCUs are tested**. Please report any problems to [Issues tracker](https://github.com/pavelrevak/pystlink/issues).\n\nIn WiKi is some basic info about STM32 naming: [STM32 coding matrix](https://github.com/pavelrevak/pystlink/wiki/STM32-coding-matrix)\n\n## Legal\n\nCode is under [MIT license](https://github.com/pavelrevak/pystlink/blob/master/LICENSE).\n\nIn general, this program is allowed to copy, share, change, use in commercial and without any limitations, but if you make some changes or updates then will be nice to share it.\n\nSupport is only by [Issues tracker](https://github.com/pavelrevak/pystlink/issues)\n\n**PYSTLINK** is inspired by [OpenOCD](http://openocd.org/), [STLINK](https://github.com/texane/stlink) and lot of info is from sniffed USB communication with [original ST-LINK](http://www.st.com/web/en/catalog/tools/PF258168) program.\n\n## TAGS\nST-Link/V2, ST-Link/V3, stlink, SWD, Python, ARM, CortexM, STM32, debug, FLASH, USB\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpavelrevak%2Fpystlink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpavelrevak%2Fpystlink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpavelrevak%2Fpystlink/lists"}