All Projects → pavelrevak → Pystlink

pavelrevak / Pystlink

Licence: mit
Python tool for flashing and debugging STM32 devices using ST-LINK/V2

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Pystlink

dap42-hardware
STM32F042Fx based DAP interface hardware
Stars: ✭ 17 (-87.68%)
Mutual labels:  debugger, stm32
stm32bl
STM32 MCU serial firmware loader (jet another stm32loader fw bootloader tool)
Stars: ✭ 22 (-84.06%)
Mutual labels:  flash, stm32
nf-Visual-Studio-extension
🧰 Visual Studio extension for .NET nanoFramework
Stars: ✭ 42 (-69.57%)
Mutual labels:  debugger, stm32
Ee
EEPROM emulation for stm32.
Stars: ✭ 109 (-21.01%)
Mutual labels:  stm32, flash
Various mcu debugger diy
各种LInk大合集
Stars: ✭ 402 (+191.3%)
Mutual labels:  stm32, debugger
OpenOCD
STMicroelectronics customized version of OpenOCD supporting STM32 MCUs and MPUs
Stars: ✭ 34 (-75.36%)
Mutual labels:  debugger, stm32
RailLink
Compact isolated version of J-Link v9.
Stars: ✭ 69 (-50%)
Mutual labels:  debugger, stm32
esp8266-wifi-cmsis-dap
WIRELESS CMSIS-DAP USB/IP-SWD/JTAG HID adapter firmware for ESP8266 boards
Stars: ✭ 69 (-50%)
Mutual labels:  debugger, stm32
Stm32 Bootloader
Customizable Bootloader for STM32 microcontrollers. This example demonstrates how to perform in-application-programming of a firmware located on an external SD card with FAT32 file system.
Stars: ✭ 541 (+292.03%)
Mutual labels:  stm32, flash
Dap42
CMSIS-DAP debugger firmware for STM32F042Fx and STM32F103xx
Stars: ✭ 115 (-16.67%)
Mutual labels:  stm32, debugger
Puppet Debugger
A interactive live debugger and REPL for the puppet language
Stars: ✭ 117 (-15.22%)
Mutual labels:  debugger
Stm32
STM32 CM3 Project
Stars: ✭ 119 (-13.77%)
Mutual labels:  stm32
Rexbug
A thin Elixir wrapper for the redbug Erlang tracing debugger.
Stars: ✭ 126 (-8.7%)
Mutual labels:  debugger
Magix Inspector
magix项目调试分析工具
Stars: ✭ 134 (-2.9%)
Mutual labels:  debugger
Frodo
Android Library for Logging RxJava Observables and Subscribers.
Stars: ✭ 1,496 (+984.06%)
Mutual labels:  debugger
Vscode Go
Go extension for Visual Studio Code
Stars: ✭ 2,268 (+1543.48%)
Mutual labels:  debugger
Easygui
Easy GUI for microcontrollers
Stars: ✭ 116 (-15.94%)
Mutual labels:  stm32
Eruda
Console for mobile browsers
Stars: ✭ 11,547 (+8267.39%)
Mutual labels:  debugger
Ocamlearlybird
OCaml debug adapter
Stars: ✭ 116 (-15.94%)
Mutual labels:  debugger
Gomacro
Interactive Go interpreter and debugger with REPL, Eval, generics and Lisp-like macros
Stars: ✭ 1,784 (+1192.75%)
Mutual labels:  debugger

PYSTLINK

Python tool for manipulating with STM32 MCUs using ST-Link in-system programmer and debugger.

Goal

Goal 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.

Features

  • running on Linux, Mac OS/X and Windows
  • simple command line interface
  • detect MCU
  • dump registers and memory
  • write registers
  • download memory to binary file
  • upload binary or SREC file into memory
  • FLASH binary or SREC file to all STM32
  • basic runtime control: reset, halt, step, run
  • support ST-Link/V2, ST-Link/V2-1 and ST-Link/V3

Planed features

  • FLASH support for other MCU types (STM32L)
  • FLASH information block (system memory, option bytes and OTP area)
  • connecting under RESET
  • stop Watchdog in debug mode to prevent device restart
  • allow to control breakpoints or watchpoints
  • support for more ST-Link devices connected at once
  • other file formats (SREC, HEX, ELF, ...)
  • pip installer
  • proxy to GDB
  • and maybe GUI
  • support for ST-Link/V1 is NOT planed, use ST-Link/V2 or V2-1 instead

