Jump to content

OpenOCD and cygwin causing stackdump

Recommended Posts

Continuing from where I left off in building up a development chain, I am trying to get openocd built, running and using gdb to debug in cygwin. I was able to generate an executable and set up a configuration item, based heavily off of a nice tutorial from Mauro Scomparin [1]. It did not appear that the trunk of the git tree of openocd contained the TI ICDI stuff yet, so I ended up using the patch similarly to what Mauro did in his.


So I now have an executable...when trying to launch it with an LM4F120XL configuration file like so:

pimmel@pig ~/stellaris/openocd-bin
$ ./openocd.exe --file ./LM4F120XL.cfg
Open On-Chip Debugger 0.7.0-dev-00089-ge9b3395 (2013-01-29-08:27)
Licensed under GNU GPL v2
For bug reports, read
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
Segmentation fault (core dumped)


I can't see a core dump but there is a stackdump that was generated:


pimmel@pig ~/stellaris/openocd-bin
$ cat openocd.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=0054A740
eax=00000000 ebx=004D072E ecx=00000000 edx=0000000E esi=80061085 edi=00000000
ebp=00000000 esp=00289040 program=C:\cygwin\home\pimmel\stellaris\openocd-bin\openocd.exe, pid 5912, thread main
cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame     Function  Args
End of stack trace




The all-mighty google has really not turned anything up for the STATUS_ACCESS_VIOLATION in conjunction with openocd and windows. Does anyone out there have any hints on where to start? 



[1] - http://scompoprojects.wordpress.com/2012/11/07/debugging-a-program-on-the-stellaris-launchpad-board/

Link to post
Share on other sites

Firstly i would try using OpenOCD master as support for the ICDI has been merged for a while.

I have built ICDI support using cygwin, however i use it to cross compile for native windows (mingw).


Infact i have just fixed a bug with this adapter that was causing random issues:





Link to post
Share on other sites

Hmmm....still running into issues here...

$ git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd;branch=master
Cloning into 'openocd'...remote: Counting objects: 42941, done.remote: Compressing objects: 100% (9317/9317), done.remote: Total 42941 (delta 35324), reused 40688 (delta 33498)Receiving objects: 100% (42941/42941), 9.52 MiB | 891 KiB/s, done.Resolving deltas: 100% (35324/35324), done.

pimmel@pig ~/tools/tmp$ cd openocd/

