Syntax
Global Options
Commands
Command Reference
gdbserver
Start JLinkGDBServer for remote debugging. This is the primary command to establish a debug connection.
--box TEXT- Lagerbox name or IP--force / --no-force- Force new connection (default: reuse existing)--halt / --no-halt- Halt device when connecting (default: no-halt)--speed KHZ- SWD/JTAG speed in kHz (e.g., 100, 4000) or “adaptive”--quiet- Suppress informational messages--json- Output results in JSON format--rtt- Automatically stream RTT logs after starting GDB server--rtt-reset- Reset device then stream RTT (captures boot sequence)--reset- Reset device after starting GDB server--gdb-port PORT- Override the auto-allocated GDB server port. By default the box picks a port based on the probe’s slot (2331 for the first probe, 2334 for the second, etc.); pass this only if you need a specific port, and avoid it on multi-probe boxes.--rtt-search-addr HEX- RAM start address for the RTT control block search (hex, e.g.,0x20020000)--rtt-search-size HEX- Size of the RAM region to search for the RTT control block (hex, e.g.,0x4000)--rtt-chunk-size HEX- Read chunk size for the RTT search (hex, e.g.,0x1000)
disconnect
Stop JLinkGDBServer and free debug resources.
--box TEXT- Lagerbox name or IP--keep-server- Keep JLinkGDBServer running for external connections
flash
Flash firmware to target. Supports Intel HEX, ELF, and binary file formats.
--box TEXT- Lagerbox name or IP--hex FILE- Path to Intel HEX file--elf FILE- Path to ELF executable--bin ADDRESS FILE- Path to binary file with load address--verbose- Show detailed J-Link output--force-reconnect- Force clean reconnect before flash--no-erase- Skip the erase step (by defaultflasherases before programming for a clean state)--halt / --no-halt- Halt device after flashing (default: no-halt)
flash erases before programming by default, so no flag is needed for a
clean state (this is what RTT initialization wants). Pass --no-erase only when
you intentionally want to preserve existing flash contents. The older --erase
flag is now a no-op kept for backward compatibility.reset
Reset the target device.
--box TEXT- Lagerbox name or IP--halt / --no-halt- Halt after reset (default: no-halt)--force-reconnect- Force clean reconnect before reset
erase
Erase all flash memory on target. This is a destructive operation.
--box TEXT- Lagerbox name or IP--speed KHZ- SWD/JTAG speed in kHz (default: 4000)--yes- Skip confirmation prompt--quiet- Suppress warning messages--json- Output results in JSON format--halt / --no-halt- Halt after erase (default: no-halt)
memrd
Read memory from the target device.
START_ADDR- Starting memory address (e.g., 0x20000000)LENGTH- Number of bytes to read
--box TEXT- Lagerbox name or IP--json- Output results in JSON format--halt / --no-halt- Halt device during read (default: no-halt).--no-haltoverrides the auto-halt for DA1469x QSPI XIP--no-reset- DA1469x only. Skip the reset+halt the box performs before the read. A running DA1469x has SWD disabled, so without the reset the read fails — use this only on a blank/awake part to avoid rebooting it
status
Show debug net status and configuration information.
--box TEXT- Lagerbox name or IP
health
Check debug service health and resource usage.
--box TEXT- Lagerbox name or IP--verbose- Show detailed health information
Listing Debug Nets
When invoked with only--box and no subcommand, lists all debug nets on the Lager Box:
RTT (Real-Time Transfer) Logging
RTT provides low-latency logging over the debug probe. Use the--rtt or --rtt-reset flags with gdbserver:
Decoding defmt logs
Most Rust (and much C) firmware logs via defmt, a compressed binary format. Raw RTT bytes from defmt firmware are not human-readable — they must be decoded bydefmt-print using the exact ELF that is flashed on the target.
- Redirect stderr. The RTT payload is written to stdout; status messages (
JLinkGDBServer started!, etc.) go to stderr. Pipe stdout only — append2>/dev/null(or2>debug.log) so status lines never corruptdefmt-print’s input. - The stream never ends.
--rttruns until the process is killed. In scripts or non-interactive sessions, wrap it intimeout <seconds>to capture a fixed window; when thelagerprocess is killed the pipe closes anddefmt-printexits on EOF.
defmt-print with cargo install defmt-print on the machine where you run the pipe (the same machine that holds the .elf).
Typical Workflows
Development Cycle
RTT Debugging
Memory Inspection
Clean Up
JLinkScript Support
JLinkScript files allow you to customize J-Link debug probe behavior for specific hardware configurations. They can handle custom reset sequences, clock initialization, pin configurations, and other device-specific operations that the standard J-Link connection flow does not cover.Configuring JLinkScript
There are three ways to attach a J-Link script to a debug net: 1. During net creation:.lager config:
Script Priority
When both a net-level script (stored on the box viaset-script) and a project-level script (in .lager config) exist, the project-level script takes priority. This allows you to override the box-stored script for specific projects.
Managing Scripts
Supported Debug Probes
Supported Device Families
Lager supports 70+ ARM Cortex-M device families with automatic architecture detection. The device type is specified as the channel when creating a debug net (e.g.,STM32F407VG, nRF52840).
Cortex-M0/M0+ (ARMv6-M)
Cortex-M3 (ARMv7-M)
Cortex-M4/M7 (ARMv7E-M)
Cortex-M23 (ARMv8-M Base)
Cortex-M33/M55 (ARMv8-M Main)
Devices not in the table above default to Cortex-M4 (ARMv7E-M) architecture. If your device is not detected correctly, specify the full device part number (e.g.,
STM32F407VG rather than just STM32F4) when creating the debug net.Notes
- Debug nets are created with
lager nets add <name> debug <device_type> <address> - The system auto-connects when needed for commands like
flashandreset flasherases before programming by default, giving a clean state for RTT initialization (use--no-eraseto opt out)- RTT streaming requires the device to have RTT support in firmware
- Memory reads are more reliable with
--haltto pause the CPU - Use
lager debug health --verboseto diagnose connection issues - JLinkScript files are base64-encoded for storage and decoded automatically on the box
See Also
- Python Debug API — Automate flashing and debugging in Python scripts
- Python Command — Run test scripts on the box
- Glossary — Definitions of GDB, SWD, and other terms

