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
Added multicore, CPU Time; other corrections (#489)
* Added multicore, CPU Time, and workaround for issue #159. Several minor corrections
* Added Note for issue #374
---------
Co-authored-by: Jens Reinecke <jens.reinecke@arm.com>
Copy file name to clipboardExpand all lines: README.md
+88-95Lines changed: 88 additions & 95 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
The Arm® CMSIS Debugger extension pack is a comprehensive debug platform for Arm Cortex-M processor-based devices that uses the GDB/MI protocol.
8
8
9
-
- Supports single and multi-core processor systems.
9
+
- Supports single and [multi-core](#multi-core-debug) processor systems.
10
10
- Built-in RTOS kernel support for FreeRTOS, RTX, ThreadX, and Zephyr.
11
11
- Wide debug adapter support for CMSIS-DAP (ULink, MCULink, NuLink, etc.), JLink, and ST-Link.
12
12
- Can be combined with other VS Code debug extensions, such as those for Linux application debugging.
@@ -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,62 @@ 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).
227
+
228
+

229
+
230
+
> 📝 **Notes:**
231
+
> - The first program stop (typically at function `main`) is the initial reference time (zero point).
232
+
> -`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.
233
+
> - Each processor in a multi-processor system has and independent `DWT->CYCCNT` register.
234
+
235
+
### Multi-Core Debug
236
+
237
+
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.
238
+
239
+
```txt
240
+
0000680 I Target device: MCXN947VDF [cbuild_run]
241
+
0001585 I core 0: Cortex-M33 r0p4, pname: cm33_core0 [cbuild_run]
242
+
0001585 I core 1: Cortex-M33 r0p4, pname: cm33_core1 [cbuild_run]
243
+
0001585 I start-pname: cm33_core0 [cbuild_run]
244
+
0001600 I Semihost server started on port 4444 (core 0) [server]
245
+
0001636 I GDB server started on port 3333 (core 0) [gdbserver]
246
+
0001641 I Semihost server started on port 4445 (core 1) [server]
247
+
0001642 I GDB server started on port 3334 (core 1) [gdbserver]
248
+
0007560 I Client connected to port 3333! [gdbserver]
249
+
```
250
+
251
+
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.
252
+
253
+
1. Select a processor and **Start Debug**. This connects the debugger.
254
+
2.**Select a Processor** in the debug toolbar, or
255
+
3. Click in **CALL STACK** on a thread or function name to select a processor.
256
+
4. The selected processor is also shown **CPU Time Status bar**. This processor context is used in the VARIABLES or WATCH view.
257
+
258
+

259
+
260
+
> 📝 **Notes:**
261
+
> - The SEGGER JLink GDB server uses a *launch* command to connect to a running processor whereas other GDB servers use a *attach* command.
262
+
> - A [Disassembly View](#disassembly) opens only for a selected processor; otherwise the command is shown as disabled.
263
+
216
264
### Peripherals
217
265
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).
266
+
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.
301
+
251
302
### Debug Console
252
303
253
304
The **Debug Console** enables viewing and interacting with the output of your code running in the debugger.
@@ -283,22 +334,26 @@ for the type `gdbtarget` which comes with the [CDT GDB Debug Adapter Extension](
283
334
This provider manages the use of tools shipped with the extension:
284
335
- If option `target`>`server` is set to `pyocd`, then it expands to the absolute path of the built-in pyOCD distribution.
285
336
- 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.
337
+
It depends on the actually used debug adapter type if this information is known and utilized.
291
338
292
339
## Known Limitations and Workarounds
293
340
341
+
### Internal Errors on stepping thru code
342
+
343
+
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.
344
+
345
+
**Workaround/Solution**:
346
+
347
+
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.
348
+
294
349
### pyOCD fails to load `*.cbuild-run.yml` in the default configuration
295
350
296
351
When I use the default debug configuration for pyOCD, I get errors that pyOCD cannot find the solutions
297
352
`*.cbuild-run.yml` file.
298
353
299
354
**Possible Reasons**:
300
355
301
-
1. The application's CMSIS solution was initially built with a CMSIS-Toolbox version prior to v2.8.0, which is
356
+
1. The application's CMSIS solution was initially built with a CMSIS-Toolbox version prior to v2.8.0 which is
302
357
the first version to generate `*.cbuild-run.yml` files.
303
358
1. You are using an [Arm CMSIS Solution](https://marketplace.visualstudio.com/items?itemName=Arm.cmsis-csolution) extension
304
359
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.
380
+
Arm Compiler 6 generates section and program header information when scatter loading is used.
326
381
327
382
**Workaround**: You can generate a HEX file for the program download, and the ELF file for debug purposes only.
328
383
The following steps are required if you build a [CSolution](https://open-cmsis-pack.github.io/cmsis-toolbox/build-overview/)-based
@@ -371,8 +426,8 @@ warning: (Internal error: pc 0x8006a18 in read in CU, but not in symtab.)
371
426
**Possible Reason**: `arm-none-eabi-gdb` works best with DWARF debug information of standard version 5.
372
427
373
428
**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`.
429
+
your toolchain's user reference manual. This may require updates to all build tools like compiler and assembler.
430
+
For example use `-gdwarf-5` for `armclang`.
376
431
377
432
### Broken debug illusion
378
433
@@ -401,12 +456,12 @@ When starting a debug session, you might see this error:
401
456
402
457
**Possible reason**: A running instance of pyOCD
403
458
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.
459
+
This error might occur if a previous debug session has ended prematuerly and pyOCD has not exited. The orphaned instance
460
+
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
461
407
462
**Solution**: Check open files and kill pyOCD
408
463
409
-
On Linux and macOS, you can check the running open files using the [`lsof`](https://de.wikipedia.org/wiki/Lsof) command:
464
+
On Linux and macOS you can check the running open files using the [`lsof`](https://de.wikipedia.org/wiki/Lsof) command:
410
465
411
466
```sh
412
467
sudo lsof -i -n -P | grep 3333
@@ -426,14 +481,24 @@ On Windows systems, use the
426
481
or the [Process Explorer](https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer) to find orphaned
427
482
processes.
428
483
484
+
## Requirements
485
+
486
+
- **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.
487
+
488
+
- **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.
489
+
490
+
- **SEGGER® J-LINK®** is an alternative GDB server for target connection. Install the latest
491
+
[J-LINK Software and Documentation Pack](https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack)
492
+
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.
493
+
429
494
## Related projects
430
495
431
496
Related open source projects are:
432
497
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
498
+
- The [Open-CMSIS-Pack](https://www.open-cmsis-pack.org/) project includes the CMSIS Debugger extension.
499
+
- [Eclipse® CDT.cloud™](https://eclipse.dev/cdt-cloud/) hosts a number of components and
435
500
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®
501
+
- [pyOCD](https://pyocd.io/), a Pythonbased tool and API for debugging, programming, and exploring Arm Cortex®
437
502
microcontrollers.
438
503
- [GDB](https://www.sourceware.org/gdb/), the debugger of the GNU Project.
439
504
@@ -448,75 +513,3 @@ Related open source projects are:
448
513
- Node.js is a registered trademark of the OpenJS Foundation.
449
514
- GDB and GCC are part of the GNU Project and are maintained by the Free Software Foundation.
450
515
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