Skip to content
Open
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
16 changes: 8 additions & 8 deletions .../[email protected] → .../[email protected]
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.env": {
"ZEPHYR_BASE": "$HOME/zephyrproject/zephyr",
"PATH": "$HOME/zephyrproject/.venv/bin",
"VIRTUAL_ENV": "$HOME/zephyrproject/.venv",
},
"debug.hideSlowPreLaunchWarning": true,
"debug.showInStatusBar": "never"
}
102 changes: 47 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,30 @@ and run the image on the target hardware.
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)
- Python (min. version 3.10, see warning below)
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)
4. Install Zephyr on your machine (refer to [Linux and macOS](#linux-and-macos)/[Windows](#windows)).
5. [Work with the example](#work-with-the-example)

> [!WARNING]
> On Windows, do not install Python 3.14 or above as the Python package `windows-curses` is not yet available!

## Zephyr installation

This chapter contains installation instructions for [Linux and macOS](#linux-and-macos) and [Windows](#windows)).

If you have a Zephyr environment already set up on your computer, you can skip this step. Make sure to check the
[environment settings](#environment-settings).

### Linux and macOS

- In your home directory, create a `zephyrproject` directory and change into it:

```sh
mkdir zephyrproject
cd zephyrproject
```

- Create a new virtual environment:

```sh
Expand All @@ -31,10 +47,8 @@ and run the image on the target hardware.
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.
Once activated, your shell will be prefixed with (.venv). The virtual environment can be deactivated at any time by
running `deactivate`.

- Install west:

Expand All @@ -45,7 +59,7 @@ and run the image on the target hardware.
- Get the Zephyr source code:

```sh
west init
west init
west update
```

Expand All @@ -55,14 +69,22 @@ and run the image on the target hardware.
west packages pip --install
```

Continue with [environment settings](#environment-settings).

### Windows

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

- Create a `zephyrproject` directory and change into it:

```sh
mkdir zephyrproject
cd zephyrproject
```

- Create a new virtual environment:

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

Expand All @@ -72,10 +94,8 @@ and run the image on the target hardware.
.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.
Once activated your shell will be prefixed with (.venv). The virtual environment can be deactivated at any time by
running deactivate.

- Install west:

Expand All @@ -96,24 +116,26 @@ and run the image on the target hardware.
west packages pip --install
```

### Work with the example
Continue with [environment settings](#environment-settings).

> [!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.
### Environment settings

- From the same terminal, start VS Code:
This repository contains a `.vscode/settings.json` file with the required settings for the Python virtual environment.
If you have followed the instructions without changing folder names, it should work out-of-the-box. If you have created
the Zephyr environment is a different location, adapt the paths to your needs.

```sh
code .
```
## Work with the example

- In the CMSIS view, click on **...**, use **Select Active Solution from workspace**, and choose "zephyr".
- Open the folder 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.

> [!NOTE]
> Check that the **Arm CMSIS Solution** is at least v1.64.0.

## Switch to a different board
### 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 +169,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