# Build an RTX5 RTOS application with Keil Studio (VS Code)

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/cmsis_rtx_vs/)
- [Create csolution project](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/cmsis_rtx_vs/create/)
- [Initialize the Operating System](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/cmsis_rtx_vs/initialize/)
- [Create RTOS Threads](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/cmsis_rtx_vs/threads/)
- [Build and run the application](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/cmsis_rtx_vs/build_and_run/)
- [Next Steps](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/cmsis_rtx_vs/_next-steps/)

## About this Learning Path

| Skill level:        | Introductory       |
|---------------------|--------------------|
| Reading time:       | 30 min             |
| Last updated:       | 08 Jul 2026        |

| Author:             | Ronan Synnott, Arm ([LinkedIn](https://linkedin.com/in/ronansynnott)) |
|---------------------|-------------------------------------------------------|
| Arm IP:             | [Cortex-M](https://support.arm.com/?tab=compute-ip&Product%20Type=Microcontrollers)  |
| Tags:               | [RTOS Fundamentals](https://learn.arm.com/tag/rtos-fundamentals), [RTOS](https://learn.arm.com/tag/rtos), [Keil RTX RTOS](https://learn.arm.com/tag/keil-rtx-rtos), [Keil MDK](https://learn.arm.com/tag/keil-mdk), [Arm Development Studio](https://learn.arm.com/tag/arm-development-studio)  |

### Who is this for?
This is an introductory topic for software developers new to RTOS development.

### What will you learn?
Upon completion of this Learning Path, you will be able to:
- Understand the basics of RTX-based RTOS application development
- Configure and manage an RTOS project in Keil Studio, including defining the memory map, selecting software components, and setting up debugging configurations for Cortex-M processors
- Create and manage multiple threads within an RTX5 RTOS application

### Prerequisites
Before starting, you will need the following:
- Installation of [Arm Keil Studio for VS Code](https://learn.arm.com/install-guides/keilstudio_vs/)
- Some familiarity with CMSIS is assumed

### Summary
You’ll create, configure, and debug an RTX5-based application in Keil Studio for VS Code using the CMSIS-RTOS2 API. First, you’ll create a CMSIS Solution project, select required components in the **Run-Time Environment**, and add system startup so RTX5 can initialize the SysTick timer with `SystemCoreClockUpdate()` before starting the scheduler. Then, you’ll implement an `app_main` thread that launches multiple worker threads and builds the project using the CMSIS extension. Using the Cortex-M4 Fixed Virtual Platform as the target, you’ll run and step through the program and verify execution by observing periodic thread messages printed in the **Debug Console**.

### Frequently asked questions

<details>
<summary>Which target should I use if I don’t have hardware available?</summary>
Use the Cortex-M4 Fixed Virtual Platform (FVP) referenced in the steps. The procedure also applies to other devices supported by CMSIS-Pack.
</details>

<details>
<summary>How do I start a debug session in Keil Studio for VS Code?</summary>
Select the **Debug** icon or open the **Run and Debug** view, then choose the configured debug connection to launch the FVP. Use the standard debugging controls to step through your code.
</details>

<details>
<summary>How do I know the RTOS is running correctly?</summary>
After initialization, the **Debug Console** displays messages from your threads. Look for output similar to: `[model] hello from thread 1/2/3`.
</details>

<details>
<summary>Where do main.c and app_main.c come from?</summary>
`main.c` is created automatically in the Source Files group when you set up the CMSIS Solution project. Add `app_main.c` by clicking the **+** icon in the Source Files group.
</details>

<details>
<summary>Can I change the number or names of the threads?</summary>
Yes. The number and naming of threads created by `app_main` are flexible, so adjust them to match your application structure.
</details>
