PlatformIO自带调试功能具体配置如下
 
 
我是用的是直接用jlink连接STM32进行所有的开发和调试功能
只需要几步简单的操作:

1、Add Configuration文件

PlatformIO+Jlink进行调试
在Platformio.ini中添加如下配置
1 [env:genericSTM32F103ZE]
2 platform = ststm32
3 board = genericSTM32F103ZE
4 framework = cmsis
5 upload_protocol = jlink
6 build_flags = -g
7 debug_tool = jlink

2、点击甲壳虫,选择configuration文件里添加的那个name的调试器来进行调试。

PlatformIO+Jlink进行调试
如图为调试界面,各种寄存器信息、变量信息、和调试操作按键。
PlatformIO+Jlink进行调试
 

上面的是用PlatformIO自带的调试功能。
还用另外一种调试是通过Cortex-Debug插件来进行调试的

1、VS code 插件管理器中搜索 Cortex Debug

PlatformIO+Jlink进行调试

2、platformio.ini中添加

1 build_flags=-g

3、添加调试配置

VS Code 菜单栏——调试——添加配置
选择{}Cortex Debug:JLink
更改配置为如下:
   
 {
            "cwd": "${workspaceRoot}",
            "executable": "/Users/arvin_jin/Documents/PlatformIO/Projects/MY_STM32_OS/.pio/build/genericSTM32F103ZE/firmware.elf",
            "name": "Debug Microcontroller",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "jlink",
            "device": "STM32F103ZE"
 }
调试过程总可能会出现toolchain,JLinkGDBServer不存在的问题,解决办法为将其这些工具添加到环境变量中即可,添加完后要重启才能生效。Mac下管理换件变量的文件为.bash_profile,我的添加如下:
export PATH="/Users/arvin_jin/.platformio/packages/toolchain-gccarmnoneeabi/bin:$PATH"
export PATH="/Users/arvin_jin/.platformio/packages/tool-jlink:$PATH"
 
cortex-debug参考指南:

相关文章:

  • 2021-11-03
  • 2021-12-06
  • 2021-10-27
  • 2021-12-25
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
猜你喜欢
  • 2022-01-15
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
相关资源
相似解决方案