Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .cmsis/zephyr+B-U585I-IOT02A.dbgconf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// File: STM32U535_545_575_585_59x_5Ax.dbgconf
// Version: 1.0.1
// Version: 1.0.0
// Note: refer to STM32U5 reference manual (RM0456)
// refer to STM32U535xx datasheet (DS14217)
// STM32U545xx datasheet (DS14216)
Expand Down Expand Up @@ -29,7 +29,7 @@ DbgMCU_CR = 0x00000006;
// <o.1> DBG_TIM3_STOP <i> TIM3 is frozen while CPU is in debug mode
// <o.0> DBG_TIM2_STOP <i> TIM2 is frozen while CPU is in debug mode
// </h>
DbgMCU_APB1L_Fz = 0x0060183F;
DbgMCU_APB1L_Fz = 0x00000000;

// <h> Debug MCU APB1H freeze register (DBGMCU_APB1HFZR)
// <i> Reserved bits must be kept at reset value
Expand All @@ -40,7 +40,7 @@ DbgMCU_APB1L_Fz = 0x0060183F;
// <o.5> DBG_LPTIM2_STOP <i> LPTIM2 is frozen while CPU is in debug mode
// <o.1> DBG_I2C4_STOP <i> I2C4 is frozen while CPU is in debug mode
// </h>
DbgMCU_APB1H_Fz = 0x000000E2;
DbgMCU_APB1H_Fz = 0x00000000;

// <h> Debug MCU APB2 freeze register (DBGMCU_APB2FZR)
// <i> Reserved bits must be kept at reset value
Expand All @@ -50,7 +50,7 @@ DbgMCU_APB1H_Fz = 0x000000E2;
// <o.13> DBG_TIM8_STOP <i> TIM8 is frozen while CPU is in debug mode
// <o.11> DBG_TIM1_STOP <i> TIM1 is frozen while CPU is in debug mode
// </h>
DbgMCU_APB2_Fz = 0x00072800;
DbgMCU_APB2_Fz = 0x00000000;

// <h> Debug MCU APB3 freeze register (DBGMCU_APB3FZR)
// <i> Reserved bits must be kept at reset value
Expand All @@ -60,7 +60,7 @@ DbgMCU_APB2_Fz = 0x00072800;
// <o.17> DBG_LPTIM1_STOP <i> LPTIM1 is frozen while CPU is in debug mode
// <o.10> DBG_I2C3_STOP <i> I2C3 is frozen while CPU is in debug mode
// </h>
DbgMCU_APB3_Fz = 0x000E0400;
DbgMCU_APB3_Fz = 0x00000000;

// <h> Debug MCU AHB1 freeze register (DBGMCU_AHB1FZR)
// <i> Reserved bits must be kept at reset value
Expand All @@ -81,7 +81,7 @@ DbgMCU_APB3_Fz = 0x000E0400;
// <o.1> DBG_GPDMA1_STOP <i> GPDMA channel 1 is frozen while CPU is in debug mode
// <o.0> DBG_GPDMA0_STOP <i> GPDMA channel 0 is frozen while CPU is in debug mode
// </h>
DbgMCU_AHB1_Fz = 0x0000FFFF;
DbgMCU_AHB1_Fz = 0x00000000;

// <h> Debug MCU AHB3 freeze register (DBGMCU_AHB3FZR)
// <i> Reserved bits must be kept at reset value
Expand All @@ -90,12 +90,12 @@ DbgMCU_AHB1_Fz = 0x0000FFFF;
// <o.1> DBG_LPDMA1_STOP <i> LPDMA channel 1 is frozen while CPU is in debug mode
// <o.0> DBG_LPDMA0_STOP <i> LPDMA channel 0 is frozen while CPU is in debug mode
// </h>
DbgMCU_AHB3_Fz = 0x0000000F;
DbgMCU_AHB3_Fz = 0x00000000;

// <h> TPIU Pin Routing
// <o0> TRACECLK
// <i> ETM Trace Clock
// <0x00040002=> Pin PE2
// <0x0002000A=> Pin PE2
// <0x00000008=> Pin PA8
// <i> TRACECLK: Pin PE2
// <o1> TRACED0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// File: STM32U535_545_575_585_59x_5Ax.dbgconf
// Version: 1.0.1
// Version: 1.0.0
// Note: refer to STM32U5 reference manual (RM0456)
// refer to STM32U535xx datasheet (DS14217)
// STM32U545xx datasheet (DS14216)
Expand Down Expand Up @@ -29,7 +29,7 @@ DbgMCU_CR = 0x00000006;
// <o.1> DBG_TIM3_STOP <i> TIM3 is frozen while CPU is in debug mode
// <o.0> DBG_TIM2_STOP <i> TIM2 is frozen while CPU is in debug mode
// </h>
DbgMCU_APB1L_Fz = 0x0060183F;
DbgMCU_APB1L_Fz = 0x00000000;

