Eclipse+yagarto+OpenOCD+USBOCDTiny=Much Pain

I have been trying since yesterday to get a valid SAM7 development environment going.

Hardware:

Olimex SAM7-EX256 development board

Olimex JTAG USB OCD Tiny

Software:

Started with: Olimex “WinARM” for Dummies install

-After issues, updated the following:

Eclipse - Updated to latest

Eclipse CDT - Updated to latest

Zylin - Updated to latest

Cygwin - Updated to latest

yagarto - Updated to latest

OpenOCD - Updated to latest from yagarto

Source Code:

USB-RS232 Sample Code downloaded from Spark Fun

SAM7EX256 Ethernet Eclipse project from FreeRTOS

One thing I can definitely say is that this debug environment is no where near “plug and play”. I don’t want to list all the things I have had to play with to get as far as I have.

I am almost at wits end. As you can see, I have been trying everything I can imagine to get my configuration working.

Now, to the problem:

I finally have both project compiling just fine. I can also start OpenOCD, though I do get an error and some warnings as given below:

Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)

Error: arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed,

debugging is likely to be broken

Info: target.c:232 target_init_handler(): executing reset script ‘sam7flash.script’

Info: configuration.c:50 configuration_output_handler(): requesting target halt…

Warning: arm7_9_common.c:933 arm7_9_halt(): target was already halted

Info: configuration.c:50 configuration_output_handler(): target already halted

Info: configuration.c:50 configuration_output_handler(): waiting for target halted…

Info: configuration.c:50 configuration_output_handler(): target halted

Info: configuration.c:50 configuration_output_handler(): dcc downloads are enabled

Info: configuration.c:50 configuration_output_handler(): waiting for target halted…

Info: configuration.c:50 configuration_output_handler(): target halted

Info: configuration.c:50 configuration_output_handler(): core state: ARM

Info: configuration.c:50 configuration_output_handler(): flash ‘at91sam7’ found at 0x00100000

Info: configuration.c:50 configuration_output_handler(): #0: at91sam7 at 0x00100000, size 0x00040000,

buswidth 4, chipwidth 0

Info: configuration.c:50 configuration_output_handler(): #0: 0x00000000 (0x40000kB) erase state

unknown, protection state unknown

Info: configuration.c:50 configuration_output_handler():

Info: configuration.c:50 configuration_output_handler(): at91sam7 information: Chip is AT91SAM7X256

Info: configuration.c:50 configuration_output_handler(): cidr: 0x275b0940, arch: 0x0075, eproc:

ARM7TDMI, version:0x000, flashsize: 0x00040000

Info: configuration.c:50 configuration_output_handler(): master clock(estimated): 54275kHz

Info: configuration.c:50 configuration_output_handler(): pagesize: 256, lockbits: 16 0x0000, pages in

lock region: 64

Info: configuration.c:50 configuration_output_handler(): securitybit: 0, nvmbits: 0x4

Info: configuration.c:50 configuration_output_handler():

Info: configuration.c:50 configuration_output_handler(): cleared protection for sectors 0 through 15 on

flash bank 0

Info: configuration.c:50 configuration_output_handler(): erased sectors 0 through 0 on flash bank 0 in

0s 46875us

Info: configuration.c:50 configuration_output_handler(): wrote 8496 byte from file main.bin to flash

bank 0 at offset 0x00000000 in 1s 62486us (7.808926 kb/s)

I don’t know if that is a problem or not.

I then try and launch gdb. I get some strange warnings:

source .gdbinit

Warning: /cygdrive/C/gccfd/projects/sam7ex256/include: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/drv_inf: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/Compil/srcWinARM: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/Compil/srcIAR: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/Compil/Resource: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/Compil: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/.dep: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/include: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/drv_inf: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/Compil/srcWinARM: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/Compil/srcIAR: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/Compil/Resource: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/Compil: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256/.dep: No such file or directory.

Warning: /cygdrive/C/gccfd/projects/sam7ex256: No such file or directory.

No registers.

The debug window indicates the following:

sam7ex256 Debug [Zylin Embedded Degu(Cygwin)]

Embedded GDB (7/19/08 5:14 PM) (Suspended)

