2

I am trying to avoid entering the same commands in each GDB sessions. For this, I have followed the instructions in rust discovery book but the program is not working as mentioned in the book when I run the program through cargo run it is giving the following error:

ts/project/discovery/src/06-hello-world$ cargo run
   error: could not load Cargo configuration  
cargo run --target thumbv7em-none-eabihf
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `arm-none-eabi-gdb -q -x openocd.gdb /home/jawwad-turabi/Documents/project/discovery/target/thumbv7em-none-eabihf/debug/led-roulette`
error: could not execute process `arm-none-eabi-gdb -q -x openocd.gdb /home/jawwad-turabi/Documents/project/discovery/target/thumbv7em-none-eabihf/debug/led-roulette` (never executed)

Caused by:
  No such file or directory (os error 2)

My openocd.gdb file contains these content:

   target remote: 3333
    load
    break main
    continue

My config file contain these content:

 [target.thumbv7em-none-eabihf]
   runner = "arm-none-eabi-gdb -q -x openocd.gdb"
   rustflags = [
   "-C", "link-arg=-Tlink.x",
   ]
   +[build]
   +target = "thumbv7em-none-eabihf"
Jawwad Turabi
  • 322
  • 4
  • 12

2 Answers2

3

Please change runner = "arm-none-eabi-gdb -q -x openocd.gdb" to this runner = "gdb-multiarch -q -x openocd.gdb". Because, if you are using the Ubuntu 18.04 LTS version then this command will be used as the book mention.

Ubuntu 18.04 or newer / Debian stretch or newer

NOTE gdb-multiarch is the GDB command you'll use to debug your ARM Cortex-M programs

Ubuntu 14.04 and 16.04

NOTE arm-none-eabi-gdb is the GDB command you'll use to debug your ARM Cortex-M programs

Fahim Uz Zaman
  • 444
  • 3
  • 6
1

While flashing the STM32F3, we have to connect to the respective GDB server. It may be arm-none-eabi-gdb, gdb-multiarch or gdb. You may have to try all the three.

Now, as far as your question is concerned, you have to use the same parameter in your openocd.gdb. In my case, I have successfully tried with arm-none-eabi-gdb. Remember, I am using rust on Windows 10.

Muhammad Ovais
  • 152
  • 3
  • 16