// <h> Debug MCU APB1H freeze register (DBGMCU_APB1HFZR)
// <i> Reserved bits must be kept at reset value
Expand All @@ -40,7 +40,7 @@ DbgMCU_APB1L_Fz = 0x0060183F;
// <o.5> DBG_LPTIM2_STOP <i> LPTIM2 is frozen while CPU is in debug mode
// <o.1> DBG_I2C4_STOP <i> I2C4 is frozen while CPU is in debug mode
// </h>
DbgMCU_APB1H_Fz = 0x000000E2;
DbgMCU_APB1H_Fz = 0x00000000;

// <h> Debug MCU APB2 freeze register (DBGMCU_APB2FZR)
// <i> Reserved bits must be kept at reset value
Expand All @@ -50,7 +50,7 @@ DbgMCU_APB1H_Fz = 0x000000E2;
// <o.13> DBG_TIM8_STOP <i> TIM8 is frozen while CPU is in debug mode
// <o.11> DBG_TIM1_STOP <i> TIM1 is frozen while CPU is in debug mode
// </h>
DbgMCU_APB2_Fz = 0x00072800;
DbgMCU_APB2_Fz = 0x00000000;

// <h> Debug MCU APB3 freeze register (DBGMCU_APB3FZR)
// <i> Reserved bits must be kept at reset value
Expand All @@ -60,7 +60,7 @@ DbgMCU_APB2_Fz = 0x00072800;
// <o.17> DBG_LPTIM1_STOP <i> LPTIM1 is frozen while CPU is in debug mode
// <o.10> DBG_I2C3_STOP <i> I2C3 is frozen while CPU is in debug mode
// </h>
DbgMCU_APB3_Fz = 0x000E0400;
DbgMCU_APB3_Fz = 0x00000000;

// <h> Debug MCU AHB1 freeze register (DBGMCU_AHB1FZR)
// <i> Reserved bits must be kept at reset value
Expand All @@ -81,7 +81,7 @@ DbgMCU_APB3_Fz = 0x000E0400;
// <o.1> DBG_GPDMA1_STOP <i> GPDMA channel 1 is frozen while CPU is in debug mode
// <o.0> DBG_GPDMA0_STOP <i> GPDMA channel 0 is frozen while CPU is in debug mode
// </h>
DbgMCU_AHB1_Fz = 0x0000FFFF;
DbgMCU_AHB1_Fz = 0x00000000;

// <h> Debug MCU AHB3 freeze register (DBGMCU_AHB3FZR)
// <i> Reserved bits must be kept at reset value
Expand All @@ -90,12 +90,12 @@ DbgMCU_AHB1_Fz = 0x0000FFFF;
// <o.1> DBG_LPDMA1_STOP <i> LPDMA channel 1 is frozen while CPU is in debug mode
// <o.0> DBG_LPDMA0_STOP <i> LPDMA channel 0 is frozen while CPU is in debug mode
// </h>
DbgMCU_AHB3_Fz = 0x0000000F;
DbgMCU_AHB3_Fz = 0x00000000;

// <h> TPIU Pin Routing
// <o0> TRACECLK
// <i> ETM Trace Clock
// <0x00040002=> Pin PE2
// <0x0002000A=> Pin PE2
// <0x00000008=> Pin PA8
// <i> TRACECLK: Pin PE2
// <o1> TRACED0
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ uv2csolution.log
.vscode/cmsis.json
.vscode/launch.json
.vscode/tasks.json
.vscode/settings.json
.cmd.jlink