Install

Requirements

  • Python v3.7+ (tested with 3.8)
  • pyusb
  • libusb or any other libusb driver

pystlink

  • Download and unpack or git clone https://github.com/pavelrevak/pystlink.git
  • Connect ST-LINK
  • Run ./pystlink.py --help (or python3 pystlink.py ... - depend on python installation and architecture)

Help

usage: pystlink [-h] [-q | -i | -v | -d] [-V] [-c CPU] [-r] [-u]
                [action [action ...]]

pystlink v0.0.0 (ST-LinkV2)
(c)2015 by [email protected]
https://github.com/pavelrevak/pystlink

optional arguments:
  -h, --help         show this help message and exit
  -V, --version      show program's version number and exit
  -c CPU, --cpu CPU  set expected CPU type [eg: STM32F051, STM32L4]
  -r, --no-run       do not run core when program end (if core was halted)
  -u, --no-unmount   do not unmount DISCOVERY from ST-Link/V2-1 on OS/X platform

set verbosity level:
  -q, --quiet
  -i, --info         default
  -v, --verbose
  -d, --debug

actions:
  action             actions will be processed sequentially

list of available actions:
  dump:core              print all core registers (halt core)
  dump:{reg}             print core register (halt core)
  dump:{addr}:{size}     print content of memory
  dump:sram[:{size}]     print content of SRAM memory
  dump:flash[:{size}]    print content of FLASH memory
  dump:{addr}            print content of 32 bit memory register
  dump16:{addr}          print content of 16 bit memory register
  dump8:{addr}           print content of 8 bit memory register

  set:{reg}:{data}     set register (halt core)
  set:{addr}:{data}    set 32 bit memory register

  read:{addr}:{size}:{file}      read memory with size into file
  read:sram[:{size}]:{file}      read SRAM into file
  read:flash[:{size}]:{file}     read FLASH into file

  fill:{addr}:{size}:{pattern}   fill memory with a pattern
  fill:sram[:{size}]:{pattern}   fill SRAM memory with a pattern

  write:{file.srec}     write SREC file into memory
  write:{addr}:{file}   write binary file into memory
  write:sram:{file}     write binary file into SRAM memory

  flash:erase            complete erase FLASH memory aka mass erase
  flash[:erase][:verify]:{file.srec}     erase + flash SREC file + verify
  flash[:erase][:verify][:{addr}]:{file} erase + flash binary file + verify

  reset                  reset core
  reset:halt             reset and halt core
  halt                   halt core
  step                   step core
  run                    run core

  sleep:{seconds}        sleep (float) - insert delay between commands

  (numerical values can be in different formats, like: 42, 0x2a, 0o52, 0b101010)

examples:
  pystlink.py --help
  pystlink.py -v --cpu STM32F051R8
  pystlink.py -q --cpu STM32F03 dump:flash dump:sram
  pystlink.py dump:0x08000000:256
  pystlink.py set:0x48000018:0x00000100 dump:0x48000014
  pystlink.py read:sram:256:aaa.bin read:flash:bbb.bin
  pystlink.py -r reset:halt set:pc:0x20000010 dump:pc core:step dump:all
  pystlink.py flash:erase:verify:app.bin
  pystlink.py flash:erase flash:verify:0x08010000:boot.bin

Supported programmers

From ST exists actually three different SWD programmers:

Full support:

  • ST-Link/V2
  • ST-Link/V2-1
  • ST-Link/V3

Not supported:

  • ST-Link/V1

Minimum recommended firmware version of ST-Link is V2J32xx or newer. Otherwise is recommended upgrade using ST-LINK firmware upgrade tool.

Supported MCUs

Currently almost all ST32 MCUs. There is script list_new_stm32.py which compare supported MCUs with all listed on st.com.

Not all MCUs are tested. Please report any problems to Issues tracker.

In WiKi is some basic info about STM32 naming: STM32 coding matrix

Legal

Code is under MIT license.

In 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.

Support is only by Issues tracker

PYSTLINK is inspired by OpenOCD, STLINK and lot of info is from sniffed USB communication with original ST-LINK program.

TAGS

ST-Link/V2, ST-Link/V3, stlink, SWD, Python, ARM, CortexM, STM32, debug, FLASH, USB

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].