---
title: "Debug state from Keil, IAR and Ozone"
---

# Debug state from Keil, IAR and Ozone

Importing breakpoints, watches and debugger settings from Keil uVision and IAR Embedded Workbench, running Keil .ini and C-SPY .mac set-up scripts through GDB, and turning a SEGGER Ozone .jdebug project into a debug configuration.

Yesterday's breakpoints, watches and target set-up come with you from the vendor IDE. Every import shows what it will add and what it cannot carry over, and changes nothing until you confirm. The vendor's files are only read.

## Import breakpoints and debugger settings from Keil or IAR

Run **Import Breakpoints and Debugger Settings from Keil or IAR** and choose the project and its configuration or target. It reads:

| Vendor | Files | What is imported |
|---|---|---|
| Keil uVision | `.uvoptx` (and the older `.uvopt`) | Breakpoints, watch expressions, run to main, the debug probe, and the debug initialisation file (`.ini`) |
| IAR Embedded Workbench | `settings/` (`.dnx`, `.dni` for breakpoints, `.dbgdt` for Watch windows) and the `.ewd` | Breakpoints, watch expressions, run to main, the C-SPY driver (probe) and the setup macro file (`.mac`) |

The confirmation lists the breakpoints and watches it adds, the launch configuration it writes into `.vscode/launch.json` (for example "Flash and Debug motor_controller: Debug (from IAR Embedded Workbench)", with the probe and the set-up script), and each file or setting it does not import with the reason, such as C-SPY's own batch file or the window layout (`.wsdt`; the [IAR debug layout](https://neuralinverse.com/docs/modules/embedded/keymap/) opens the debug windows instead). The same list goes to the Embedded log.

Breakpoints whose counts, commands or conditions are not read, and breakpoints that are not execution breakpoints, are imported disabled. Memory windows and data watchpoints are reported, not imported.

State: the parsers run on real files (public FreeRTOS demo projects, Keil's STM32F4xx_DFP 3.1.2, Atmel examples), and the import was used in the running app on Linux. Kit shipped (jlink). **Not yet run against uVision or IAR Embedded Workbench**, and not on Windows.

## Run Keil and C-SPY set-up scripts

A Keil uVision debug initialisation file (`.ini`) or an IAR C-SPY setup macro file (`.mac`) named in the launch configuration's `setupScript` is translated into GDB commands and run through the session's GDB server:

- **Keil `.ini`**: run once connected and after every Restart. Memory accesses such as `_WDWORD` and `_RDWORD` are translated.
- **C-SPY `.mac`**: `execUserPreload` runs once the session has connected (after the probe software flashed the image and reset the target); `execUserReset` runs after every later reset (Restart). The system macros `__readMemory32`, `__writeMemory32` (the "Memory" zone), `__message`, `__delay` and `__hwReset` are translated; `__message` output and evaluated values are printed in the Debug Console.

A line that cannot be translated is never dropped silently: it is listed in the Embedded log with the reason. This includes uVision debugger commands such as `LOAD`, `g`, `BS` and `RESET`, debug functions other than the memory accesses, the C-SPY "Register" zone, and C-SPY setup functions other than `execUserPreload` and `execUserReset`.

**Show Debug Set-up Script as GDB Commands (Keil .ini, IAR .mac)** shows the translation of a script line by line without running it.

`connectCommands` and `resetCommands` in the launch configuration add your own GDB commands after connecting and after every Restart.

State: the translator tested on real files (Keil STM32F4xx_DFP 3.1.2 and public examples); set-up scripts run in debug sessions on QEMU 8.2.2 with gdb-multiarch 15.1 on Linux and in the running app. Kit shipped (jlink). **Not yet run through a J-Link or an ST-LINK**, or on Windows.

## Import a SEGGER Ozone project

A supplier's or colleague's Ozone project (`.jdebug`, with its `.jdebug.user`) becomes a debug configuration. Run **Import SEGGER Ozone Project (.jdebug)**, or right-click the `.jdebug` file in the Explorer and choose **Import Ozone Project**.

From the project's `OnProjectLoad` function and the user file it takes the device, interface, speed and probe serial number, the ELF image, the SVD file, the RTOS plug-in, breakpoints and watches. The confirmation lists them and every item it does not import with the reason: for example an SVD file from Ozone's own installation (`$(InstallDir)`), script functions such as `AfterTargetReset` that Ozone runs on its own events, and graphed expressions, which you can plot with **Plot Expression** instead.

The result is an `ni-embedded` launch configuration "Flash and Debug \<project\> (from Ozone)" through the J-Link, with the watches and breakpoints added.

State: tested on three public Ozone projects (foxBMS 2, a Packt example, TNKernel); the import plan and confirmation in Electron tests; used in the app. **Not tested against Ozone.**

## Agents

Agents can preview and run the Keil or IAR import (**Preview the Import of Keil or IAR Debug Settings**, **Import Keil or IAR Debug Settings**); the import writes nothing until you confirm.