# legacy intermediate project file
Expand Down
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"arm.keil-studio-pack",
"mcu-debug.rtos-views"
]
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"cmsis-csolution.environmentVariables": {
"ZEPHYR_BASE": "$HOME/zephyrproject/zephyr",
"PATH": "$HOME/zephyrproject/.venv/bin",
"VIRTUAL_ENV": "$HOME/zephyrproject/.venv",
},
"debug.hideSlowPreLaunchWarning": true,
"debug.showInStatusBar": "never"
}
143 changes: 11 additions & 132 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,114 +6,23 @@ system to create the executable file for an application and the
[Arm CMSIS Debugger](https://marketplace.visualstudio.com/items?itemName=Arm.vscode-cmsis-debugger) to flash download
and run the image on the target hardware.

## Quick start

1. Make sure that your host OS is up-to-date.
2. Install the following dependencies using your favorite package manager:
- Cmake (min. version 3.20.5)
- Python (min. version 3.10)
3. Clone this repository onto your machine.
4. In a terminal, change the current directory to `./CMSIS-Zephyr`.
5. Install Zephyr locally (refer to [Linux and macOS](#linux-and-macos)/[Windows](#windows)).
6. [Work with the example](#work-with-the-example)

### Linux and macOS

- Create a new virtual environment:

```sh
python3 -m venv .venv
```

- Activate the virtual environment:

```sh
source .venv/bin/activate
```

Once activated your shell will be prefixed with (.venv). The virtual environment can be deactivated at any time by running deactivate.

> [!Note]
> Remember to activate the virtual environment every time you start working.
- Install west:

```sh
pip install west
```

- Get the Zephyr source code:

```sh
west init
west update
```

- Install Python dependencies using west packages:

```sh
west packages pip --install
```

### Windows

- Open a `cmd.exe` terminal window as a regular user.

- Create a new virtual environment:

```sh
cd %HOMEPATH%
python -m venv .venv
```

- Activate the virtual environment:

```sh
.venv\Scripts\activate.bat
```

Once activated your shell will be prefixed with (.venv). The virtual environment can be deactivated at any time by running deactivate.

> [!Note]
> Remember to activate the virtual environment every time you start working.
- Install west:

```sh
pip install west
```

- Get the Zephyr source code:

```sh
west init
west update
```

- Install Python dependencies using west packages.

```sh
west packages pip --install
```

### Work with the example

> [!NOTE]
> - Make sure that the virtual environment is still sourced.
> - Starting VS Code from here ensures that the virtual environment is present in your VS Code instance.
- From the same terminal, start VS Code:
> Make sure that you have installed Zephyr as explained in the
> [Keil Studio documentation](https://mdk-packs.github.io/vscode-cmsis-solution-docs/zephyr.html).
```sh
code .
```
## Quick start

- In the CMSIS view, click on **...**, use **Select Active Solution from workspace**, and choose "zephyr".
- Clone this repository onto your machine.
- Open it in VS Code. It should install required extensions automatically.
- In the CMSIS view, click on **...**, use **Open Solution in Workspace**, and choose "zephyr".
- Press the **Manage Solution Settings** button. In the dialog, select the target board and application.
- Press the **Build solution** button to build the example.
- Start the CMSIS Debugger.
- Press the **Load & Debug application** button to start a debug session.

## Switch to a different board
> [!NOTE]
> Check that the **Arm CMSIS Solution** extension is at least v1.64.0.
### Switch to a different board

If you want to run the examples on a different board, simply edit the `Examples/Blinky/blinky.csolution.yml` or
`Examples/Threads/threads.csolution.yml` files:
Expand Down Expand Up @@ -147,33 +56,3 @@ Zephyr board name like this:
> [!NOTE]
> Make sure to delete the previous `/out` and `/tmp` directories before saving the updated `*.csolution.yml` file,
> otherwise the solution might not load correctly.

## Using an existing Zephyr environment

If you have previously set up your Zephyr environment, set the `ZEPHYR_BASE` environment variable to the
`/zephyrproject/zephyr` folder:

**Linux**

```sh
(echo; echo 'export ZEPHYR_BASE="/home/.../zephyrproject/zephyr"') >> ~/.bashrc
source ~/.bashrc
```

**macOS**

```sh
(echo; echo 'export ZEPHYR_BASE="/usr/.../zephyrproject/zephyr"') >> ~/.zshrc
source ~/.zshrc
```

**Windows**

Set `ZEPHYR_BASE` to `C:\...\Zephyr-Workspace\zephyr` in
[Environment Variables](https://learn.microsoft.com/en-us/answers/questions/4330946/change-system-variables-on-windows-11).

Now, open a terminal window and continue with the fourth item in the [Quick start](#quick-start) section.

> [!NOTE]
> You need to adapt the paths to the examples in the `zephyr.csolution.yml` file to the location of your Zephyr
> installation (change `app-path:`).
7 changes: 7 additions & 0 deletions blinky/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(blinky)

target_sources(app PRIVATE src/main.c)
Loading