Skip to main content

Add your description here

Project description

STFU - ST Flash Utility

STM32s are great little chips, and have many ways of getting firmware onto them. Many have a UART bootloader, some have a USB bootloader (DFU), and all are programmable via SWD. Each method has its own tools and arguments, and it's kind of a mess.

STFU unifies all STM32 flashing tools in a tiny little python script. It's super easy to use:

stfu dfu path/to/firmware.bin

That's it. You tell it what method, and what firmware file. All detection of UART ports, dfu devices, and SWD programmers (currently just Black Magic Probes) happens automatically.

This tool is intended to be used on MacOS only. Thank you to Thea Flowers for the original version of this!

Installation

  1. Install Homebrew and install uv if you haven't already.

  2. Install dependencies:

    brew install dfu-util stm32flash arm-none-eabi-gdb
    
  3. Install STFU:

    uv tool install git+https://github.com/sphawes/stfu
    

Done! stfu is now on your PATH.

Usage

STFU supports three methods of flashing STM32 chips:

  • dfu - meant for programming chips that support a dfu interface via USB.
  • uart - meant for programming chips using a USB <-> UART adapter.
  • swd - mean for programming chips via SWD port and a Black Magic Probe.

STFU requires one of the three methods as an argument, then the path to the firmware file:

stfu dfu path/to/firmware.bin

Arguments

All arguments are optional.

  • --gdb - explicitly define path to gdb executable on your machine.
    • Default: arm-none-eabi-gdb
    • Example: stfu swd firmware.elf --gdb path/to/gdb
  • --bmp - explicitly define path to BMP programming serial port.
    • Default: Searches via regex
    • Example: stfu swd firmware.elf --bmp path/to/bmp/port
  • --uart - explicitly define path to UART serial port.
    • Default: Searches via regex
    • Example: stfu uart firmware.bin --uart path/to/uart/port
  • --enable-power - tells Black Magic Probe to enable its 3.3v rail, so the probe can power the chip itself.
    • Default: False
    • Example: stfu swd firmware.elf --enable-power

Caveats

This tool is incredibly opinionated. It was made explicitly to help with programming the specific STM32 chips used in Opulo hardware, and thus common settings used for Opulo configurations are hard-coded. Please feel free to fork for your own variants, or make a PR with more optional flags for other configuration options.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

st_flashing_utility-1.0.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

st_flashing_utility-1.0.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file st_flashing_utility-1.0.0.tar.gz.

File metadata

  • Download URL: st_flashing_utility-1.0.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for st_flashing_utility-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cccd59f60a8035e0f9a6d0539d94e3d1826c9ece173ab5b6255aee8ddd1c3f75
MD5 08aa15f78f185a1bd8d2c6994ac5f093
BLAKE2b-256 52ede2f7c202c3d58d3a696a930424bed02598be44dbb051f5a2171eea66f369

See more details on using hashes here.

File details

Details for the file st_flashing_utility-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: st_flashing_utility-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for st_flashing_utility-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 815ab978c0255955294119a488b6a504493e33885e0bffdc3ef3ca4b53260eb6
MD5 4b33a60e8ffa74488758af2b1d571405
BLAKE2b-256 802e188afc6e0c58327e56d280aa8ed5dbb6cbbaac98cf537a445b600ebed6a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page