|
发表于 2022-6-11 21:17:54
5233 浏览 5 回复
如何使用STLink在其他飞控硬件上进行调试
本人手中有一块鹏心飞控(飞控硬件资源),硬件配置跟fmuV5差不多.
目前在做FMT移植工作。
bootloader已经做好,可以正常连接QGroundControl,见图1.
现在使用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
指针始终指向
一时不知道如何解决,请大佬帮忙看看
|
-
图1
扫一扫浏览分享
|