pimmel@pig ~/tools/tmp/openocd$ ./bootstrap
+ aclocal
+ libtoolize 
+ autoconf
+ autoheader
+ automake 
--copyconfigure.ac:21: installing './compile'configure.ac:29: installing './config.guess'configure.ac:29: installing './config.sub'configure.ac:8: installing './install-sh'configure.ac:8: installing './missing'Makefile.am: installing './INSTALL'doc/Makefile.am:1: installing 'doc/mdate-sh'doc/Makefile.am:1: installing 'doc/texinfo.tex'src/Makefile.am: installing './depcomp'Setting up submodulesSubmodule 'jimtcl' (http://repo.or.cz/r/jimtcl.git) registered for path 'jimtcl'Submodule 'tools/git2cl' (http://repo.or.cz/r/git2cl.git) registered for path 'tools/git2cl'Cloning into 'jimtcl'...Submodule path 'jimtcl': checked out '43d0866133a899532fb459a35860060add504923'Cloning into 'tools/git2cl'...Submodule path 'tools/git2cl': checked out '8373c9f74993e218a08819cbcdbab3f3564bbeba'Bootstrap complete. 
Quick build instructions:./configure --enable-maintainer-mode ....

pimmel@pig ~/tools/tmp/openocd$ ./configure --enable-maintainer-mode --enable-ti-icdi
[.... a lot of stuff ... ]
config.status: executing depfiles 
commandsconfig.status: executing libtool commands=== configuring in jimtcl (/home/pimmel/tools/tmp/openocd/jimtcl)
configure: running /bin/sh ./configure.gnu --disable-option-checking '--prefix=/usr/local'  '--enable-maintainer-mode' '--enable-ti-icdi' --cache-file=/dev/null --srcdir=.      0 [main] tclsh8.5 10048 child_info_fork::abort: C:\cygwin\bin\libtcl8.5.dll: Loaded to different address: parent(0x410000) != child(0x580000)autosetup/system.tcl:203 couldn't fork child process: resource temporarily unavailablecouldn't fork child process: resource temporarily unavailable    while executing"exec {*}$args 2>@1"    (procedure "exec-with-stderr" line 2)    invoked from within"exec-with-stderr sh $::autosetup(dir)/config.guess"    (procedure "config_guess" line 3)    invoked from within"config_guess"    invoked from within"if {$build eq ""} {        define build [config_guess]} else {        define build [config_sub $build]}"    (file "/home/pimmel/tools/tmp/openocd/jimtcl/autosetup/system.tcl" line 203)    invoked from within"source /home/pimmel/tools/tmp/openocd/jimtcl/autosetup/system.tcl"    ("uplevel" body line 1)    invoked from within"uplevel #0 [list source $source]"    (procedure "use" line 12)    invoked from within"use system"    (file "/home/pimmel/tools/tmp/openocd/jimtcl/autosetup/cc.tcl" line 29)    invoked from within"source /home/pimmel/tools/tmp/openocd/jimtcl/autosetup/cc.tcl"    ("uplevel" body line 1)    invoked from within"uplevel #0 [list source $source]"    (procedure "use" line 12)    invoked from within"use cc cc-shared cc-db"    (file "auto.def" line 5)    invoked from within"source $autosetup(autodef)"    (procedure "main" line 154)    invoked from within"main $argv"configure: error: ./configure.gnu failed for jimtcl


I'm beginning to wonder how I ended up with an executable before...

Looking through the OpenOCD forums, it looks like this has shown up before. Trying a couple of different things didn't seem to work either.

Plain ol' ./configure yielded the same jimtcl error. Any ideas? Am I missing a cygwin package?

Would you please post what steps you use to cross-compile for native mingw? Thanks!

-- EDIT --

Going off the libtcl.dll error, I tried removing tcl-tk from cygwin, and I got a bit further, with a makefile generated.

However, when make is isssued:

pimmel@pig ~/tools/tmp/openocd
$ make
make  all-recursive
make[1]: Entering directory `/home/pimmel/tools/tmp/openocd'
Making all in jimtcl
make[2]: Entering directory `/home/pimmel/tools/tmp/openocd/jimtcl'
/usr/bin/tclsh ./make-load-static-exts.tcl aio array clock eventloop file history namespace pack package readdir regexp syslog tclprefix binary glob nshelper oo stdlib tclcompat tree >_load-static-exts.c || ( rm _load-static-exts.c; exit 1)
cc -D_GNU_SOURCE -Wall  -I. -g -O2   -c -o _load-static-exts.o _load-static-exts.c
cc -D_GNU_SOURCE -Wall  -I. -g -O2   -c -o jim-subcmd.o jim-subcmd.c
cc -D_GNU_SOURCE -Wall  -I. -g -O2   -c -o jim-interactive.o jim-interactive.c
cc -D_GNU_SOURCE -Wall  -I. -g -O2   -c -o jim-format.o jim-format.c
cc -D_GNU_SOURCE -Wall  -I. -g -O2   -c -o jim.o jim.c
jim.c: In function ‘JimClock’:
jim.c:593:20: error: storage size of ‘tv’ isn’t known
jim.c:595:5: warning: implicit declaration of function ‘gettimeofday’
jim.c:593:20: warning: unused variable ‘tv’
jim.c:597:1: warning: control reaches end of non-void function
<builtin>: recipe for target `jim.o' failed
make[2]: *** [jim.o] Error 1
make[2]: Leaving directory `/home/pimmel/tools/tmp/openocd/jimtcl'
Makefile:426: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/pimmel/tools/tmp/openocd'
Makefile:333: recipe for target `all' failed
make: *** [all] Error 2
Link to post
Share on other sites

Okay, I had to modify some files for jimtcl....I didn't get some defs set, so it didn't find some POSIX-y files







Basically I had manually include unistd.h, sys/time.h, and dirent.h for these files as appropriate....


However, it built now....need to go check to see if it works....

Link to post
Share on other sites

Following on to build native mingw in cygwin i use the following configure line:


# bootstrap only needed on first checkout./bootstrap# build line for native 32bit windows./configure --enable-maintainer-mode --build=i686-pc-cygwin --host=i686-w64-mingw32 --disable-shared --disable-werror --enable-stlink# to build for 64bit we would use./configure --enable-maintainer-mode --build=i686-pc-cygwin --host=x86_64-w64-mingw32 --disable-shared --disable-werror --enable-stlink


You will need to have the windows native cross compiler installed

mingw64-i686-gcc-core etc for 32bit or

mingw64-x86_64-gcc-core etc for 64bit build


and also libusbx - http://sourceforge.net/projects/libusbx/files/releases/1.0.14/Windows/libusbx-1.0.14-win.7z/download

You will need to put the add the header and lib files to the compilers

create /usr/i686-w64-mingw32/sys-root/mingw/include/libusb-1.0/ and place libusb.h into it (note call it libusb-1.0 not libusbx-1.0

/usr/x86_64-w64-mingw32/sys-root/mingw/include/libusb-1.0/ for 64bit compiler.


next add the correct lib (from above archive) to either below. i use the static one.




As a note I use enable-stlink as it builds for the ti-icdi as well, they use the same driver backend so are built together.




Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...