3

阿木币

0

精华

1 小时

在线时间

应届白菜

Rank: 1

发表于 2022-6-11 21:17:54 2577 浏览 5 回复

如何使用STLink在其他飞控硬件上进行调试

本人手中有一块鹏心飞控(飞控硬件资源),硬件配置跟fmuV5差不多.
目前在做FMT移植工作。
bootloader已经做好,可以正常连接QGroundControl,见图1.
image.png
现在使用STlink进行下载调试FMT,vscode中的task.json配置如下
  "version": "2.0.0",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "echo ${env:USERNAME}"
        },
        {
            "dependsOn":"Build",
            "label": "Build and Download",
            "type": "shell",
            "command": "openocd",
            "args": [
            "-f",
            "interface/stlink-v2.cfg",
            "-f",
            "target/stm32f7x.cfg",
           "-c",
           "program ./target/pixhawk/fmu-v5/build/fmt_fmuv5.elf verify reset exit "
            ],
            "problemMatcher": []
        }
    ]


lauch.json配置如下:
"version": "0.2.0",
    "configurations": [
        {
            "name": "FMUv5 Debug J-Link",
            "type": "cortex-debug",
            "request": "launch",
            "cwd": "${workspaceRoot}",
            "executable": "target/pixhawk/fmu-v5/build/fmt_fmuv5.elf",
            //"serverpath": "${env:JLINK_SERVER}",
            "servertype": "openocd",
            "device": "STM32F765II",
            "interface": "swd",
            "configFiles": [
            "interface/stlink-v2.cfg",
            "target/stm32f7x.cfg"
             ],
            "armToolchainPath": "${env:RTT_EXEC_PATH}",
            "serialNumber": "", //If you have more than one J-Link probe, add the serial number here.
            "svdFile": "target/pixhawk/fmu-v5/STM32F7x5.svd",
            "runToMain": true,
           "preLaunchTask":"Build and Download"
        },


使用的是openocd进行下载,调试。
程序可以正常下载,但是无法调试,终端提示错误如下:
Info : clock speed 2000 kHz
Info : STLINK V2J35S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 4.780826
Info : [stm32f7x.cpu] Cortex-M7 r1p0 processor detected
Info : [stm32f7x.cpu] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f7x.cpu on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x00000003 pc: 00000000 msp: 0x464c4558
Info : device id = 0x10016451
Info : flash size = 2048 kbytes
Info : Single Bank 2048 kiB STM32F76x/77x found
Info : flash size = 1024 bytes
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c

指针始终指向
image.png
一时不知道如何解决,请大佬帮忙看看



图1

图1

扫一扫浏览分享
回复

使用道具 举报

3

阿木币

0

精华

1 小时

在线时间

应届白菜

Rank: 1

 楼主| 发表于 2022-6-12 11:10:22
问题已解决,偏移地址问题,
参考文档https://github.com/platformio/platform-ststm32/issues/343
https://community.platformio.org ... is-successful/26656

在task.json中的"program ./target/pixhawk/fmu-v5/build/fmt_fmuv5.elf verify reset exit "更改为
"program ./target/pixhawk/fmu-v5/build/fmt_fmuv5.elf 0x8000 verify reset exit "
link.lds中App地址是从0x08008000加载的
回复 点赞

使用道具 举报

11

阿木币

0

精华

23 小时

在线时间

应届白菜

Rank: 1

发表于 2022-6-12 11:41:31 来自手机
没玩过什么STlink不懂
回复 点赞

使用道具 举报

6

阿木币

0

精华

6 小时

在线时间

应届白菜

Rank: 1

发表于 2022-6-14 09:24:22 来自手机
老哥知道jlink调试ozone的问题吗
回复 点赞

使用道具 举报

6

阿木币

0

精华

6 小时

在线时间

应届白菜

Rank: 1

发表于 2022-6-14 09:26:04 来自手机
jlink 发表于 2022-6-12 11:10
问题已解决,偏移地址问题,
参考文档https://github.com/platformio/platform-ststm32/issues/343
https:/ ...

老哥知道怎么用jlink配合ozone调试飞控吗,看到消息加个好友一起讨论下qq982903071
回复 点赞

使用道具 举报

8

阿木币

0

精华

9 小时

在线时间

技术大V

Rank: 4

发表于 2022-6-15 15:49:49
问题已解决,已经可以用openocd来调试了是吗?
回复 点赞

使用道具 举报

返回列表
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表