# Create an interactive shell for Zephyr RTOS on Arm Cortex-M

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/zephyr_shell/)
- [Set up the Zephyr shell development environment](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/zephyr_shell/1_installation/)
- [Understand the Zephyr shell subsystem and backends](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/zephyr_shell/2_overview/)
- [Build and run the Zephyr MQTT shell on Arm Cortex-M](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/zephyr_shell/3_mqtt_shell/)
- [Build and run the Zephyr UART shell on Arm Cortex-M](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/zephyr_shell/4_uart_shell/)
- [Next Steps](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/zephyr_shell/_next-steps/)

## About this Learning Path

| Skill level:       | Introductory     |
|--------------------|------------------|
| Reading time:      | 30 min           |
| Last updated:      | 13 Aug 2026      |

| Authors:           |                  |
|--------------------|------------------|
| Ayoub Bourjilat, Ac6 | [GitHub](https://github.com/Bourjilat) [LinkedIn](https://linkedin.com/in/ayoub-bourjilat-a55b58165/) [Website](https://www.ac6.fr/en/) |
| Odin Shen, Arm     | [GitHub](https://github.com/odincodeshen) [LinkedIn](https://linkedin.com/in/odin-shen-lmshen) |
| Akash Malik, Arm   | [GitHub](https://github.com/akashmalik19973) [LinkedIn](https://linkedin.com/in/akash-malik-a65bab219) |

| Arm IP:           | [Cortex-M](https://support.arm.com/?tab=compute-ip&Product%20Type=Microcontrollers) |
|--------------------|------------------|
| Tags:              | RTOS Fundamentals, RTOS, Zephyr, C |

### Who is this for?
This is an introductory topic for embedded developers who want to add an interactive command-line shell to a Zephyr RTOS application on Arm Cortex-M.

### What will you learn?
Upon completion of this Learning Path, you will be able to:
- Enable and tailor Zephyr shell (Kconfig/prj.conf) to produce a minimal CLI footprint
- Build and flash shell-enabled Zephyr apps using MQTT and UART shell backends on an Arm Cortex-M board
- Use the Zephyr shell for board bring-up, diagnostics, and interactive testing

### Prerequisites
Before starting, you will need the following:
- Basic familiarity with embedded C programming
- Visual Studio Code with the Workbench for Zephyr extension installed and configured
- Docker Desktop, Docker Engine, or another Docker-compatible runtime installed on your host computer (for the MQTT shell example, if you’re not installing Mosquitto on host)
- A Zephyr-supported Arm Cortex-M board (for example, NXP FRDM-MCXN947)

### Summary
You’ll enable and configure the Zephyr shell on an Arm Cortex-M board with Workbench for Zephyr. First, you’ll update `prj.conf` for the shell and selected MQTT or UART backend. Then, you’ll build and flash from Visual Studio Code, verify the shell prompt, and use built-in modules for bring-up and diagnostics over Ethernet or USB serial.

### Frequently asked questions

#### How do I know the Zephyr shell is enabled and working after I flash the board?
You should see a shell prompt on the selected backend after boot. Run a built-in command such as `kernel version` to confirm the shell responds.

#### Do I need to add networking code in main.c for the MQTT shell example?
No. The MQTT example starts the shell, network stack, DHCP client, and MQTT shell backend from configuration options in `prj.conf`.

#### Which backend should I use if I want to interact locally during bring-up?
Use the UART shell backend. It maps shell input and output to the active UART console over the board’s USB serial interface and doesn’t require network connectivity.

#### What should I check if I don’t see any shell output over UART?
Verify that the UART shell backend is enabled in `prj.conf` and that you’re connected to the board’s USB serial interface selected as the active console. Use a serial terminal application supported on your host OS to view the console.

#### What should I check if the MQTT shell doesn't connect to the broker?
Confirm `CONFIG_SHELL_BACKEND_MQTT` is enabled and that required networking options are set in `prj.conf` so the device can obtain network connectivity. Ensure the MQTT broker is reachable from the board over Ethernet.
