Skip to content

Commit 7ae303a

Browse files
Merge pull request #3387 from jasonrandrews/review
Zephyr shell Learning Path tech review
2 parents 36ef81c + 6eb962f commit 7ae303a

35 files changed

Lines changed: 150 additions & 136 deletions
Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Set up your environment
2+
title: Set up the Zephyr shell development environment
33
weight: 2
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9-
## Set up your environment
9+
## Set up the Zephyr shell development environment
1010

1111
In this section, you will prepare your host computer and identify the hardware needed for two Zephyr shell examples. You will use the shell over two transports:
1212

@@ -23,24 +23,22 @@ Make sure you have a working Zephyr development environment set up in Visual Stu
2323
- A Zephyr SDK toolchain imported in Workbench
2424
- A West workspace initialized
2525

26-
If you have not done this yet, complete [Build Zephyr projects with Workbench for Zephyr in VS Code learnin path](/learning-paths/embedded-and-microcontrollers/zephyr_vsworkbench/) first.
26+
If you have not done this yet, complete [Build Zephyr projects with Workbench for Zephyr in VS Code](/learning-paths/embedded-and-microcontrollers/zephyr_vsworkbench/) first.
2727

28-
You also need:
28+
The two examples in this Learning Path have different additional requirements:
2929

30-
- Docker Desktop, Docker Engine, or another Docker-compatible runtime
31-
- A USB cable for each development board
30+
- **MQTT shell example**: Docker Desktop, Docker Engine, or another Docker-compatible runtime on your host computer. The board communicates with a Mosquitto broker running in a container.
31+
- **UART shell example**: A USB cable to connect the development board to your host computer. The board exposes a shell prompt over the USB serial interface.
3232

3333
## Hardware requirements
3434

35-
For the MQTT shell example, use a Zephyr-supported development board with Ethernet. The instructions use the [FRDM-MCXN947](https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXN947), with the Zephyr board identifier `frdm_mcxn947/mcxn947/cpu0`.
35+
Both examples use the [FRDM-MCXN947](https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXN947) as the development board (Zephyr identifier `frdm_mcxn947/mcxn947/cpu0`). The FRDM-MCXN947 includes an Ethernet port for the MQTT shell example and a USB UART interface for the UART shell example, so both examples run on the same board.
3636

