You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+90-95Lines changed: 90 additions & 95 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,7 @@ To start debugging, the CMSIS Solution offers action buttons and menu commands.
33
33
34
34
-**Load & Debug application** starts the CMSIS Debugger with _launch_ configuration.
35
35
-**Load & Run application** starts program execution and the GDB server; use then _attach_ configurations to connect to the running system.
36
+
-**Target Information** (...) shows the available debugger adapters.
36
37
37
38
## Debugger User Interface
38
39
@@ -56,12 +57,14 @@ The **Run and Debug** view provides:
56
57
> **TIP**<br>
57
58
> Click on a _line number badge_ to navigate to the source code line.
58
59
59
-
Other debugger-specific views:
60
+
Other debuggerspecific views or features:
60
61
61
-
-[**Disassembly**](#disassembly) shows assembly instructions and supports run control, for example, with stepping and breakpoints.
62
+
-[**Disassembly**](#disassembly) shows assembly instructions and supports run control, for example with stepping and breakpoints.
62
63
-[**Debug Console**](#debug-console) lists debug output messages and allows entering expressions or GDB commands.
63
64
-[**Peripherals**](#peripherals) show the device peripheral registers and allow changing their values.
64
65
-[**Serial Monitor**](#serial-monitor) uses serial or TCP communication to interact with application I/O functions (`printf`, `getc`, etc.).
66
+
-[**CPU Time**](#cpu-time) shows execution timing and statistics of the past five breakpoints.
67
+
-[**Multi-Core Debug**](#multi-core-debug) to view and control several processors in a device.
65
68
66
69
### Debug toolbar
67
70
@@ -74,9 +77,9 @@ During debugging, the **Debug toolbar** contains actions to control the flow of
74
77
| Continue/Pause |**Continue**: Resume normal program execution (up to the next breakpoint).<br>**Pause**: Inspect code executing at the current location. |
75
78
| Step Over | Execute the next statement as a single command without inspecting or following its component steps. |
76
79
| Step Into | Enter the next statement to follow its execution line-by-line. |
77
-
| Step Out | When inside a function, return to the earlier execution context by completing the remaining lines of the current method as though it were a single command. |
80
+
| Step Out | When inside a function, return to the earlier execution context by completing remaining lines of the current method as though it were a single command. |
78
81
| Restart | Terminate the current program execution and start debugging again using the current run configuration. |
79
-
| Stop/Disconnect |**Stop**: Terminate the current debug session.<br>**Disconnect:** Detach debugger from a core without changing the execution status (running/paused). |
82
+
| Stop/Disconnect |**Stop**: Terminate the current debug session.<br>**Disconnect:** Detach debugger from a core without changing the execution status (running/pause). |
80
83
| Debug Session | For multi-core devices, the list of active debug sessions and switch between them. |
81
84
| Reset Target | Reset the target device. |
82
85
@@ -205,17 +208,64 @@ debug console. Logpoints can help you save time by not having to add or remove l
205
208
A logpoint is represented by a diamond-shaped icon. Log messages are plain text, but can also include expressions to be
206
209
evaluated within curly braces ('{}').
207
210
208
-
To add a logpoint, right-click in the editor's left margin and select Add Logpoint, or use the
211
+
To add a logpoint, right-click in the editor left margin and select Add Logpoint, or use the
209
212
**Debug: Add Logpoint...** command in the Command Palette (**Ctrl/Cmd + Shift + p**).
210
213
211
214

212
215
213
216
Just like regular breakpoints, logpoints can be enabled or disabled and can also be controlled by a condition
214
217
and/or hit count.
215
218
219
+
### CPU Time
220
+
221
+
Most Arm Cortex-M processors (except Cortex-M0/M0+/M23) include a `DWT->CYCCNT` register that counts CPU states. In combination with the CMSIS variable [`SystemCoreClock`](https://arm-software.github.io/CMSIS_6/latest/Core/group__system__init__gr.html) the CMSIS Debugger calculates execution time and displays it along with the selected processor core in the CPU Time Status bar. A click on the CPU Time Status bar opens the related [VS Code command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette).
222
+
223
+
|Command | Description |
224
+
|:--------------|:-------------|
225
+
|CPU Time | Print CPU execution time and history of past program stops. |
226
+
|Reset CPU Time | Reset CPU execution time and history. Set new reference time (zero point). |
> - The first program stop (typically at function `main`) is the initial reference time (zero point).
233
+
> -`DWT->CYCCNT` is a 32-bit register incremented with [`SystemCoreClock`](https://arm-software.github.io/CMSIS_6/latest/Core/group__system__init__gr.html) frequency. The time calculation copes with one overflow between program stops. Multiple overflows between program stops deliver wrong time information.
234
+
> - Each processor in a multi-processor system has and independent `DWT->CYCCNT` register.
235
+
236
+
### Multi-Core Debug
237
+
238
+
A GDB server provides multiple connections to the processor cores (identified with `pname`) of a device. The list below shows the output of pyOCD in the DEBUG CONSOLE of VS Code.
239
+
240
+
```txt
241
+
0000680 I Target device: MCXN947VDF [cbuild_run]
242
+
0001585 I core 0: Cortex-M33 r0p4, pname: cm33_core0 [cbuild_run]
243
+
0001585 I core 1: Cortex-M33 r0p4, pname: cm33_core1 [cbuild_run]
244
+
0001585 I start-pname: cm33_core0 [cbuild_run]
245
+
0001600 I Semihost server started on port 4444 (core 0) [server]
246
+
0001636 I GDB server started on port 3333 (core 0) [gdbserver]
247
+
0001641 I Semihost server started on port 4445 (core 1) [server]
248
+
0001642 I GDB server started on port 3334 (core 1) [gdbserver]
249
+
0007560 I Client connected to port 3333! [gdbserver]
250
+
```
251
+
252
+
The `start-pname` indicates the processor that starts first and boots the system. A debug _launch_ command connects to this processor. Use a debug _attach_ command to connect to processors that are running. The picture below highlights the parts of the user interface that interact with processors.
253
+
254
+
1. Select a processor and **Start Debug**. This connects the debugger.
255
+
2.**Select a Processor** in the debug toolbar, or
256
+
3. Click in **CALL STACK** on a thread or function name to select a processor.
257
+
4. The selected processor is also shown in the **CPU Time Status bar**. This processor context is used in the VARIABLES and WATCH view.
> - The SEGGER JLink GDB server uses a _launch_ command to connect to a running processor whereas other GDB servers use an _attach_ command.
264
+
> - A [Disassembly View](#disassembly) opens only for a selected processor; otherwise the command is shown as disabled.
265
+
216
266
### Peripherals
217
267
218
-
The **Peripherals** view shows the device peripheral registers and allows you to change their values. It uses the CMSIS-SVD files that are provided by silicon vendors and distributed as part of the CMSIS Device Family Packs (DFP).
268
+
The **Peripherals** view shows the device peripheral registers and allows to change their values. It uses the CMSIS-SVD files that are provided by silicon vendors and distributed as part of the CMSIS Device Family Packs (DFP).
> - Enable the [VS Code setting](https://code.visualstudio.com/docs/configure/settings)**Features > Debug > Disassembly View: Show Source Code** to show assembler instructions interleaved with source code.
304
+
251
305
### Debug Console
252
306
253
307
The **Debug Console** enables viewing and interacting with the output of your code running in the debugger.
@@ -283,22 +337,26 @@ for the type `gdbtarget` which comes with the [CDT GDB Debug Adapter Extension](
283
337
This provider manages the use of tools shipped with the extension:
284
338
- If option `target`>`server` is set to `pyocd`, then it expands to the absolute path of the built-in pyOCD distribution.
285
339
- CMSIS specific _launch_ configuration items for the `*` debugger type, i.e. visible for all debugger types.
286
-
It depends on the actually used debug adapter type if this information is known and utilised.
287
-
288
-
> 📝 **Note:**
289
-
> The built-in version of pyOCD supports the command line option `--cbuild-run`, which isn't available
290
-
> in releases outside this extension.
340
+
It depends on the actually used debug adapter type if this information is known and utilized.
291
341
292
342
## Known Limitations and Workarounds
293
343
344
+
### Internal Errors on stepping through code
345
+
346
+
There is an [chip errata](https://developer.arm.com/documentation/SDEN1068427/latest/) that single stepping on Cortex-M7 r0p1 processors enters the pending exception handler incorrectly which may result in error messages. Check the processor revision that is shown at debug start in the DEBUG CONSOLE.
347
+
348
+
**Workaround/Solution**:
349
+
350
+
Some devices allow to stop timer interrupts with control registers. For the example the STM32 devices have `DbgMCU_APB1_Fz` registers. Stop all timers that are active in your application. This can be typially configured in the [`*.dbgconf` file](https://open-cmsis-pack.github.io/cmsis-toolbox/build-overview/#device-configuration) of your project.
351
+
294
352
### pyOCD fails to load `*.cbuild-run.yml` in the default configuration
295
353
296
354
When I use the default debug configuration for pyOCD, I get errors that pyOCD cannot find the solutions
297
355
`*.cbuild-run.yml` file.
298
356
299
357
**Possible Reasons**:
300
358
301
-
1. The application's CMSIS solution was initially built with a CMSIS-Toolbox version prior to v2.8.0, which is
359
+
1. The application's CMSIS solution was initially built with a CMSIS-Toolbox version prior to v2.8.0 which is
302
360
the first version to generate `*.cbuild-run.yml` files.
303
361
1. You are using an [Arm CMSIS Solution](https://marketplace.visualstudio.com/items?itemName=Arm.cmsis-csolution) extension
304
362
prior to v1.52.0 which is the first version to fully support the `${command:cmsis-csolution.getCbuildRunFile}` command.
**Possible Reason**: `arm-none-eabi-gdb` does not correctly load ELF program segments due to the way that
325
-
Arm Compiler 6 generates section and program header information when scatterloading is used.
383
+
Arm Compiler 6 generates section and program header information when scatter loading is used.
326
384
327
385
**Workaround**: You can generate a HEX file for the program download, and the ELF file for debug purposes only.
328
386
The following steps are required if you build a [CSolution](https://open-cmsis-pack.github.io/cmsis-toolbox/build-overview/)-based
@@ -371,8 +429,8 @@ warning: (Internal error: pc 0x8006a18 in read in CU, but not in symtab.)
371
429
**Possible Reason**: `arm-none-eabi-gdb` works best with DWARF debug information of standard version 5.
372
430
373
431
**Solution**: Make sure to build your application ELF file with DWARF version 5 debug information. Please refer to
374
-
your toolchain's user reference manual. This may require updates to all build tools, like the compiler and assembler.
375
-
For example, use `-gdwarf-5` for `armclang`.
432
+
your toolchain's user reference manual. This may require updates to all build tools like compiler and assembler.
433
+
For example use `-gdwarf-5` for `armclang`.
376
434
377
435
### Broken debug illusion
378
436
@@ -401,12 +459,12 @@ When starting a debug session, you might see this error:
401
459
402
460
**Possible reason**: A running instance of pyOCD
403
461
404
-
This error might occur if a previous debug session has ended prematurely and pyOCD has not exited. The orphaned instance
405
-
will still keep the port open (usually 3333), and thus you won't be able to open the port again in the new session.
462
+
This error might occur if a previous debug session has ended prematuerly and pyOCD has not exited. The orphaned instance
463
+
will still keep the port open (usually 3333) and thus you won't be able to open the port again in the new session.
406
464
407
465
**Solution**: Check open files and kill pyOCD
408
466
409
-
On Linux and macOS, you can check the running open files using the [`lsof`](https://de.wikipedia.org/wiki/Lsof) command:
467
+
On Linux and macOS you can check the running open files using the [`lsof`](https://de.wikipedia.org/wiki/Lsof) command:
410
468
411
469
```sh
412
470
sudo lsof -i -n -P | grep 3333
@@ -426,14 +484,24 @@ On Windows systems, use the
426
484
or the [Process Explorer](https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer) to find orphaned
427
485
processes.
428
486
487
+
## Requirements
488
+
489
+
- **GDB** supporting the GDB remote protocol. `arm-none-eabi-gdb` is included in CMSIS Debugger extension. To use a different GDB installation, enter the full path/filename to the executable in the `gdb:` node of the `launch.json` file.
490
+
491
+
- **pyOCD** for connecting to a target. pyOCD is included in CMSIS Debugger extension. To use a different pyOCD installation, enter the full path/filename to the executable in the `target:` `server:` node of the `launch.json` file.
492
+
493
+
- **SEGGER® J-LINK®** is an alternative GDB server for target connection. Install the latest
494
+
[J-LINK Software and Documentation Pack](https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack)
495
+
from [SEGGER](https://www.segger.com/). Ensure all required drivers and host platform-specific settings are done. The extension expects that the `PATH` environment variable is set to the J-Link executables.
496
+
429
497
## Related projects
430
498
431
499
Related open source projects are:
432
500
433
-
- [Open-CMSIS-Pack](https://www.open-cmsis-pack.org/) of which this extension is part.
434
-
- [Eclipse® CDT.cloud™](https://eclipse.dev/cdt-cloud/), an open-source project that hosts a number of components and
501
+
- The [Open-CMSIS-Pack](https://www.open-cmsis-pack.org/) project includes the CMSIS Debugger extension.
502
+
- [Eclipse® CDT.cloud™](https://eclipse.dev/cdt-cloud/) hosts a number of components and
435
503
best practices for building customizable web-based C/C++ tools.
436
-
- [pyOCD](https://pyocd.io/), a Python-based tool and API for debugging, programming, and exploring Arm Cortex®
504
+
- [pyOCD](https://pyocd.io/), a Pythonbased tool and API for debugging, programming, and exploring Arm Cortex®
437
505
microcontrollers.
438
506
- [GDB](https://www.sourceware.org/gdb/), the debugger of the GNU Project.
439
507
@@ -447,76 +515,3 @@ Related open source projects are:
447
515
- SEGGER and J-LINK are registered trademarks of SEGGER Microcontroller GmbH.
448
516
- Node.js is a registered trademark of the OpenJS Foundation.
449
517
- GDB and GCC are part of the GNU Project and are maintained by the Free Software Foundation.
450
-
451
-
-----
452
-
453
-
## Debug Setup
454
-
455
-
The debug setup requires a GDB installation supporting the GDB remote protocol and that can connect to a
456
-
GDB server like pyOCD.
457
-
458
-
This extension includes `arm-none-eabi-gdb`, which is used in the Arm CMSIS Debugger default debug configurations.
459
-
460
-
If you wish to use a different GDB installation, enter the full path to the executable (including the file name)
461
-
in the `gdb` setting in the `launch.json` file.
462
-
463
-
### pyOCD Debug Setup
464
-
465
-
This extension includes a pyOCD distribution, which is used by default.
466
-
467
-
If you wish to use a different pyOCD installation, enter the full path to the executable (including the file name)
468
-
in the `target`>`server` setting.
469
-
470
-
### SEGGER® J-LINK® Debug Setup
471
-
472
-
Install the latest
473
-
[J-LINK Software and Documentation Pack](https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack)
474
-
from [SEGGER](https://www.segger.com/). Ensure all required drivers and host platform-specific settings are done.
475
-
476
-
The extension expects the installation folder to be on your system `PATH` environment variable. Alternatively, update
477
-
your debug configuration's `target`>`server` setting to contain the full path to the J-LINK GDB server executable
478
-
(including the file name).
479
-
480
-
## Start Debugging
481
-
482
-
There are two ways to start a debug session:
483
-
484
-
1. If you have installed the CMSIS Solution extension, in the **CMSIS view**
0 commit comments