Skip to content

Commit 7db25da

Browse files
authored
README + cleanup (#15)
1 parent 4e3de50 commit 7db25da

8 files changed

Lines changed: 72 additions & 85 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ uv2csolution.log
7171
*.cbuild-idx.yml
7272
*.cbuild-run.yml
7373
*.cbuild-set.yml
74+
*.cbuild-pack.yml
7475

7576
# .vscode JSON and debug adapter files generated by CMSIS Solution
7677
.vscode/cmsis.json

.vscode/settings.json

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
{
22
"cmsis-csolution.environmentVariables": {
33
"ZEPHYR_BASE": "$HOME/zephyrproject/zephyr",
4-
"PATH": "$HOME/zephyrproject/.venv/bin",
4+
"PATH": "$HOME/zephyrproject/.venv/scripts",
55
"VIRTUAL_ENV": "$HOME/zephyrproject/.venv",
6-
},
7-
"debug.hideSlowPreLaunchWarning": true,
8-
"debug.showInStatusBar": "never",
9-
"memory-inspector.addressPadding": "32bit",
10-
"memory-inspector.groupings.groupsPerRow": "Autofit",
11-
"memory-inspector.groupings.MAUsPerGroup": 4,
12-
"memory-inspector.scrollingBehavior": "Auto-Append",
13-
"clangd.arguments": [
14-
"--compile-commands-dir=c:\\Kunden\\RTT_Examples\\CMSIS-Zephyr\\out\\blinky\\STM32H7B3I-DK\\Debug"
15-
],
16-
"cmsis-csolution.autoDebugLaunch": true
6+
}
177
}

README.md

Lines changed: 53 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
1-
# CMSIS-Zephyr
1+
# Using Zephyr with Keil Studio and Arm CMSIS Debugger
22

