rust-embedded / cortex-m-quickstart

Template to develop bare metal applications for Cortex-M microcontrollers
782 stars 164 forks source link

Failed to launch GDB error #81

Closed MehrdadKhnzd closed 4 years ago

MehrdadKhnzd commented 4 years ago

Hello there! I'm completely new to ARM, and I'm relatively new to Rust, too. I started the Discovery book a few days ago with an STM32F3DISCOVERY board and I was able to run some of the examples on my board and debug them in VSCode without any problem (or at least I solved them all) but when I decided to use this quickstart, I can't make it work. I just generated a project based on this repository and I just changed the config file but when I start debugging, the VSCode shows an error:

Failed to launch GDB: Cannot access memory at address 0xe000edfc (from interpreter-exec console "EnableITMAccess")

In the Debug Console tab, I have:

Open On-Chip Debugger 0.10.0 (2019-08-28) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
WARNING: interface/stlink-v2-1.cfg is deprecated, please switch to interface/stlink.cfg
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 1000 kHz
Info : STLINK V2J27M15 (API v2) VID:PID 0483:374B
Info : Target voltage: 2.921552
Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
Info : device id = 0x10036422
Info : flash size = 256kbytes
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800386c msp: 0x10002000
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800386c msp: 0x10002000

And in the Output tab I have:

Please check OUTPUT tab (Adapter Output) for output from openocd.exe
Launching server: "openocd.exe" "-c" "gdb_port 50000" "-s" "C:\Users\Mehrdad\Desktop\Rust\ARM\stm32f3discovery-start" "-f" "interface/stlink-v2-1.cfg" "-f" "target/stm32f3x.cfg" "-c" "tpiu config internal C:/Users/Mehrdad/AppData/Local/Temp/tmp-11256CKNOTpJ7MMc0 uart off 8000000 2000000"
Launching GDB: "arm-none-eabi-gdb.exe" "-q" "--interpreter=mi2"
undefinedC:\Program Files (x86)\GNU Tools Arm Embedded\9 2019-q4-major\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
Reading symbols from C:\Users\Mehrdad\Desktop\Rust\ARM\stm32f3discovery-start\target\thumbv7em-none-eabihf\debug\stm32f3discovery-start...
0x0800386c in ?? ()
Not implemented stop reason (assuming exception): undefined
Unable to match requested speed 1000 kHz, using 950 kHz
Unable to match requested speed 1000 kHz, using 950 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800386c msp: 0x10002000
Load failed
Unable to match requested speed 1000 kHz, using 950 kHz
Unable to match requested speed 1000 kHz, using 950 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800386c msp: 0x10002000
Cannot access memory at address 0xe000edfc

I don't know what's happening. I'm using Windows 10 and OpenOCD from Chocolatey, and here's what I changed from the config file:

runner = "arm-none-eabi-gdb -q -x openocd.gdb"
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)

That's it. I don't know what happens because I have very little knowledge about ARM or OpenOCD or GDB, and I'm stuck. Your help is really appreciated.

MehrdadKhnzd commented 4 years ago

My bad, I forgot to set the correct values for the memory.x file. Thanks!