Debugging 防锈除锈不';通过openocd和gdb调试stm32f407时,不要在断点处停止

Debugging 防锈除锈不';通过openocd和gdb调试stm32f407时,不要在断点处停止,debugging,rust,gdb,embedded,stm32,Debugging,Rust,Gdb,Embedded,Stm32,我在调试stm32f407vet6板和锈迹代码时遇到问题。 问题的关键在于GDB忽略断点。 在gdb中设置断点并执行“continue”命令后,程序继续忽略所有断点。 停止程序运行的唯一方法是使用“ctrl+c”命令引起中断。 执行此命令后,电路板将在当前正在执行的线路上停止执行。 我已尝试在所有可以设置断点的行上设置断点,但所有尝试均未成功 $ openocd Open On-Chip Debugger 0.10.0 (2020-07-01) [https://github.com/syspr

我在调试stm32f407vet6板和锈迹代码时遇到问题。 问题的关键在于GDB忽略断点。 在gdb中设置断点并执行“continue”命令后,程序继续忽略所有断点。 停止程序运行的唯一方法是使用“ctrl+c”命令引起中断。 执行此命令后,电路板将在当前正在执行的线路上停止执行。 我已尝试在所有可以设置断点的行上设置断点,但所有尝试均未成功

$ openocd
Open On-Chip Debugger 0.10.0 (2020-07-01) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 2000 kHz
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : STLINK V2J35S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 6.436364
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f4x.cpu on 3333
Info : Listening on port 3333 for gdb connections
openocd.cfg文件:

# Sample OpenOCD configuration for the STM32F3DISCOVERY development board

# Depending on the hardware revision you got you'll have to pick ONE of these
# interfaces. At any time only one interface should be commented out.

# Revision C (newer revision)
source [find interface/stlink.cfg]

# Revision A and B (older revisions)
# source [find interface/stlink-v2.cfg]

source [find target/stm32f4x.cfg]

# use hardware reset, connect under reset
# reset_config none separate
main.rs文件:

#![no_main]
#![no_std]
#![allow(unsafe_code)]

// Halt on panic
#[allow(unused_extern_crates)] // NOTE(allow) bug rust-lang/rust#53964
extern crate panic_halt; // panic handler

use cortex_m;
use cortex_m_rt::entry;
use stm32f4xx_hal as hal;

use crate::hal::{prelude::*, stm32};

#[entry]
fn main() -> ! {
    if let (Some(dp), Some(cp)) = (
        stm32::Peripherals::take(),
        cortex_m::peripheral::Peripherals::take(),
    ) {
        let rcc = dp.RCC.constrain();
        let clocks = rcc
            .cfgr
            .sysclk(168.mhz())
            .freeze();

        let mut delay = hal::delay::Delay::new(cp.SYST, clocks);

        let gpioa = dp.GPIOA.split();

        let mut l1 = gpioa.pa6.into_push_pull_output();
        let mut l2 = gpioa.pa7.into_push_pull_output();

        loop {
            l1.set_low().unwrap();
            l2.set_high().unwrap();
            delay.delay_ms(500u32);
            l1.set_high().unwrap();
            l2.set_low().unwrap();
            delay.delay_ms(500u32);
        }
    }

    loop {}
}
Cargo.toml文件:

[package]
name = "test_blink"
version = "0.1.0"
authors = ["Alex"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
embedded-hal = "0.2"
nb = "0.1.2"
cortex-m = "0.6"
cortex-m-rt = "0.6"
# Panic behaviour, see https://crates.io/keywords/panic-impl for alternatives
panic-halt = "0.2"
cortex-m-log="0.6.2"

[dependencies.stm32f4xx-hal]
version = "0.8.3"
features = ["rt", "stm32f407"]
我是个新手,也许我做错了什么,但我已经尝试了互联网上所有的选择。 起初,我认为这是vscode的cortex调试插件的问题,甚至创建了,但是这些人不能帮助我,因为问题显然不在他们这边

在cubeIDE中调试“C”代码是可行的,所以我敢假设问题出在rust--gdb--openocd中的某个地方。也许我错过了什么,但不幸的是我自己还没有找到


如果您能提供任何资源或想法来解决此问题,我将不胜感激。

我希望您能查看以下资源:

从你的屏幕抓取的arm none eabi gdb看起来确实没有达到断点

您应该在之后看到此消息:

注意:对只读地址自动使用硬件断点。 断点1,main()位于

你是否用符号编译了你的源代码


否则,您的配置对我来说都是正确的。

我希望您查看以下资源:

从你的屏幕抓取的arm none eabi gdb看起来确实没有达到断点

您应该在之后看到此消息:

注意:对只读地址自动使用硬件断点。 断点1,main()位于

你是否用符号编译了你的源代码

你的配置在我看来都是正确的

#![no_main]
#![no_std]
#![allow(unsafe_code)]

// Halt on panic
#[allow(unused_extern_crates)] // NOTE(allow) bug rust-lang/rust#53964
extern crate panic_halt; // panic handler

use cortex_m;
use cortex_m_rt::entry;
use stm32f4xx_hal as hal;

use crate::hal::{prelude::*, stm32};

#[entry]
fn main() -> ! {
    if let (Some(dp), Some(cp)) = (
        stm32::Peripherals::take(),
        cortex_m::peripheral::Peripherals::take(),
    ) {
        let rcc = dp.RCC.constrain();
        let clocks = rcc
            .cfgr
            .sysclk(168.mhz())
            .freeze();

        let mut delay = hal::delay::Delay::new(cp.SYST, clocks);

        let gpioa = dp.GPIOA.split();

        let mut l1 = gpioa.pa6.into_push_pull_output();
        let mut l2 = gpioa.pa7.into_push_pull_output();

        loop {
            l1.set_low().unwrap();
            l2.set_high().unwrap();
            delay.delay_ms(500u32);
            l1.set_high().unwrap();
            l2.set_low().unwrap();
            delay.delay_ms(500u32);
        }
    }

    loop {}
}
[package]
name = "test_blink"
version = "0.1.0"
authors = ["Alex"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
embedded-hal = "0.2"
nb = "0.1.2"
cortex-m = "0.6"
cortex-m-rt = "0.6"
# Panic behaviour, see https://crates.io/keywords/panic-impl for alternatives
panic-halt = "0.2"
cortex-m-log="0.6.2"

[dependencies.stm32f4xx-hal]
version = "0.8.3"
features = ["rt", "stm32f407"]