---
title: "Flash, erase and probes"
---

# Flash, erase and probes

Choosing the probe software (SEGGER J-Link, ST-LINK, Lauterbach TRACE32, NXP LinkServer, PEmicro or OpenOCD), testing the connection, flashing an image after confirmation, and erasing the whole flash or chosen sectors.

**Verification state:** no flash or erase of this module has run on a board, with any tool, on any operating system. The command lines, output parsers and confirmation dialogs are unit-tested; the vendor paths have verification kits waiting for their first report.

## Choose the probe software

`neuralInverse.embedded.probeServer` decides which software drives the probe for flashing and debugging:

| Value | Meaning |
|---|---|
| `auto` (default) | The vendor software of a connected J-Link or ST-LINK, or of an NXP probe; else the first installed of SEGGER's J-Link software, ST's tools, Lauterbach TRACE32, NXP LinkServer and PEmicro's GDB server; OpenOCD only when none is installed |
| `jlink` | SEGGER J-Link software |
| `stlink` | ST-LINK GDB server and STM32CubeProgrammer |
| `trace32` | Lauterbach TRACE32 |
| `openocd` | OpenOCD |
| `linkserver` | NXP LinkServer |
| `pemicro` | PEmicro GDB server |

A launch configuration's `probe` attribute (`server` and `serial`), or a Cortex-Debug `servertype`, wins over the setting. Probes are recognised by their vendors' published USB ids; CMSIS-DAP probes (DAPLink, ULINK, MCU-Link) work through OpenOCD.

Run **Configure Debug Probe and Target...** to see and change the choice; the list says which probe software is installed and what Automatic uses now. It then asks what that software needs, such as the J-Link device name, the TRACE32 CPU and connection, or the LinkServer device and core. **Test Debug Probe Connection** checks that the probe reaches the target (for J-Link, through J-Link Commander).

