IAR+ST-Link调试STM32时,出现 Fatal error: The selected device does not match the target device 错误,并且无法调试。这是 IAR Embedded Workbench for ARM 7.80.3 的一个bug,从IAR下载补丁即可解决该问题。

根据帖子
​​​http://www.stmcu.org/module/forum/forum.php?mod=viewthread&tid=610247​​ 整理而成。

出错截图

解决方法:IAR The selected device does not match the target device_IAR

补丁下载

ProtectedDownload.asp?key=RMIUCC321D%2C7452494&protocol=HTTP">​http://supp.iar.com/Common/ProtectedDownload.asp?key=RMIUCC321D%2C7452494&protocol=HTTP​​​ (英文版)
​​​http://supp.iar.com/Updates/?product=EWarm​​ (补丁页面, IAR Embedded Workbench for ARM - patch for ST device support in ST-LINK, I-jet, and J-Link

补丁安装

关闭IAR,解压下载到的补丁文件 ewarm-7.80.4.12176-patch.zip ,将 arm/bin/ 目录下的9个dll文件覆盖到IAR的安装目录下 X:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\arm\bin ,重新打开IAR,问题解决。