2012-08-28 12:03 AM
I am trying to get OpenOCD to work with my STM32F4Discovery board and I get the following error:
fabio@fs-1:~/workspace/stm32_code/test$ openocd -d 3 -f ./openocd.cfg
Open On-Chip Debugger 0.6.0-rc1-dev-00015-g47728f9 (2012-08-27-23:46)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
User : 11 2 command.c:549 command_print(): debug_level: 3
Debug: 12 2 configuration.c:45 add_script_search_dir(): adding /home/fabio/.openocd
Debug: 13 2 configuration.c:45 add_script_search_dir(): adding /usr/local/share/openocd/site
Debug: 14 2 configuration.c:45 add_script_search_dir(): adding /usr/local/share/openocd/scripts
Debug: 15 2 configuration.c:86 find_file(): found ./openocd.cfg
Debug: 16 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_telnet_port 4444
Debug: 17 2 command.c:145 script_debug(): command - telnet_port ocd_telnet_port 4444
Debug: 19 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_gdb_port 3333
Debug: 20 2 command.c:145 script_debug(): command - gdb_port ocd_gdb_port 3333
Debug: 22 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_interface stlink-v2
Debug: 23 2 command.c:145 script_debug(): command - interface ocd_interface stlink-v2
Error: 25 2 adapter.c:183 handle_interface_command(): The specified debug interface was not found (stlink-v2)
User : 26 2 command.c:549 command_print(): The following debug interfaces are available:
Debug: 27 2 command.c:631 run_command(): Command failed with error code -101
User : 28 2 command.c:669 command_run_line(): Runtime Error: ./openocd.cfg:5:
in procedure 'script'
at file ''embedded:startup.tcl'', line 58
in procedure 'interface' called at file ''./openocd.cfg'', line 5
I am using the following config file:
#daemon configuration
telnet_port 4444
gdb_port 3333
# Interface (using versaloon)
interface stlink-v2
transport select swd
swd_mode 2
swd_delay 2
set WORKAREASIZE 0x800
source [find target/stmcfg]
Can somebody shine me some light to this?
#openocd-stlink
2012-08-28 10:31 AM
This is just a guess, but maybe your openocd binary was compiled without the ''stlink-v2'' interface. Did you include ''--enable-stlink'' on the command line for configure?
Here's what I use:./configure --verbose --enable-maintainer-mode --enable-stlink --no-create --no-recursion --disable-verbose-usb-io --disable-verbose-usb-commsYou can check the config.log file in your build directory to see how things are set up.2012-08-29 07:22 AM
I've tried... no luck.
I am looking at the config.log file and there are errors. Here are the first few lines of it:running configure, to aid debugging if configure makes a mistake.
It was created by openocd configure 0.6.0-rc1-dev, which was
generated by GNU Autoconf 2. Invocation command line was
$ ./configure --verbose --enable-maintainer-mode --enable-stlink --no-create --no-recursion --disable-verbose-usb-io --disable-verbose-usb-comms
## --------- ##
## Platform. ##
## --------- ##
hostname = fs-1
uname -m = i686
uname -r = 3.2.0-29-generic-pae
uname -s = Linux
uname -v = #46-Ubuntu SMP Fri Jul 27 17:25:43 UTC 2012
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/lib/lightdm/lightdm
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /home/fabio/sat/bin/
PATH: /home/fabio/apps/bin/
PATH: /home/fabio/sat/bin/
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2515: checking for a BSD-compatible install
configure:2583: result: /usr/bin/install -c
configure:2594: checking whether build environment is sane
configure:2644: result: yes
configure:2785: checking for a thread-safe mkdir -p
configure:2824: result: /bin/mkdir -p
configure:2837: checking for gawk
configure:2867: result: no
configure:2837: checking for mawk
configure:2853: found /usr/bin/mawk
configure:2864: result: mawk
configure:2875: checking whether make sets $(MAKE)
configure:2897: result: yes
configure:2978: checking whether to enable maintainer-specific portions of Makefiles
configure:2987: result: yes
configure:3059: checking for gcc
configure:3075: found /usr/bin/gcc
configure:3086: result: gcc
configure:3315: checking for C compiler version
configure:3324: gcc --version >&5
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3335: $? = 0
configure:3324: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configure:3335: $? = 0
configure:3324: gcc -V >&5
gcc: error: unrecognized option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3335: $? = 4
configure:3324: gcc -qversion >&5
gcc: error: unrecognized option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3335: $? = 4
configure:3355: checking whether the C compiler works
configure:3377: gcc conftest.c >&5
configure:3381: $? = 0
configure:3429: result: yes
configure:3432: checking for C compiler default output file name
configure:3434: result: a.out
configure:3440: checking for suffix of executables
configure:3447: gcc -o conftest conftest.c >&5
configure:3451: $? = 0
configure:3473: result:
configure:3495: checking whether we are cross compiling
configure:3503: gcc -o conftest conftest.c >&5
configure:3507: $? = 0
configure:3514: ./conftest
configure:3518: $? = 0
configure:3533: result: no
configure:3538: checking for suffix of object files
configure:3560: gcc -c conftest.c >&5
configure:3564: $? = 0
configure:3585: result: o
configure:3589: checking whether we are using the GNU C compiler
configure:3608: gcc -c conftest.c >&5
configure:3608: $? = 0
configure:3617: result: yes
configure:3626: checking whether gcc accepts -g
configure:3646: gcc -c -g conftest.c >&5
configure:3646: $? = 0
configure:3687: result: yes
configure:3704: checking for gcc option to accept ISO C89
configure:3768: gcc -c -g -O2 conftest.c >&5
configure:3768: $? = 0
configure:3781: result: none needed
configure:3812: checking for style of include used by make
configure:3840: result: GNU
configure:3866: checking dependency style of gcc
configure:3977: result: gcc3
configure:3992: checking for gcc option to accept ISO C99
configure:4141: gcc -c -g -O2 conftest.c >&5
conftest.c:61:29: error: expected ';', ',' or ')' before 'text'
conftest.c: In function 'main':
conftest.c:115:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'newvar'
conftest.c:115:18: error: 'newvar' undeclared (first use in this function)
conftest.c:115:18: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:125:3: error: 'for' loop initial declarations are only allowed in C99 mode
conftest.c:125:3: note: use option -std=c99 or -std=gnu99 to compile your code
configure:4141: $? = 1
2012-08-29 11:34 AM
Well, let's back up.... Is there some reason you don't want to use the built-in .cfg for that board?
$ openocd -f board/stm32f4discovery.cfgOpen On-Chip Debugger 0.6.0-rc1-dev-00015-g47728f9-dirty (2012-08-28-15:48)Licensed under GNU GPL v2For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html1000 kHzsrst_only separate srst_nogate srst_open_drainInfo : clock speed 1000 kHzInfo : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints2012-08-29 06:01 PM
Hey,
That works!!! It must have been something done wrong in the .cfg file.Thanks