c:\gccfd\yagarto\bin\arm-elf.exe (7/29/08 5:14 PM)

I suspect an issue with cygwin, so I run bash and get the following:

tharon@tharonpc ~

$ cd /cygdrive/c/gccfd/projects/sam7ex256

tharon@tharonpc /cygdrive/c/gccfd/projects/sam7ex256

$ ls

AT91SAM7S-EK.h interrupt_Usart.lst main_org.o

Compil interrupt_Usart.o openocd_env_info.cmd

Makefile main.bin openocd_go_flash.cmd

armusbocd.cfg main.c readme.txt

cdc_enumerate.c main.elf sam7flash.script

cdc_enumerate.h main.lss sam7s_usb_uart.pnproj

cdc_enumerate.lst main.lst sam7s_usb_uart.pnps

cdc_enumerate.o main.map swi_handler_user.c

drv_inf main.o swi_handler_user.lst

include main.out swi_handler_user.o

interrupt_Usart.c main.sym

tharon@tharonpc /cygdrive/c/gccfd/projects/sam7ex256

$

So, when I try the directories that are giving it trouble from bash, I see them just fine using the same path. I don’t know if that is why gdb is not starting or not.

I am running out of ideas and I am getting very frustrated with this entire setup. I thought that by installing the environment from Olimex’s CD I would avoid this exact scenario of fighting with the tools for two days now. If it wasn’t for the fact that I know I can’t get another toolchain past management due to $$$, I think I would consider it right now.

If anyone would be kind enough to suggest something, I would very much appreciate it!

Regards

try using crossworks from rowley.co.uk

  • A nice IDE

  • GNU gcc toolchain

  • OpenOCD compatible

I had similar problems, but with Windows Vista, Olimex LPC-E2214-RB board, Olimex JTAG Tiny, CD with WinARM/openocd/Eclipse IDE/etc. I spent several painful days setting it up like you. The problem is definitely in the config file.

Problem solved with this config:

telnet_port 4444

gdb_port 3333

interface ft2232

ft2232_device_desc “Olimex OpenOCD JTAG TINY A”

ft2232_layout “olimex-jtag”

ft2232_vid_pid 0x15BA 0x0004

jtag_speed 20

reset_config trst_and_srst separate

jtag_device 4 0x1 0xf 0xe

jtag_nsrst_delay 333

jtag_ntrst_delay 333

daemon_startup reset

target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4

run_and_halt_time 0 30

target_script 0 reset oocd_flash2294.script

working_area 0 0x40000000 0x4000 nobackup

flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14746 calc_checksum

Good luck and don’t give up,

Gil

Gil,

Thanks for the feedback. I suspect it is something simple. Since I have a SAM7X256 I could not quite take your script exactly as is. I did make some changes based on your script and things look better, I eliminated some warnings and an error I was seeing. However, I still do not have a working debug environment, at least in the FreeRTOS demo environment. I might be able to do some more reading and tweak something to get it to work.

Closer, but not quite there. If someone is working with a SAM7X and would be kind enough to post their config file, that might do the trick.

As far as commercial toolchains go, I could never get it past management. It involves some politics I cannot get into here, but it would go over like a lead balloon. :cry:

I am to the point that I am willing to consider starting over from scratch if there was a greater likelihood of success. I have a laptop I could start from scratch with, that will need the tools sooner or later anyway. My environment been hacked on quite a bit so it might help to start with a clean slate. Therefore…

:arrow: I have an Olimex AT91SAM7X256 dev board and an Olimex JTAG-USB-OCD-Tiny. I need to be able to demonstrate Ethernet on this board and have a source code I can develop a custom application from. Forgetting all I have done previously, if anyone could PLEASE recommend a path that would get me there using open tools and source, I would greatly, greatly appreciate it.

Fortunately, or unfortunately, I will be pulled off for a bit to work on another project and will work on this project when there are gaps. Perhaps walking away for a bit will help me clear my head!

Speaking of confusion, the Yagarto website makes a point to say you have to use the gdb version of the tools and not the Insight version of the tools if you want to debug with GDB. However, Jim Lynch’s tutorial instructs one to download the “GI”/Insight version of the Yagarto tools but proceeds to describe setting up GDB. The Yargarto website points to sourceforge and there is ONLY the “Insight” version posted there. Is the warning on the Yagarto website no longer relevant? I had the “Insight” version initially, then installed the gdb verison instead but it didn’t help. It took some effort to find a gdb version.

