This repository contains an exemplary CMSIS solution file that can be used to build two Zephyr basic examples on
Alif development boards. It can be easily adapted to other boards or examples. It uses Zephyr's west build
system to create the executable file for an application and the
Arm CMSIS Debugger to flash download
and run the image on the target hardware.
- Make sure that your host OS is up-to-date.
- Install the following dependencies using your favorite package manager:
- Cmake (min. version 3.20.5)
- Python (versions 3.10 - 3.13, see warning below)
- Clone this repository onto your machine.
- Install Zephyr on your machine (refer to Linux and macOS/Windows).
- Work with the example
Warning
Do not install Python 3.14 or above as the Python package windows-curses is not yet available!
This chapter contains installation instructions for Linux and macOS and Windows).
-
In your home directory, create a
sdk-alifdirectory and change into it:mkdir sdk-alif cd sdk-alif -
Create a new virtual environment:
python3 -m venv .venv
-
Activate the virtual environment:
source .venv/bin/activateOnce activated, your shell will be prefixed with (.venv). The virtual environment can be deactivated at any time by running
deactivate. -
Install west:
pip install west
-
Get the Zephyr source code using the Alif SDK:
west init -m https://github.com/alifsemi/sdk-alif.git --mr v2.0.0 west update
-
Install Python dependencies using west packages:
west packages pip --install
-
Set the
ZEPHYR_BASEenvironment variable to the/sdk-alif/zephyrfolder:Linux
(echo; echo 'export ZEPHYR_BASE="/home/.../sdk-alif/zephyr"') >> ~/.bashrc source ~/.bashrc
macOS
(echo; echo 'export ZEPHYR_BASE="/usr/.../sdk-alif/zephyr"') >> ~/.zshrc source ~/.zshrc
-
In your
.bashrcor.zshrc, source the vritual environment:source /Users/user/sdk-alif/.venv/bin/activate
Make sure to fully quit VS Code, not just close the window. Otherwise, the changes won’t be applied.
-
Open a
cmd.exeterminal window as a regular user. -
Create a
sdk-alifdirectory and change into it:mkdir sdk-alif cd sdk-alif -
Create a new virtual environment:
python -m venv .venv
-
Activate the virtual environment:
.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.
-
Install west:
pip install west
-
Get the Zephyr source code using the Alif SDK:
west init -m https://github.com/alifsemi/sdk-alif.git --mr v2.0.0 west update
-
Install Python dependencies using west packages.
west packages pip --install
-
Open the Environment Variables and
-
Set the
ZEPHYR_BASEenvironment variable toC:\...\sdk-alif\zephyrin -
Set the Windows path to the virtual environment, for example
C:\...\sdk-alif\.venv\Scripts. Make sure that this path is used first.
-
-
Restart the VS Code.
The CMSIS Solution Extension version 1.64 provides a Settings dialog that configures the Zephyr environment under Cmsis-csolution: Environment Variables. The file settings.json stores these settings and can be user or workspace specific.
Example settings.json file
"cmsis-csolution.environmentVariables": {
"PATH": "C:\\...\\sdk-alif\\.venv\\Scripts",
"VIRTUAL_ENV": "C:\\...\\sdk-alif\\.venv",
"ZEPHYR_BASE": "C:\\...\\sdk-alif\\zephyr"
},Before flashing this example on the AppKit E7 board it is required to program the ATOC of the device using the Alif SETOOLS. This process only has to be done once for each single- or dual-core project.
Refer to the section Usage in the overview page of the Alif Semiconductor Ensemble DFP/BSP for information on how to setup these tools.
In VS Code use the menu command "Terminal - Run Tasks" and execute:
- "Alif: Install M55_HE and M55_HP debug stubs (dual core configuration)"
| Example name | Description |
|---|---|
| IPM_ARM_MHUv2 | This example demonstrates the dual-core debugging and inter-core communication between two Cortex-M55 cores using Arm's Message Handling Unit v2 (MHUv2) . Also, it showcases the use of Zephyr's Inter-Processor Mailbox (IPM) API to exchange messages and trigger interrupts between cores. More details in Alif-Zephyr-SDK/ipm_arm_mhuv2. |
| LPI2C | LPI2C (Low Power Inter-Integrated Circuit) is a low-power version of the standard I2C bus controller. This example uses two threads to emulate an I2C master and slave communicating through the LPI2C driver. All data transfers occur internally via hardware loopback. More details in Alif-Zephyr-SDK/lpi2c. |
- Open the cloned repository's folder in VS Code.
- In the CMSIS view, click on ..., use Select Active Solution from workspace, and choose an option.
- 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:
-
Start the M55_HE CMSIS_DAP@pyOCD (launch) debug session first, followed by M55_HP CMSIS_DAP@pyOCD (attach).
-
After starting the second debug session, the program will halt at
cpu_idle.S. This occurs because the second core still remains in its idle loop until a valid entry point s reached. To resolve this, add the following command under the M55_HP CMSIS_DAP@pyOCD (attach) section in the launch.json file:"initCommands": [ "monitor reset halt", "tbreak main" ]
-
And remember to set
updateConfiguration:tomanualin order to prevent your settings from being overwritten.