3-
This repository contains an exemplary CMSIS solution file that can be used to build two Zephyr basic examples on multiple
4-
different development boards. It can be easily adapted to other boards or examples. It uses Zephyr's `west` build
5-
system to create the executable file for an application and the
6-
[Arm CMSIS Debugger](https://marketplace.visualstudio.com/items?itemName=Arm.vscode-cmsis-debugger) to flash download
7-
and run the image on the target hardware.
3+
[<img src="./images/preview.png" alt="Overview of Zephyr capabilities in Keil Studio" width="330" height="205" align="left">](https://armkeil.blob.core.windows.net/developer/Files/videos/KeilStudio/CMSIS-Zephyr.mp4 "Overview of Zephyr capabilities in Keil Studio")
84

9-
> [!NOTE]
10-
> Make sure that you have installed Zephyr as explained in the
11-
> [Keil Studio documentation](https://mdk-packs.github.io/vscode-cmsis-solution-docs/zephyr.html).
5+
This repository contains two basic Zephyr examples configured in the [`zephyr.csolution.yml`](./zephyr.csolution.yml) file for multiple development boards. It uses [Keil Studio](https://marketplace.visualstudio.com/items?itemName=Arm.keil-studio-pack) and the Zephyr `west` build system to generate the application image.
126

13-
## Quick start
7+
The [Arm CMSIS Debugger](https://marketplace.visualstudio.com/items?itemName=Arm.vscode-cmsis-debugger) provides kernel-aware debugging and views for device peripherals, including the interrupt system. It is used to download and run the application on target hardware.
8+
9+
pyOCD supports with RTT and SystemView the analysis of the run-time behavior in CI workflows.
1410

15-
- Clone this repository onto your machine.
16-
- Open it in VS Code. It should install required extensions automatically.
17-
- Press the **Manage Solution Settings** button. In the dialog, select the target board and application.
18-
- Press the **Build solution** button to build the example.
19-
- Press the **Load & Debug application** button to start a debug session.
11+
Overall, Zephyr development is simplified by managing different build configurations, using an intuitive project tree, supporting multi-core configurations, and providing smart editor features such as code completion.
12+
13+
## Quick start
2014

21-
> [!NOTE]
22-
> - Check that the **Arm CMSIS Solution** extension is at least v1.66.0.
23-
> - If you are working under Windows, you will get the error `exec: "west": executable file not found in %PATH%` because in this example the path to the west build system is set up for Linux/Mac. Open the settings of the **Arm CMSIS Solution** extension and change the `PATH` environment variable of the **Workspace** from `$HOME/zephyrproject/.venv/bin` to `$HOME/zephyrproject/.venv/Scripts`.
15+
1. Install [Keil Studio for VS Code](https://marketplace.visualstudio.com/items?itemName=Arm.keil-studio-pack) from the VS Code marketplace.
16+
2. Follow the [Zephyr Getting Started Guide](https://docs.zephyrproject.org/latest/develop/getting_started/index.html) and install Zephyr in the directory `$HOME/zephyrproject`.
17+
3. Clone this repository (for example using [Git in VS Code](https://code.visualstudio.com/docs/sourcecontrol/intro-to-git)) or download the ZIP file. Then open the repository folder in VS Code.
18+
4. In VS Code, open the [CMSIS View](https://mdk-packs.github.io/vscode-cmsis-solution-docs/userinterface.html#2-main-area-of-the-cmsis-view) and then the [Manage Solution dialog](https://github.com/Open-CMSIS-Pack/vscode-cmsis-solution#manage-solution-view) to select the target board and one project.
19+
5. In the CMSIS view, use the [Action buttons](https://github.com/ARM-software/vscode-cmsis-csolution?tab=readme-ov-file#action-buttons) to build, load, and debug the example on your hardware.
2420

21+
> [!CAUTION]
22+
> If you see errors during `west build` (for example during `generating a build system`), the `west` installation or `PATH` is likely incorrect. Check [Settings](https://code.visualstudio.com/docs/configure/settings) - **Cmsis-Csolution:** Environment Variables.
23+
>
24+
> - For Windows, set `PATH` to `$HOME/zephyrproject/.venv/scripts`
25+
> - For Mac/Linux, set `PATH` to `$HOME/zephyrproject/.venv/bin`
26+
<!-- -->
27+
> [!TIP]
28+
> For more information, see the [Keil Studio documentation - Work with Zephyr applications](https://mdk-packs.github.io/vscode-cmsis-solution-docs/zephyr.html).
2529
26-
### Switch to a different board
30+
## Add another board
2731

28-
If you want to run the examples on a different board, simply extend the `zephyr.csolution.yml` file:
29-
- Search for your [development board](https://www.keil.arm.com/boards/) and select it.
30-
- Follow the link to the **Device** and its **CMSIS Pack** (DFP) and copy the text in the **Add to CMSIS Solution** box into the 'zephyr.csolution.yml' file into the 'packs:' list.
31-
- Go back to the board page and follow the link to the **CMSIS Pack** (BSP). Again, copy the text in the **Add to CMSIS Solution** box into the 'zephyr.csolution.yml' below the DFP.
32-
- Add a new [Target Type](https://open-cmsis-pack.github.io/cmsis-toolbox/YML-Input-Format/#target-types) and specify the board name after the '- type' token.
33-
- Specify the board vendor and boardname as well as the device vendor and the device name. Use the names from the CMSIS board and device pages.
32+
If you use a different board, extend the [`zephyr.csolution.yml`](zephyr.csolution.yml) file with:
3433

3534
```yml
3635
# List the packs that define the device and/or board.
@@ -41,12 +40,20 @@ If you want to run the examples on a different board, simply extend the `zephyr.
4140
# List different hardware targets that are used to deploy the solution.
4241
target-types:
4342
- type: SpecifyName
44-
board: Vendor::Boardname
45-
device: Vendor::Devicename
43+
board: Vendor::Board_name # Vendor is optional
44+
device: Vendor::Device_name # Vendor and Devicename is optional
4645
```
4746
48-
If your development board's [CMSIS board name](https://www.keil.arm.com/boards/) and
49-
[Zephyr board name](https://docs.zephyrproject.org/latest/boards/index.html#) do not match, you need to add the correct Zephyr board name with the variable `west-board:`. This variable may contain the `Board_Name`, or the `Board_Name/SoC_Name` or the `Board_Name/SoC_Name/Core_Name`, depending on the complexity of the board and SoC. See the paragraph **Supported Features** on the Zephyr board pages for more details.
47+
To find the packs open [https://www.keil.arm.com/boards/](https://www.keil.arm.com/boards/) and search for your board.
48+
49+
- `pack: Vendor::BSP` is listed under CMSIS Pack on the [Board](https://www.keil.arm.com/boards/) page.
50+
- `pack: Vendor::DFP` is listed under CMSIS Pack on the related [Device](https://www.keil.arm.com/devices/) page.
51+
52+
### Board name different in Zephyr and CMSIS Pack
53+
54+
Frequently the [Zephyr board name](https://docs.zephyrproject.org/latest/boards/index.html#) does not match. In this case add the variable `west-board:` as shown below.
55+
56+
Use [Zephyr - Supported Boards and Shields](https://docs.zephyrproject.org/latest/boards/index) and find your board. Under **Supported Features** the `board_name`, `board_name/soc_name` or `board_name/soc_name/core_name` is listed that is the specified with `west-board:` .
5057

5158
```yml
5259
target-types:
@@ -57,17 +64,13 @@ If your development board's [CMSIS board name](https://www.keil.arm.com/boards/)
5764
- west-board: disco_l475_iot1/stm32l475xx
5865
```
5966

60-
> [!NOTE]
61-
> Make sure to delete the previous `/out` and `/tmp` directories before saving the updated `*.csolution.yml` file,
62-
> otherwise the solution might not load correctly.
67+
## Zephyr Terminal
6368

64-
## Use the Zephyr Terminal in CMSIS View
69+
![ZephyrTerminal](./images/ZephyrTerminal.png)
6570

66-
![ZephyrTerminal](video/ZephyrTerminal.png)
71+
Keil Studio includes a built-in **Zephyr Terminal** for running `west` commands in the IDE. When you open it, it configures for the selected project with the working directory and Zephyr environment.
6772

68-
Keil Studio includes a built-in **Zephyr Terminal** that runs `west` commands directly inside the IDE. When the terminal opens, it automatically sets the example build folder as the working directory and configures the Zephyr environment.
69-
70-
Example `west` commands:
73+
**Example `west` commands:**
7174

7275
```bash
7376
# Build the project
@@ -80,6 +83,17 @@ west build -t guiconfig
8083
west build -t ram_report
8184
```
8285

83-
## Introduction video
86+
## RTT and SEGGER SystemView
87+
88+
SEGGER Real-Time Transfer (RTT) enables real-time data exchange between a target device and a host debugger without requiring an additional UART interface. RTT also is the transport mechanism used for SystemView.
89+
90+
RTT and SystemView is integrated in Zephyr and enabled in the [`zephyr.csolution.yml`](zephyr.csolution.yml) file with the `west-defs` under the `build-type: Debug-RTT`. RTT and SystemView are currently implemented for CI testing and can be used with pyOCD as shown below.
91+
92+
**Example invocation for `target-type: STM32H7B3I-DK`:
93+
94+
```bash
95+
pyocd load --cbuild-run <path>\out\zephyr+STM32H7B3I-DK.cbuild-run.yml
96+
pyocd run --cbuild-run <path>\out\zephyr+STM32H7B3I-DK.cbuild-run.yml
97+
```
8498

85-
[![Keil Studio Zephyr capabilities Video](./video/preview.png)](https://armkeil.blob.core.windows.net/developer/Files/videos/KeilStudio/CMSIS-Zephyr.mp4)
99+
The pyOCD `run command` outputs now test messages to the debug console and collects the file `out\zephyr+STM32H7B3I-DK.SVdat` that can be analyzed with [SEGGER SystemView](https://www.segger.com/products/development-tools/systemview/).

images/preview.png

54.6 KB
Loading

video/preview.png

-209 KB
Binary file not shown.

zephyr.cbuild-pack.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

zephyr.csolution.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ solution:
2222
target-set:
2323
- set:
2424
images:
25-
- project-context: blinky.Debug
25+
- project-context: blinky.Debug-RTT
2626
debugger:
2727
name: ST-Link@pyOCD
2828
protocol: swd
@@ -73,13 +73,21 @@ solution:
7373
- CONFIG_DEBUG_THREAD_INFO: y
7474
- CONFIG_THREAD_STACK_INFO: n
7575
- CONFIG_DEBUG_OPTIMIZATIONS: y
76-
# uncomment the following lines to enable RTT console and SystemView tracing
77-
# - CONFIG_USE_SEGGER_RTT: y
78-
# - CONFIG_RTT_CONSOLE: y
79-
# - CONFIG_UART_CONSOLE: n
80-
# - CONFIG_TRACING: y
81-
# - CONFIG_SEGGER_SYSTEMVIEW: y
82-
# - CONFIG_SEGGER_SYSVIEW_RTT_CHANNEL: 1
76+
77+
- type: Debug-RTT
78+
west-defs:
79+
- CONFIG_DEBUG: y
80+
- CONFIG_DEBUG_THREAD_INFO: y
81+
- CONFIG_THREAD_STACK_INFO: n
82+
- CONFIG_DEBUG_OPTIMIZATIONS: y
83+
# these options enable RTT console and SystemView
84+
- CONFIG_USE_SEGGER_RTT: y
85+
- CONFIG_RTT_CONSOLE: y
86+
- CONFIG_UART_CONSOLE: n
87+
- CONFIG_TRACING: y
88+
- CONFIG_SEGGER_SYSTEMVIEW: y
89+
- CONFIG_SEGGER_SYSVIEW_RTT_CHANNEL: 1
90+
8391
- type: Release
8492
west-defs:
8593
- CONFIG_SIZE_OPTIMIZATIONS: y

0 commit comments

Comments
 (0)