![The Probe Software list: Automatic, which uses OpenOCD now, then SEGGER J-Link Software, ST Tools, Lauterbach TRACE32, NXP LinkServer and PEmicro GDB Server marked not found, and OpenOCD installed.](https://neuralinverse.com/docs-images/modules/embedded/probe-software.webp)

### Probe settings

| Probe | Settings |
|---|---|
| J-Link | `neuralInverse.embedded.jlink.device` (the J-Link device name, such as `STM32F407VG`), `jlink.interface` (`SWD` or `JTAG`, default `SWD`), `jlink.speed` (kHz, default 4000), `jlink.serial` |
| ST-LINK | `neuralInverse.embedded.stlink.serial`, `stlink.frequency` (SWD clock in kHz, 0 lets STM32CubeProgrammer choose), `stlink.connectUnderReset` (for firmware that disables the SWD pins or enters low-power modes) |
| TRACE32 | `neuralInverse.embedded.trace32.cpu` (for `SYStem.CPU`), `trace32.connection` (`USB`, `NET`, `SIM`), `trace32.node`, `trace32.debugPort`, `trace32.script`, `trace32.flashScript`, `trace32.gdbServerSetup` (`script` or `config`), `trace32.port` (default 30000). See [Lauterbach TRACE32](https://neuralinverse.com/docs/modules/embedded/trace32/) |
| OpenOCD | `neuralInverse.embedded.openocd.board` (default `board/stm32f4discovery.cfg`), or `openocd.interface` and `openocd.target` without a board script; `openocd.adapterSerial`, `openocd.adapterSpeed`, `openocd.arguments` |
| NXP LinkServer | `neuralInverse.embedded.linkserver.device` (LinkServer's name, `<chip>:<board>` or the chip, such as `LPC55S69:LPCXpresso55S69`; `LinkServer devices` lists them), `linkserver.core`, `linkserver.probe` (serial), `linkserver.overrides` |
| PEmicro | `neuralInverse.embedded.pemicro.device`, `pemicro.interface`, `pemicro.port`, `pemicro.speed` (kHz) |

Workspace-specific values (device, probe) are stored in the workspace settings.

![The LinkServer Device prompt with LPC55S69:LPCXpresso55S69 entered and LinkServer's naming explained.](https://neuralinverse.com/docs-images/modules/embedded/linkserver-device.webp)

### Several probes on one machine

Set the probe's serial number (`jlink.serial`, `stlink.serial`, `openocd.adapterSerial`, `linkserver.probe`) or the launch configuration's `probe.serial`. NXP probes (MCU-Link, LPC-Link2, Multilink, Cyclone) are chosen by serial.

## Flash an image

1. Build the project.
2. Press **Cmd+Alt+U** (Ctrl+Alt+U), click **Flash** in the title bar, run **Flash Firmware**, or right-click an image in the Explorer and choose **Flash to Target**. For any other image, run **Flash Image File...**: it takes `.elf`, `.axf`, `.out`, `.hex`, `.ihex` and `.bin` files, and asks a load address (such as `0x08000000`) for a raw binary.
3. Read the confirmation. It names the target, the probe, the image with its size, and its SHA-256.
4. Confirm. The image is hashed again just before programming; if it changed after you confirmed (a rebuild in between), nothing is flashed.

Nothing is flashed without that confirmation. Each flash verifies and resets the target, and is recorded in the Embedded log with whether the image is the one the last build record names.

![The confirmation before flashing, naming the target, the probe, the image with its size and its SHA-256.](https://neuralinverse.com/docs-images/modules/embedded/flash-confirmation.webp)

What each probe path runs:

| Probe | How it flashes | State |
|---|---|---|
| OpenOCD | `program <image> verify reset exit` | Command lines unit-tested; not run on a board |
| J-Link | A generated J-Link Commander command file | Kit shipped (jlink); not yet run against J-Link |
| ST-LINK | STM32CubeProgrammer CLI, with the serial, frequency and connect-under-reset settings | Kit shipped (stm32cubeprogrammer); not yet run against STM32CubeProgrammer |
| TRACE32 | **Flash Firmware with TRACE32**: see [Lauterbach TRACE32](https://neuralinverse.com/docs/modules/embedded/trace32/#flash-without-debugging) | Kit shipped (trace32); not yet run against TRACE32 |
| NXP LinkServer | LinkServer's flash command | Kit shipped (nxp-probes); not run with LinkServer or a real probe; command lines checked against NXP's published scripts |
| PEmicro | PEmicro's GDB server, with GDB loading the ELF image and comparing it after writing | Kit shipped (nxp-probes); the load-and-compare reading checked on real GDB 15.1 output against QEMU; PEmicro's own flags and output are unverified |

The flash uses the probe tool's own flash drivers for the device.

## Erase

- **Erase Target Flash** erases all of the target's flash, after you confirm.
- **Erase Flash Sectors...** erases only the sectors you choose, such as a calibration sector, through J-Link Commander, STM32CubeProgrammer or OpenOCD. The list shows each sector with its address range and size, the section of the last build it holds, and the flash it belongs to; choose sectors of one flash at a time. The sector layout comes from the device's CMSIS pack flash algorithm. A confirmation names the sectors, their addresses, the device and the probe before anything is erased.

![The confirmation before erasing one flash sector, naming the device, the probe, the sector range and the sector layout used.](https://neuralinverse.com/docs-images/modules/embedded/erase-sectors-confirm.webp)

State: the STM32F407VG sector layout was checked against the real `STM32F4xx_1024.FLM` flash algorithm; the J-Link `erase` and `STM32_Programmer_CLI -e` arguments and messages are unverified until the kits run (jlink, stm32cubeprogrammer). Agents can list sectors (**List Flash Sectors**) and erase them (**Erase Flash Sectors**) only after the same confirmation.

## More programming paths

- STM32 option bytes, the STM32 system bootloader and external flash through STM32CubeProgrammer: [STM32 option bytes, bootloader and external flash](https://neuralinverse.com/docs/modules/embedded/stm32-programming/).
- J-Flash production runs and comparing a device with the release file: [Production programming and release checks](https://neuralinverse.com/docs/modules/embedded/production/).
