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-0.2.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-0.2.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: st_flashing_utility-0.2.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-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6ac1d89e18df1b800d6bc5491721427824f66cad66a796ee450b9a55321e6ddd
MD5 38f46278f4633e77fcbebd78d6132152
BLAKE2b-256 46b7bbd791bbe9401cbe4aca9f796555ede5475bdf9b83314e27c90b69c81596

See more details on using hashes here.

File details

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

File metadata

  • Download URL: st_flashing_utility-0.2.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-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fc4633f9cba3aa9b3ff42552e4380e9b44939ee2fc0850bc47de30a061850f5
MD5 fe37e47f0cb74eba47e09017db701699
BLAKE2b-256 eb16b04391d7c30182f97fe6772687dcca0b0aedd982447dc1c33c52f7b923c9

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