Recent new features and bugfixes can be found in the Changelog of this software project.
The stlink library and tools are licensed under the BSD-3 License.
This fork uses the zig build system, specifically Zig 0.11.0. Here's an example
build.zig.zon
and build.zig
respectively that includes stlink as a
dependency and sets up a build command to flash a microcontroller.
.{
.name = "My Project",
.version = "0.0.1",
.dependencies = .{
.stlink = .{
.url = "https://github.com/ZigEmbeddedGroup/stlink/archive/f00d40f4d5c6de9425fec7db0e008405bd12d332.tar.gz",
.hash = "1220337afbff0db6f390c4150a9ba5d3f613c2d1d48b3ae084db8b4b7b2ea6ec27f8",
},
},
}
const std = @import("std");
const Build = std.Build;
const stlink = @import("stlink");
pub fn build (b: *Build) void {
// ...
// The string is to specify what name you gave it in your build.zig.zon
const st = stlink.init(b, "stlink");
const flash = st.flash(.{
.write = .{
// assume exe is some embedded executable we've made for our microcontroller
.path = exe,
.addr = 0x00000000,
},
});
const flash_step = b.step("flash", "Flash the microcontroller");
flash_step.dependOn(&flash.step);
}
Now you can zig build flash
.
stlink is an open source toolset to program and debug STM32 devices and boards manufactured by STMicroelectronics. It supports several so called STLINK programmer boards (and clones thereof) which use a microcontroller chip to translate commands from USB to JTAG/SWD. There are four generations available on the market which are all supported by this toolset:
- STLINK/V1 [obsolete as of 21-11-2019, continued support by this toolset]
- transport layer: SCSI passthru commands over USB
- stand-alone programmer
- on-board on STM32VL Discovery boards
- STLINK/V2
- transport layer: raw USB commands
- stand-alone programmer
- on-board on STM32L Discovery and STM32 Nucleo boards
- STLINK/V2-1
- transport layer: raw USB commands
- on-board on some STM32 Nucleo boards
- STLINK-V3
- transport layer: raw USB commands
- stand-alone programmer (STLINK-V3SET, STLINK-V3MINI, STLINK-V3MODS)
- on-board on some STM32 Nucleo boards (STLINK-V3E)
On the user level there is no difference in handling or operation between these different revisions.
The STlink toolset includes:
st-info
- a programmer and chip information toolst-flash
- a flash manipulation toolst-trace
- a logging tool to record information on executionst-util
- a GDB server (supported in Visual Studio Code / VSCodium via the Cortex-Debug plugin)stlink-lib
- a communication librarystlink-gui
- a GUI-Interface [optional]
Currently known working MCU targets are listed in supported_devices.md.
A list of supported operating can be found in version_support.md.
Our tutorial may help you along with some advanced tasks and additional info.
Windows:
As of Release v1.6.1 stand-alone Windows binaries are made available (again) on the release page of the project.
Please ensure to select the correct version for your system (i686 or x86_64). The archive file can be unzipped to any desired location as it does not contain any hardcoded paths. However we suggest to move the unzipped application folder to C:\Program Files\
on 32-bit systems and to C:\Program Files (x86)\
on 64-bit systems (the toolset is 32-bit).
Alternatively one may compile and install from source as described in our compiling manual.
Linux / Unix:
We recommend to install stlink-tools
from the package repository of the used distribution:
Note: As packages distributed via the Debian and Ubuntu repositories differ from our self-maintained deb-package, we recommend to use the latter instead (see link below). It provides the opportunity to handle and fix user-reported package issues directly within the project and is not redundant to any limitations deriving from external maintenance guidelines.
- Debian Linux: (Link)
- Ubuntu Linux: (Link)
- Arch Linux: (Link)
- Alpine Linux: (Link)
- Fedora: (Link)
- FreeBSD: Users can install from freshports
macOS:
Support for macOS has been dropped with v1.8.0.
Please use v1.7.0 instead, but note that this version is no longer maintained and supported!
When there is no executable available for your platform or you need the latest (possible unstable) version you need to compile the toolset yourself. This procedure is explained in the compiling manual.
- The semantic versioning scheme is used. Read more at semver.org
- Before creating a pull request, please ALWAYS open a new issue for the discussion of the intended new features. Bugfixes don't require a discussion via a ticket-issue. However they should always be described in a few words as soon as they appear to help others as well.
- Contributors and/or maintainers may submit comments or request changes to patch-proposals and/or pull-requests.
- ATTENTION: NEVER EVER use the '#' character to count-up single points within a listing as '#' is exclusively reserved for referencing GitHub issues and pull-requests. Otherwise you accidentally introduce false cross references within the project.
- Please start new forks from the develop branch, as pull requests will go into this branch as well.
Please also refer to our Contribution Guidelines.
I hope it's not to out of topic, but I've been so frustrated with AVR related things on OpenBSD, the fact that stlink built out of the box without needing to touch anything was so relieving. Literally made my whole weekend better! I take it's thanks to @Crest and also to the stlink-org team (@Nightwalker-87 and @xor-gate it seems) to have made a software that's not unfriendly to the "fringe" OSes. Thank you <3" - nbonfils, 11.12.2021