Skip to content

Commit 09f168f

Browse files
Merge pull request #3329 from jasonrandrews/review2
Tech review of Zephyr on Corstone-320 MPS4
2 parents a29b785 + a521e5c commit 09f168f

4 files changed

Lines changed: 348 additions & 108 deletions

File tree

content/learning-paths/embedded-and-microcontrollers/zephyr_cs320_mps4/_index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ prerequisites:
1919
- Basic familiarity with embedded C programming
2020
- Basic knowledge of Zephyr RTOS
2121
- A Corstone-320 MPS4 FPGA development board
22-
- A Linux development environment, for example Ubuntu 20.04 or later
23-
- Git
24-
- Python 3.8 or higher
22+
- A Linux development environment, for example Ubuntu 22.04 or later
23+
- Git and Python
2524

2625
author: Sue Wu
2726

content/learning-paths/embedded-and-microcontrollers/zephyr_cs320_mps4/how-to-1.md

Lines changed: 136 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,141 @@ weight: 2
66
layout: learningpathall
77
---
88

9-
## Set up the development environment
10-
This section describes the tools and environment you need for Corstone-320 MPS4 development with Zephyr.
9+
## Set up the development environment
1110

12-
### Install the Zephyr build tools
11+
Before you build Zephyr for the Corstone-320 MPS4 platform, you need to install the required host packages, initialize a Zephyr workspace, and install the Arm GNU Toolchain.
1312

14-
- Follow the Zephyr Project [Getting Started Guide — Zephyr Project Documentation](https://docs.zephyrproject.org/latest/develop/getting_started/index.html) to install the required packages and set up the Zephyr workspace.
15-
- Download and install the Arm GNU Toolchain from the [Arm GNU Toolchain downloads page](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads). Select the `arm-none-eabi` package for your host architecture: `aarch64-arm-none-eabi` for aarch64 Linux, or `x86_64-arm-none-eabi` for x86_64 Linux.
13+
## Install host dependencies
14+
15+
Update your package list and install the packages that Zephyr requires. Select the tab for your host architecture:
16+
17+
{{< tabpane-normal >}}
18+
{{< tab header="aarch64" >}}
19+
```bash
20+
sudo apt update && sudo apt upgrade -y
21+
sudo apt install -y --no-install-recommends git cmake ninja-build gperf \
22+
ccache dfu-util device-tree-compiler wget python3-dev python3-venv python3-tk \
23+
xz-utils file make gcc libsdl2-dev libmagic1
24+
```
25+
{{< /tab >}}
26+
{{< tab header="x86_64" >}}
27+
28+
```bash
29+
sudo apt update && sudo apt upgrade -y
30+
sudo apt install -y --no-install-recommends git cmake ninja-build gperf \
31+
ccache dfu-util device-tree-compiler wget python3-dev python3-venv python3-tk \
32+
xz-utils file make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1
33+
```
34+
{{< /tab >}}
35+
{{< /tabpane-normal >}}
36+
37+
Verify that the installed versions meet Zephyr's minimum requirements (CMake 3.20.5, Python 3.12, dtc 1.4.6):
38+
39+
```bash
40+
cmake --version
41+
python3 --version
42+
dtc --version
43+
```
44+
45+
## Set up the Zephyr workspace
46+
47+
Create a Python virtual environment and use `west` to initialize the Zephyr workspace. The following commands place the workspace in `~/zephyrproject`, but you can choose a different location.
48+
49+
Create and activate the virtual environment:
50+
51+
```bash
52+
python3 -m venv ~/zephyrproject/.venv
53+
source ~/zephyrproject/.venv/bin/activate
54+
```
55+
56+
After activation, your shell prompt is prefixed with `(.venv)`. Run `source ~/zephyrproject/.venv/bin/activate` each time you open a new terminal before working with Zephyr.
57+
58+
Install `west` and download the Zephyr source code:
59+
60+
```bash
61+
pip install west
62+
west init ~/zephyrproject
63+
cd ~/zephyrproject
64+
west update
65+
```
66+
67+
Export the Zephyr CMake package so that CMake can automatically load the boilerplate required for Zephyr builds:
68+
69+
```bash
70+
west zephyr-export
71+
```
72+
73+
Install the Python packages that Zephyr requires:
74+
75+
```bash
76+
west packages pip --install
77+
```
78+
79+
## Install the Arm GNU Toolchain
80+
81+
The Corstone-320 target uses the Cortex-M85 processor, so you need the `arm-none-eabi` bare-metal toolchain from the Arm GNU Toolchain. For a detailed installation guide covering all platforms, refer to the [Arm GNU Toolchain](/install-guides/gcc/arm-gnu/) install guide.
82+
83+
{{% notice Note %}}
84+
The following commands use Arm GNU Toolchain version 15.2.Rel1. The same commands work with other versions. Replace the file used in these steps with the file for your version of choice. To find the latest version, see [Arm GNU Toolchain downloads](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads).
85+
{{% /notice %}}
86+
87+
Download, unpack, and add the Arm GNU Toolchain to your `PATH` for your host architecture:
88+
89+
{{< tabpane-normal >}}
90+
{{< tab header="aarch64" >}}
91+
92+
```bash
93+
wget https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-aarch64-arm-none-eabi.tar.xz
94+
tar xJf arm-gnu-toolchain-15.2.rel1-aarch64-arm-none-eabi.tar.xz -C $HOME
95+
echo 'export PATH="$PATH:$HOME/arm-gnu-toolchain-15.2.rel1-aarch64-arm-none-eabi/bin"' >> ~/.bashrc
96+
source ~/.bashrc
97+
```
98+
{{< /tab >}}
99+
{{< tab header="x86_64" >}}
100+
101+
```bash
102+
wget https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi.tar.xz
103+
tar xJf arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi.tar.xz -C $HOME
104+
echo 'export PATH="$PATH:$HOME/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi/bin"' >> ~/.bashrc
105+
source ~/.bashrc
106+
```
107+
{{< /tab >}}
108+
{{< /tabpane-normal >}}
109+
110+
Verify the installation:
111+
112+
```bash
113+
arm-none-eabi-gcc --version
114+
```
115+
116+
The output is similar to:
117+
118+
```output
119+
arm-none-eabi-gcc (Arm GNU Toolchain 15.2.Rel1 (Build arm-15.86)) 15.2.1 20251203
120+
Copyright (C) 2025 Free Software Foundation, Inc.
121+
This is free software; see the source for copying conditions. There is NO
122+
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
123+
```
124+
125+
## Configure the toolchain for Zephyr
126+
127+
Zephyr uses two environment variables to locate the Arm GNU Toolchain. Set these each time you open a new terminal, or add them to your shell configuration file:
128+
129+
{{< tabpane-normal >}}
130+
{{< tab header="aarch64" >}}
131+
132+
```bash
133+
export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
134+
export GNUARMEMB_TOOLCHAIN_PATH=$HOME/arm-gnu-toolchain-15.2.rel1-aarch64-arm-none-eabi
135+
```
136+
{{< /tab >}}
137+
{{< tab header="x86_64" >}}
138+
139+
```bash
140+
export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
141+
export GNUARMEMB_TOOLCHAIN_PATH=$HOME/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi
142+
```
143+
{{< /tab >}}
144+
{{< /tabpane-normal >}}
145+
146+
Your build environment is now ready. The next section covers adding Zephyr board support files for the Corstone-320 MPS4 platform.

0 commit comments

Comments
 (0)