OpenOCD Cross Compile - Segmentation Fault

Hi,

I’m trying to implement an ETHERNET JTAG Interface with the Atmel ATNGW100. Unfortunately I get a “SEGMENTATION FAULT” Error Message while running OpenOCD on the NGW100.

I Cross-Compiled OpenOCD (SVN branch) with

./configure --enable-dummy --host=avr32 --target=avr32
CC=avr32-linux-gcc CFLAGS="-g -O0"
make

While running OpenOCD on the NGW I get this Output:

openocd: can't resolve symbol
'atexit'                                                                            

Open On-Chip Debugger 1.0 (2009-01-17-19:25)
svn:1220M                                                            
BUGS? Read
http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS                                                 

$URL:
svn://svn.berlios.de/openocd/openocd/branches/openocd_1_0_branch/src/openocd.c
$                            
Debug:   5 12 configuration.c:88 find_file(): found
mechabrick2.cfg                                               
Debug:   7 20 command.c:91 script_command(): script_command -
telnet_port                                         
Debug:   8 21 command.c:108 script_command(): script_command -
telnet_port, argv[0]=ocd_telnet_port               
Debug:   9 21 command.c:108 script_command(): script_command -
telnet_port, argv[1]=4444                          
Debug:   11 24 command.c:91 script_command(): script_command -
gdb_port                                           
Debug:   12 25 command.c:108 script_command(): script_command -
gdb_port, argv[0]=ocd_gdb_port                    
Debug:   13 26 command.c:108 script_command(): script_command -
gdb_port, argv[1]=3333                            
Debug:   15 28 command.c:91 script_command(): script_command -
interface                                          
Debug:   16 29 command.c:108 script_command(): script_command -
interface, argv[0]=ocd_interface                  
Debug:   17 30 command.c:108 script_command(): script_command -
interface, argv[1]=dummy                          
Debug:   19 32 command.c:91 script_command(): script_command -
jtag_speed                                         
Debug:   20 33 command.c:108 script_command(): script_command -
jtag_speed, argv[0]=ocd_jtag_speed                
Debug:   21 34 command.c:108 script_command(): script_command -
jtag_speed, argv[1]=0                             
Debug:   22 34 jtag.c:2406 handle_jtag_speed_command(): handle jtag
speed                                         
User:    23 35 command.c:375 command_print(): jtag_speed:
0                                                       
Debug:   25 38 command.c:91 script_command(): script_command -
reset_config                                       
Debug:   26 39 command.c:108 script_command(): script_command -
reset_config, argv[0]=ocd_reset_config            
Debug:   27 39 command.c:108 script_command(): script_command -
reset_config, argv[1]=trst_and_srst               
Debug:   28 40 command.c:108 script_command(): script_command -
reset_config, argv[2]=srst_pulls_trst             
Debug:   30 41 command.c:91 script_command(): script_command -
reset_config                                       
Debug:   31 42 command.c:108 script_command(): script_command -
reset_config, argv[0]=ocd_reset_config            
Debug:   32 42 command.c:108 script_command(): script_command -
reset_config, argv[1]=trst_and_srst               
Debug:   33 43 jtag.c:1741 jim_newtap_cmd(): Creating New Tap, Chip:
at91rm9200, Tap: cpu, Dotted: at91rm9200.cpu,s
Debug:   34 44 jtag.c:1761 jim_newtap_cmd(): Processing option:
-irlen                                            
Debug:   35 45 jtag.c:1761 jim_newtap_cmd(): Processing option:
-ircapture                                        
Debug:   36 46 jtag.c:1761 jim_newtap_cmd(): Processing option:
-irmask                                           
Debug:   37 46 jtag.c:1761 jim_newtap_cmd(): Processing option:
-expected-id                                      
Debug:   38 47 jtag.c:1853 jim_newtap_cmd(): Created Tap: at91rm9200.cpu
@ abs position 0, irlen 4, capture: 0x1 mf
Debug:   39 48 target.c:3950 jim_target(): Target command
params:                                                 
Debug:   40 49 target.c:3951 jim_target(): target create at91rm9200.cpu
arm920t -endian little -chain-position at9
Debug:   42 79 command.c:91 script_command(): script_command -
init                                               
Debug:   43 79 command.c:108 script_command(): script_command - init,
argv[0]=ocd_init
Segmentation Fault

I also tried to Debug “openocd” with gdb.

avr32-linux-gdb gdb openocd
GNU gdb 6.7.1.atmel.1.0.3
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=avr32-linux"...
(no debugging symbols found)
"/home/alex/embedded_linux/openocd/branches/openocd_1_0_branch/src/openocd"
is not a core dump: File format not recognized
(gdb) target remote 192.168.1.201:3334
Remote debugging using 192.168.1.201:3334
(no debugging symbols found)
0x84b8aa2a in ?? () from /lib/ld-linux.so.2
(gdb) continue
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) where
#0  0x00000000 in ?? ()
#1  0x223d0000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thanks for your help.

Alex

This i s an interesting project.

Cross compiling 0x86 applications to things like ARM and in your case AVR32 does have a lot of pitfalls.

I am no expert on the AVR32 so I can only speak generally.

The sort of problems you get are things like endianess, data alligment, size of types issues.

The best way to fix your problem is to try and debug it with gdb.

I am sure any fixes of these sort of issues will be welcomed as patches.

Remember to keep the 0x86 version working as well!

could you provide a log of the configure ?

you should only need the host line to cross-compile the target should not be required.

Cheers

Spen

Hi,

OpenOcd cleanly cross-compiled and runs nicely on Linux OpenWrt based hardware.

All that was required is to specify the --host option when calling ./configure for OpenOcd.

To make the Omnima Embedded Controller connect to LPC2103 directly using GPIOs instead of a dedicated Wiggler adapter we’ve modified parport.c to talk to the Linux gpio kernel module. The gpio lines where connected to the LPC2103 JTAG signals.

It’s a neat solution as OpenOcd runs on the controller and exposes the debug server over the LAN so there is no software needed to be installed or running on the development machine.

Here are the details: [1 and [2

The next step would be to provide a dedicated Linux gpio module for communication with JTAG devices instead of having to overwrite parport.c.

Dean](http://www.omnima.co.uk/forums/index.php?showtopic=96)](http://www.omnima.co.uk/forums/index.php?showtopic=50&view=findpost&p=218)