# IAR 工具链

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/zh-cn/help/clion/llms.txt).

> **TL;DR**
> 操作系统  ：Windows (MinGW) / Linux
>
>
>
> 项目格式  ：CMake

在为嵌入式项目设置工具链时，您可以使用 [IAR](https://www.iar.com/) 编译器。 CLion 会将其检测为 C/C++ 编译器并收集编译器信息。 此外，您可以打开使用 IAR 工具链的项目，它们应该能够成功加载。

目前仅支持   基于 CMake  项目。 作为起点，您可以创建一个 [STM32CubeMX 项目](embedded-stm32.html)并编辑自动生成的  `CMakeLists.txt` 。 使用我们的 [示例项目](https://github.com/elmot/clion-iar-stm32f3-stub)作为参考。

Procedure: 设置 IAR 编译器

1. 下载并安装 [IAR workbench](https://www.iar.com/products/architectures/arm/iar-embedded-workbench-for-arm)。 打开   IAR License Manager  并确保您的 IAR 许可证已激活。 请注意，CLion 不提供 IAR 许可证。

> **Note:**
> CLion 对 IAR 编译器的支持已在 ARM 架构上进行了测试。 请注意，如果您针对的是其他平台，可能会出现问题或功能受限的情况。

2. 在 CLion 中，导航到  `设置 | 构建、执行、部署 | 工具链`

在 Windows 上， [创建](how-to-create-toolchain-in-clion.html#new-toolchain)一个新的   MinGW  工具链或选择一个现有的工具链。 请注意，使用 IAR 编译器需要 [MinGW 环境](quick-tutorial-on-configuring-clion-on-windows.html#MinGW)。

在 Linux 上，使用默认的本地工具链。

3. 在   C 编译器  和   C++ 编译器  字段中，设置 IAR 编译器的路径：

![使用 IAR 编译器的工具链](https://resources.jetbrains.com/help/img/idea/2026.3/cl_toolchain_iar.png)

4. 选择调试器：您可以使用捆绑的 GDB 或自定义 GDB 版本，例如来自 [GNU ARM Embedded Toolchain](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm)的调试器。

![IAR 工具链的 GDB 调试器](https://resources.jetbrains.com/help/img/idea/2026.3/cl_toolchain_iar_gdb.png)

5. 请执行以下操作之一：

* 通过将新创建的工具链移到列表顶部，将其设置为 默认 。 这样，您就不需要在 CMake 配置文件中手动选择它。 ![IAR 工具链为默认](https://resources.jetbrains.com/help/img/idea/2026.3/cl_toolchain_iar_default.png)

* 转到 `设置 | 构建、执行、部署 | CMake` 并在当前配置文件的 工具链 字段中选择新创建的工具链： ![为 CMake 配置文件选择的 IAR 工具链](https://resources.jetbrains.com/help/img/idea/2026.3/cl_cmakeprofile_iar_nondef.png)

> **Tip:**
> 有关将 IAR 工具链与 CMake 一起使用的更多信息，请参阅 IAR Systems 的这篇技术说明： [Using CMake with IAR Embedded Workbench](https://www.iar.com/knowledge/support/technical-notes/general/using-cmake-with-iar-embedded-workbench)

## See also

### 操作指南

[快速 CMake 教程](quick-cmake-tutorial.html) [Windows Tutorial](quick-tutorial-on-configuring-clion-on-windows.html)

### 流程

[STM32CubeMX 项目](embedded-stm32.html) [OpenOCD 支持](openocd-support.html)

### 外部链接

[Embedded Development in CLion FAQs](https://intellij-support.jetbrains.com/hc/en-us/articles/4405160320274-Embedded-Development-in-CLion) [Sample project on GitHub](https://github.com/elmot/clion-iar-stm32f3-stub)

