cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to start debug using Open OCD

SSaur
Associate II

Hi

I am using STM32L476VG micro controller on STM32L476 Discovery board.

I just configured the Eclipse project to build using arm gcc and successfully compiled the code to generate binaries. I am facing issue to debug the code.

I have attached console log for more information.

Please help

Thank You

GNU MCU Eclipse 32-bit Open On-Chip Debugger 0.10.0+dev-00462-gdd1d90111 (2019-01-18-06:53)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 500 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 500 kHz
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : STLINK V2J33M25 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.247525
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x41000003 pc: 0x08000460 msp: 0x2001ff98
Info : device id = 0x10076415
Info : flash size = 1024kbytes
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : Unable to match requested speed 500 kHz, using 480 kHz
adapter speed: 480 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800029c msp: 0x20020000
adapter speed: 4000 kHz
semihosting is enabled
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : Unable to match requested speed 500 kHz, using 480 kHz
adapter speed: 480 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800029c msp: 0x20020000, semihosting
adapter speed: 4000 kHz
Info : Padding image section 0 at 0x080003f4 with 12 bytes
Info : Padding image section 1 at 0x08001223 with 1 bytes
Warn : Padding 4 bytes to keep 8-byte write size
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000004e msp: 0x20020000, semihosting
Warn : block write succeeded
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : Unable to match requested speed 500 kHz, using 480 kHz
adapter speed: 480 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800029c msp: 0x20020000, semihosting
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : Unable to match requested speed 500 kHz, using 480 kHz
adapter speed: 480 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800029c msp: 0x20020000, semihosting
===== arm v7m registers
(0) r0 (/32): 0x00000000
(1) r1 (/32): 0x00000000
(2) r2 (/32): 0x00000000
(3) r3 (/32): 0x00000000
(4) r4 (/32): 0x00000000
(5) r5 (/32): 0x00000000
(6) r6 (/32): 0x00000000
(7) r7 (/32): 0x00000000
(8) r8 (/32): 0x00000000
(9) r9 (/32): 0x00000000
(10) r10 (/32): 0x00000000
(11) r11 (/32): 0x00000000
(12) r12 (/32): 0x00000000
(13) sp (/32): 0x20020000
(14) lr (/32): 0xFFFFFFFF
(15) pc (/32): 0x0800029C
(16) xPSR (/32): 0x01000000
(17) msp (/32): 0x20020000
(18) psp (/32): 0x00000000
(19) primask (/1): 0x00
(20) basepri (/8): 0x00
(21) faultmask (/1): 0x00
(22) control (/2): 0x00
(23) d0 (/64): 0x0000000000000000
(24) d1 (/64): 0x0000000000000000
(25) d2 (/64): 0x0000000000000000
(26) d3 (/64): 0x0000000000000000
(27) d4 (/64): 0x0000000000000000
(28) d5 (/64): 0x0000000000000000
(29) d6 (/64): 0x0000000000000000
(30) d7 (/64): 0x0000000000000000
(31) d8 (/64): 0x0000000000000000
(32) d9 (/64): 0x0000000000000000
(33) d10 (/64): 0x0000000000000000
(34) d11 (/64): 0x0000000000000000
(35) d12 (/64): 0x0000000000000000
(36) d13 (/64): 0x0000000000000000
(37) d14 (/64): 0x0000000000000000
(38) d15 (/64): 0x0000000000000000
(39) fpscr (/32): 0x00000000
===== Cortex-M DWT registers

1 REPLY 1
Breakthecake
Associate II

Hi there,

same topic: .... Unluckily, I am not allowed to ask a new question regarding Openocd issues (is that not the point about communities? The "ask a question" button was not greyed out...), so I attach my question here.

build error when setting up Openocd in Eclipse

make: *** [system/src/stm32l4xx/stm32l4xx_hal.o] Error 127

system: Mac, Eclipse, gcc, STM32L476 nucleo-64 with STM32L4476RG 64 pins

I am new to programming µC. Following the instructions of an old udemy course I got above mentioned message. Of course, different versions of Eclipse, Openocd etc. are used. I got stuck, as I do not know where to search for faults.

The lecture tries to set up Eclipse for use with Openocd and confirming with the debug of a blinky project. At an earlier stage, building of blinky was successful. After starting Openocd as "external tool" in Eclipse I got an error message.

The console throws out:

10:39:59 **** Build of configuration Debug for project Blinky-STM32L476 ****

make all

Building file: ../system/src/stm32l4xx/stm32l4xx_hal.c

Invoking: GNU ARM Cross C Compiler

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra -g3 -DSTM32L476xx -DDEBUG -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32l4xx" -std=gnu11 -MMD -MP -MF"system/src/stm32l4xx/stm32l4xx_hal.d" -MT"system/src/stm32l4xx/stm32l4xx_hal.o" -c -o "system/src/stm32l4xx/stm32l4xx_hal.o" "../system/src/stm32l4xx/stm32l4xx_hal.c"

/bin/sh: arm-none-eabi-gcc: command not found

make: *** [system/src/stm32l4xx/stm32l4xx_hal.o] Error 127

"make all" terminated with exit code 2. Build might be incomplete.

10:39:59 Build Failed. 2 errors, 0 warnings. (took 87ms)

I double checked the paths in "external tools configuration", but could not find anything conspicious. Using a mac, I filled in "openocd" only instead of adding the extension .exe as mentioned in the lecture (which was for Windows-PC) when setting up the location for the external tool:

(...) /openocd-esp32/bin/openocd

I was not sure about the point working directory, as the openocd folder structure of my up to date version is slightly different to the one shown in the old online course. The scripts folder is in a deeper branch in the version of my openocd folder So, what is the proper "working directory" path for the make process? But I assume this is not the issue causing the error.

Any help is warmly welcome!

Ciao Andreas