Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>TREV FlashingNew to Visual Studio Code? Get it now.
TREV Flashing

TREV Flashing

adi-trev

| (0) | Free
Build, debug, and flash TREV STM32 firmware over USB or CAN
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

TREV Flashing

An extension to compile, debug, and flash TREV STM32 projects over USB or CAN. It works with STM32CubeMX projects and can install the required build toolchain automatically.

This extension also supports using cpp files; however, main.c has to be manually renamed to main.cpp for it to work.

NOTE: Your CubeMX project needs to be generated as a makefile project under "Project Manager -> Project -> Toolchain/IDE".

Build demo gif video

Prerequisites

There are a few command line tools that need to be installed for this extension to work. You can either add them manually or let the extension automatically install them for you. This option will be shown on start-up.

Automatic installation

Installation demo gif

  • STM32 CubeMX
  • Cortex-Debug extension
  • GNU Arm Embedded Toolchain
  • Make (platform dependent, Windows, OSX: install command line developer tools)
  • OpenOCD: Windows, all platforms
  • Python 3.10+ (only required for CAN flashing)

Configuring CubeMX

This extension assumes the project is initialized with CubeMX and the option to create a Makefile project under "Project Manager -> Project -> Toolchain/IDE".

Also, please leave the default on "Copy all used libraries into the project folder" when creating the new project.

How to Use

Click on the ST icon and select the command you want to run. Once this is done for the first time, you can also use the shortcut Cmd/Ctrl+Shift+B to start building.

USB and CAN flashing

The existing Flash STM32 commands flash over a USB-connected programmer using OpenOCD. The Flash STM32 over CAN command builds the project, automatically downloads a pinned version of STM32-CAN-Flasher, installs it in an isolated Python environment, and launches its interactive CLI in a VS Code terminal. Later CAN flashes reuse the cached installation. The CLI automatically uses build/debug; it does not prompt for a firmware directory.

The flasher is pinned by commit and SHA-256 in src/canFlasher/definition.ts, so updating the integrated CLI is a two-value change. Set trev-flashing.canFlasherPythonPath if Python is not discoverable on PATH. Use STM32: Install or reinstall the CAN flasher to repair the cached copy.

CAN flashing follows the upstream flasher's firmware convention: the selected build directory must contain *_a.bin and/or *_b.bin dual-bank images.

Features

  • Creating a makefile and building and STM32 project.
  • Adding configurations for debugging, flashing and building in the workspace.
  • Ability to compile as a C++ project by adding a main.cpp file.
  • Automatic configuration of IntelliSense.
  • Detection and installation of an embedded toolchain
  • USB/OpenOCD and CAN bootloader flashing workflows
  • Configuration file per project.
  • Searches for .c/.cpp and .h/.hpp files in your project.
  • Add static libraries for compilation.
  • Import existing CubeIDE projects or STM32CubeMX examples.
  • Configuration automatically generated and stored in TREV-Flashing.config.yaml file.

Build Process

The build process uses the information in the CubeMX makefile and TREV-Flashing.config.yaml to find dependencies and set flags. The CubeMX makefile is optional, but the TREV configuration file is always present when building. The extension then updates its generated makefile when necessary and runs the build.

Configuration

The recommended way to configure the build—such as adding flags, files, or directories—is through TREV-Flashing.config.yaml. The generated YAML contains comments explaining each option. Report problems through the TREV Flashing issue tracker.

Importing

STM32CubeIDE and ST provided example projects can now be imported by using the: "import CubeIDEProject" command. Do note that the project folder should be open in the workspace.

Attribution

TREV Flashing is a fork of STM32 for VSCode by Bureau Moeilijke Dingen, distributed under the MIT License. TREV-specific CAN flashing is powered by STM32-CAN-Flasher.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft