You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

M1 Mac上STM32Cube IDE 1.13版本ST-Link调试失败求助

M1 Mac (macOS 13.5 Ventura)下STM32Cube IDE 1.13调试libusb连接故障解决

问题背景

  • 设备:搭载M1芯片的MacBook
  • 系统:macOS 13.5 Ventura
  • 软件:STM32Cube IDE 1.13
  • 现象:Hello World项目编译正常,调试时触发libusb错误,ST-LINK GDB Server无法连接设备

报错信息

libusb: info [darwin_claim_interface] no interface found; setting configuration: 1
libusb: error [darwin_claim_interface] could not set configuration

STMicroelectronics ST-LINK GDB server. Version 7.4.0
Copyright (c) 2023, STMicroelectronics. All rights reserved.

Starting server with the following options:
Persistent Mode : Disabled
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled

libusb: info [darwin_claim_interface] no interface found; setting configuration: 1
libusb: error [darwin_claim_interface] could not set configuration
Device connect error

Error in initializing ST-LINK device.
Reason: Failed to connect to device. Please check power and cabling to target.


解决步骤

1. 处理macOS驱动权限

  • 打开「系统设置」→「隐私与安全性」
  • 切换到「通用」选项卡,查看是否有来自“STMicroelectronics”的驱动被阻止的提示
  • 若存在,点击「允许」后重启Mac

2. 替换适配ARM64的libusb库

M1芯片为ARM架构,内置x86版本libusb可能存在兼容性问题:

  • 进入STM32Cube IDE安装目录(默认路径:/Applications/STMicroelectronics/STM32CubeIDE_1.13.0)
  • 打开子目录:STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.st-link-gdb-server.macosx_7.4.0.202305091446/tools/bin
  • 备份原文件libusb-1.0.0.dylib
  • 通过Homebrew安装适配ARM64的libusb:执行brew install libusb,获取安装后的库文件路径(一般在/opt/homebrew/lib/下)
  • 将适配ARM64的libusb-1.0.0.dylib复制到上述bin目录替换原文件

3. 验证硬件连接

  • 断开ST-LINK后重新插入Mac,打开「关于本机」→「系统报告」→「USB」,确认ST-LINK设备(名称通常为ST-LINK/V2或ST-LINK/V3)能被识别
  • 更换USB线(优先使用USB 2.0端口),检查ST-LINK与目标板的SWDIO、SWCLK、GND、VCC接线是否正确

4. 调整调试配置

  • 在STM32Cube IDE中打开「Run」→「Debug Configurations」
  • 选中对应的ST-LINK调试配置,切换到「Debugger」选项卡
  • 确认「Debug probe」选择为「ST-LINK (ST-LINK GDB Server)」
  • 勾选「Use SWD」(若未勾选),或尝试切换为JTAG模式测试
  • 点击「Apply」后重新启动调试

若上述方法无效,尝试使用旧版本:

  • 从ST官网下载适配macOS ARM64的ST-LINK GDB Server 7.3.0或更早版本
  • 替换STM32Cube IDE内置的ST-LINK GDB Server文件(路径同步骤2中的bin目录)

内容的提问来源于stack exchange,提问作者Mandeep Chaudhary

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 01:03:36