ST-Link WebUSB Interface (Demo Here)
This project provides a web-based interface for interacting with ST-Link devices using the WebUSB standard.
It allows:
- fetching information about the ST-Link
- flashing firmware in
.binformat
⚠️ Note: This tool has only been tested with a NUCLEO-H753ZI board, which has an integrated ST-LINK v3.
Your browser must support WebUSB. (TLDR: No Firefox.)
SharedArrayBuffer must be enabled, which requires the following two headers to be set:
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corpThis project uses a Nix flake for most actions. Nix flakes provide a reproducible way to manage dependencies and build configurations.
- Install Nix: Follow the installation instructions from the Nix website.
- Enable Flakes: You can either enable experimental features for individual commands or enable flakes globally.
- Use the
--experimental-features 'nix-command flakes'flag, or - Add the following lines to your Nix configuration file (usually
~/.config/nix/nix.conf):experimental-features = nix-command flakes
- Use the
You can then build the project with:
nix buildYou can start a local server to serve the application at http://localhost:8000 with:
nix runRemember to use a supported browser.
You can start a development shell with all necessary dependencies with:
nix developflake.nix: Nix flake for building, running, and providing a development shell.flake.lock: Lock file for the Nix flake.
index.html: The main HTML file for the web interface.styles.css: The CSS file for styling the web interface.script.js: The main JavaScript file that contains the logic for interacting with the ST-Link device.wrapper.js: A JavaScript file that wraps the necessary functions for WebAssembly.
libstlink.js: The JavaScript glue code generated by Emscripten for the ST-Link library.libstlink.wasm: The WebAssembly binary for the ST-Link library.libstlink.worker.js: A Web Worker script for the ST-Link library.libstlink.data: The data file generated by Emscripten.chips/: Directory containing the chip configuration files from the ST-Link library.