Regards!

I’m glad it solved a few warnings and error. Some of the other problems I had were:

  1. The power supply for the board did not provide enough juice.

  2. Driver file ftdibus.inf JTAG tool description did not match the config’s.

  3. Slowed down the Jtag speed.

  4. Use actual osc frequency in flash bank (14.7456 MHz = 14746, rounded).

  5. target_script command was commented out in example config file.

Each took a couple of days to figure out and solve. That’s all I know about these issues. I’m glad it helped.

Good luck,

Gil

Thanks again. When I get a chance, I need to spend some time with the OpenOCD documentation. I need to see what the SAM7(x) equivalents are for some of those commands.

I didn’t plan on becoming an expert on open source debugging, only a user, but it looks like I will need to spend some time learning. At least I will be smarter before it is all done.

Regards

Gil,

What version of the Yargarto tools do you use? See previous post regarding the two versions and conflicting information on which to use.

Regards

Would you mind providing your script as well? I know there will be a lot of difference due to the different processors, but it might be worth taking a look at.

gdepaula:
I had similar problems, but with Windows Vista, Olimex LPC-E2214-RB board, Olimex JTAG Tiny, CD with WinARM/openocd/Eclipse IDE/etc. I spent several painful days setting it up like you. The problem is definitely in the config file.

Problem solved with this config:

target_script 0 reset oocd_flash2294.script

working_area 0 0x40000000 0x4000 nobackup

flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14746 calc_checksum

Good luck and don’t give up,

Gil

:cry:

The commercial version is $1500! We’ll switch architectures before we pay that kind of money, especially when we likely need two seats.

alejmrm:
try using crossworks from rowley.co.uk

  • A nice IDE

  • GNU gcc toolchain

  • OpenOCD compatible

Hello, all,

I am working with OpenOCD and arm-elf-gdb at the command line to see if I can find anything amiss that is preventing Eclipse from fully starting the debug session. I have tried two different .elf files, and in both cases I get a similar error when I actually connect gdb to OpenOCD:

C:\gccfd\projects\FreeRTOS\FreeRTOS\FreeRTOS Demo\ARM7_AT91SAM7X256_Eclipse\RTOS

Demo>c:\yagarto\bin\arm-elf-gdb.exe RTOSDemo.elf

GNU gdb 6.7.1

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-mingw32 --target=arm-elf”…

(gdb) target remote localhost:3333

Remote debugging using localhost:3333

warning: while parsing target memory map (at line 2): Required element is missing 0x001072b0 in start ()

(gdb) monitor reset

JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)

As you can see, I can issue commands to OpenOCD and can do things like reset and dump registers. I no longer suspect it is the OpenOCD config file that is the problem, as I can do everything from the command line. I am wondering if the strange memory warning might be giving me a clue as to what is wrong.

Is this something anyone has seen and can immediately point me to a solution?

Regards

Hi Gil

I’ve just been tearing my hear out with an Olimex ARM-USB-OCD/LPC2158/OpenOCD/Eclipse set up.

I found your config file through a google search, and just wanted to thank you for contributing it to this thread.

I’m now up and running/debugging - all for free!! Feeling quite good about it considering a work colleague is wanting to spend £3k per licence on (undoubtedly fine) IAR toolset!

Regards

Rob

Problem solved with this config:

telnet_port 4444

gdb_port 3333

interface ft2232

ft2232_device_desc “Olimex OpenOCD JTAG TINY A”

ft2232_layout “olimex-jtag”

ft2232_vid_pid 0x15BA 0x0004

jtag_speed 20

reset_config trst_and_srst separate

jtag_device 4 0x1 0xf 0xe

jtag_nsrst_delay 333

jtag_ntrst_delay 333

daemon_startup reset

target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4

run_and_halt_time 0 30

target_script 0 reset oocd_flash2294.script

working_area 0 0x40000000 0x4000 nobackup

flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14746 calc_checksum

Good luck and don’t give up,

Gil[/quote]

Rob,

For reference, what hardware are you running?

Regards