37-
For the UART shell example, use a Zephyr-supported development board with a USB UART interface. The instructions use the [FRDM-MCXN947](https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXN947), with the Zephyr board identifier `frdm_mcxn947/mcxn947/cpu0`.
38-
39-
To check whether another board is supported by Zephyr, refer to the [Zephyr Supported Boards list](https://docs.zephyrproject.org/latest/boards/index.html).
37+
To check whether another board is supported by Zephyr, see the [Zephyr Supported Boards list](https://docs.zephyrproject.org/latest/boards/index.html).
4038

4139
## Install UART terminal tools
4240

43-
For the UART shell example, install a serial terminal application on your host computer. You will use the terminal application to connect to the Zephyr shell over the board's UART interface.
41+
For the UART shell example, install a serial terminal application on your host computer. You will use the terminal application to connect to the Zephyr shell over the board's UART interface. This Learning Path supports Windows, macOS, and Linux host computers.
4442

4543
### Windows
4644

@@ -55,21 +53,12 @@ After installation:
5553
3. Open PuTTY and configure:
5654

5755
- **Connection type**: `Serial`
58-
5956
- **Serial line**: your board's COM port (for example `COM5`)
60-
6157
- **Speed**: `115200`
6258

6359
Select **Open** to connect to the Zephyr UART shell.
6460

65-
<p style="text-align:center;">
66-
<img src="/learning-paths/embedded-and-microcontrollers/zephyr_shell/images/putty_installation.png"
67-
alt="PuTTY Installation"
68-
width="640"
69-
style="max-width:100%;height:auto;" />
70-
<br/>
71-
<em>PuTTY Serial Terminal Configuration</em>
72-
</p>
61+
![PuTTY configuration window with Connection type set to Serial, Serial line set to COM5, and Speed set to 115200, ready to connect to the Zephyr UART shell#center](images/putty_installation.webp "PuTTY Serial Terminal Configuration")
7362

7463
### macOS
7564

@@ -82,38 +71,59 @@ After connecting the development board over USB:
8271
2. List available serial devices:
8372

8473
```bash
85-
8674
ls /dev/tty.*
75+
```
76+
77+
3. Connect to the UART shell with:
8778

79+
```bash
80+
screen /dev/tty.usbmodemXXXX 115200
8881
```
8982

90-
3. Identify the board's serial device.
83+
Replace `/dev/tty.usbmodemXXXX` with the serial device shown on your system.
84+
85+
To exit `screen`, press `Ctrl + A`, then `K`, then `Y` to confirm.
9186

92-
4. Connect to the UART shell with:
87+
### Linux
88+
89+
Linux includes `screen` in most distributions, so no additional software is required. If `screen` is not installed, use your package manager to install it:
9390

9491
```bash
92+
sudo apt install screen
93+
```
9594

96-
screen /dev/tty.usbmodemXXXX 115200
95+
After connecting the development board over USB:
96+
97+
1. Open a terminal window.
9798

99+
2. List available serial devices:
100+
101+
```bash
102+
ls /dev/ttyACM* /dev/ttyUSB*
98103
```
99104

100-
Replace `/dev/tty.usbmodemXXXX` with the serial device shown on your system.
105+
3. If you see a permission error when connecting, add your user to the `dialout` group and log out and back in:
101106

102-
To exit `screen`:
107+
```bash
108+
sudo usermod -aG dialout $USER
109+
```
103110

104-
1. Press `Ctrl + A`
111+
4. Connect to the UART shell with:
105112

106-
2. Press `K`
113+
```bash
114+
screen /dev/ttyACM0 115200
115+
```
107116

108-
3. Press `Y` to confirm
117+
Replace `/dev/ttyACM0` with the device shown on your system. Boards using a CP210x or FTDI USB-UART chip typically appear as `/dev/ttyUSB0`.
109118

110-
{{% notice Note %}}
119+
To exit `screen`, press `Ctrl + A`, then `K`, then `Y` to confirm.
111120

121+
{{% notice Note %}}
112122
Workbench for Zephyr supports multiple debug runners depending on the connected board. The FRDM-MCXN947 board uses the onboard CMSIS-DAP / LinkServer interface for flashing and debugging, while shell access in this Learning Path uses UART over USB.
113123

114124
{{% /notice %}}
115125

116-
## Network requirements
126+
## Network requirements for the MQTT shell example
117127

118128
For the MQTT shell example, the board needs access to an MQTT broker over Ethernet. You will run Mosquitto locally with Docker Compose and use the Mosquitto command-line tools to send and receive shell messages.
119129

@@ -129,4 +139,4 @@ The example configuration uses IPv4. If your network does not provide DHCP, use
129139

130140
## What's next?
131141

132-
In the next section, you will read a short overview of the Zephyr shell subsystem and the two transports used in this Learning Path. After that, you will build the MQTT shell and the UART shell on the FRDM-MCXN947 using a USB serial connection and a UART terminal application such as PuTTY or the built-in macOS `screen` utility.
142+
In the next section, you will read a short overview of the Zephyr shell subsystem and the two transports used in this Learning Path. After that, you will build the MQTT shell and the UART shell on the FRDM-MCXN947 using a USB serial connection and a UART terminal application such as PuTTY on Windows or `screen` on macOS and Linux.

content/learning-paths/embedded-and-microcontrollers/zephyr_shell/2_overview.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Overview
2+
title: Understand the Zephyr shell subsystem and backends
33
weight: 3
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9-
## What is the Zephyr shell?
9+
## Understand the Zephyr shell subsystem and backends
1010

1111
The Zephyr shell subsystem (`CONFIG_SHELL=y`) adds an interactive command-line interface to your firmware. After the shell is enabled, you can inspect system state, run subsystem commands, and trigger application behavior at runtime without rebuilding or reflashing the application.
1212

@@ -26,24 +26,25 @@ The shell command tree is independent of the transport. The same commands can ru
2626

2727
In this Learning Path you will work with two transports:
2828

29-
- `CONFIG_SHELL_BACKEND_MQTT=y` routes shell commands and responses over MQTT topics. Inbound on `<device_id>/sh/rx`, outbound on `<device_id>/sh/tx`. The backend connects automatically once the board has an IPv4 address. The MQTT backend is IPv4-only.
30-
- `CONFIG_SHELL_BACKEND_SERIAL=y` routes shell commands and responses over the board's UART interface. The shell is accessible through a USB serial connection using a terminal application such as PuTTY on Windows or the built-in `screen` utility on macOS. The UART backend works on a wide range of Zephyr-supported development boards with no additional debug hardware required.
29+
**MQTT backend** (`CONFIG_SHELL_BACKEND_MQTT=y`)
30+
31+
Routes shell commands and responses over MQTT topics. The board subscribes to `<device_id>/sh/rx` for inbound commands and publishes responses to `<device_id>/sh/tx`. The backend connects automatically once the board has an IPv4 address. This backend is IPv4-only.
32+
33+
**UART backend** (`CONFIG_SHELL_BACKEND_SERIAL=y`)
34+
35+
Routes shell commands and responses over the board's UART interface, accessible through a USB serial connection. Use PuTTY on Windows, or `screen` on macOS and Linux. This backend works on a wide range of Zephyr-supported development boards with no additional debug hardware required.
3136

3237
Multiple backends can be enabled at the same time in a single application when the board has the required peripherals and memory.
3338

34-
A minimal shell build with only the kernel and device modules adds roughly 10 to 15 KB to flash and a few hundred bytes to RAM.
39+
A minimal shell build with only the kernel and device modules adds roughly 10 to 15 KB to flash and a few hundred bytes to RAM on a Cortex-M target, though the exact footprint depends on the modules enabled and the toolchain optimization level.
3540

36-
## What you will do next
41+
## What you will build next
3742

38-
The two following sections each build a small Zephyr application that enables one of these backends:
43+
The next two sections each build a small Zephyr application that enables one of these backends:
3944

4045
- **MQTT shell** on the NXP FRDM-MCXN947, with a local Mosquitto broker running in Docker. You will send commands and read responses with the `mosquitto_pub` and `mosquitto_sub` command-line tools.
41-
- **UART shell** on the FRDM-MCXN947, using a USB serial connection with PuTTY on Windows or the built-in `screen` utility on macOS.
46+
- **UART shell** on the FRDM-MCXN947, using a USB serial connection with PuTTY on Windows or `screen` on macOS and Linux.
4247

43-
Each example is portable to any Zephyr-supported board with the right peripheral (Ethernet for MQTT, J-Link for RTT). The "Switch to a different board" section near the end of each page shows how to change the target board on an existing project.
48+
Each example is portable to any Zephyr-supported board with the right peripheral Ethernet for the MQTT backend, USB UART for the UART backend. The "Switch to a different board" section near the end of each page shows how to change the target board on an existing project.
4449

4550
For more information on the shell subsystem, see the [Zephyr Shell documentation](https://docs.zephyrproject.org/latest/services/shell/index.html).
46-
47-
## What's next?
48-
49-
In the next section, you will build the MQTT shell on the FRDM-MCXN947, run Mosquitto in Docker, and exchange shell commands with the board over MQTT topics.

0 commit comments

Comments
 (0)