EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

OpenOCD in Windows Vista 64?

Started by henrym_33 September 4, 2009
Hi Everybody,

I'm new to the ARM platform, but I've got experience doing embedded development on PICs, AVRs, Motorola, etc for a long time in a Windows world.

I'm trying to set up the Eclipse/GCC environment using the Lynch tutorial on a Vista 64 machine (with Olimex LPC2378STK dev board) and I'm finding out that OpenOCD won't work under 64-bit Windows Vista. Something about the open source library that's linked in not being compatible with 64-bit systems. Is that true? I understand there are two different libraries possible, one having licensing issues (FTD2XX) that necessitates it must be built by the end user. Can one of these work for me but not the other?

If OpenOCD is a no-go on Vista 64, then what are my options for debugging ARM on Vista (changing OS is not an option at this point), hopefully using an open-source solution. I've searched around on Google but not found a definitive answer, although I admit to not understanding all the technical details yet. I'm on a tight budget so a debugger under say ~$100 is what I'm hoping to find. I had planned on using a Flyswatter but is that an option at this point?

Thanks...

An Engineer's Guide to the LPC2100 Series

I am running openocd-r717-20080619.exe on Vista Ultimate x64. I don't
recall having to bitch slap openocd onto the box.
My toolchain is
yagarto-bu-2.19.1_gcc-4.3.3-c-c++_nl-1.17.0_gi-6.8.50_20090311.exe.

I'm guessing you don't have it configured correctly for your target. It
will die if it can't connect to the target. Or are you having install
issues?
I'm am connecting to an Olimex ARM-USB-OCD
I run it under eclipse/gcc. I also do Java work, so i keep a separate
copy of eclipse to pollute with the gcc stuff. (IOW, i trashed my
eclipse installing the C-dev tools).

I start openocd in a cygwin shell and have eclipse connect to that.
openocd likes to be watched.

My target is an Embest LPCEB2300, which is a clone [1] of someone else's
lpc2368, so i'm pretty close to what you have.

dik

[1] My first invoice that was strictly Chinese, not an Engrish word to
be found on it. -- Had fun turning that one in.

Am 9/4/2009 11:40 AM, also sprach henrym_33:
> Hi Everybody,
>
> I'm new to the ARM platform, but I've got experience doing embedded development on PICs, AVRs, Motorola, etc for a long time in a Windows world.
>
> I'm trying to set up the Eclipse/GCC environment using the Lynch tutorial on a Vista 64 machine (with Olimex LPC2378STK dev board) and I'm finding out that OpenOCD won't work under 64-bit Windows Vista. Something about the open source library that's linked in not being compatible with 64-bit systems. Is that true? I understand there are two different libraries possible, one having licensing issues (FTD2XX) that necessitates it must be built by the end user. Can one of these work for me but not the other?
>
> If OpenOCD is a no-go on Vista 64, then what are my options for debugging ARM on Vista (changing OS is not an option at this point), hopefully using an open-source solution. I've searched around on Google but not found a definitive answer, although I admit to not understanding all the technical details yet. I'm on a tight budget so a debugger under say ~$100 is what I'm hoping to find. I had planned on using a Flyswatter but is that an option at this point?
>
> Thanks...
>
>
Here is my setup.
http://tech.groups.yahoo.com/group/lpc2000/message/41701

Am 9/4/2009 5:38 PM, also sprach Dick Balaska:
> I am running openocd-r717-20080619.exe on Vista Ultimate x64. I don't
> Am 9/4/2009 11:40 AM, also sprach henrym_33:
>
>> Hi Everybody,
>>
>> I'm new to the ARM platform, but I've got experience doing embedded development on PICs, AVRs, Motorola, etc for a long time in a Windows world.
>>
>> I'm trying to set up the Eclipse/GCC environment using the Lynch tutorial on a Vista 64 machine (with Olimex LPC2378STK dev board) and I'm finding out that OpenOCD won't work under 64-bit Windows Vista. Something about the open source library that's linked in not being compatible with 64-bit systems. Is that true? I understand there are two different libraries possible, one having licensing issues (FTD2XX) that necessitates it must be built by the end user. Can one of these work for me but not the other?
>>
>> If OpenOCD is a no-go on Vista 64, then what are my options for debugging ARM on Vista (changing OS is not an option at this point), hopefully using an open-source solution. I've searched around on Google but not found a definitive answer, although I admit to not understanding all the technical details yet. I'm on a tight budget so a debugger under say ~$100 is what I'm hoping to find. I had planned on using a Flyswatter but is that an option at this point?
>>
>> Thanks...
>>
>>

Thanks for the info, Dik. That's a lot to chew on for me. Since I'm still waiting for my LPC2378 board and flyswatter to arrive in the mail, I'm only setting up the development environment and book learnin' for now...

I think you're using an older version of OpenOCD (openocd-r717) that includes the commercial FTD2xx driver. According to http://openocd.berlios.de/web/, that's got licensing issues and is not distributed freely any more (see also http://www.yagarto.de/howto/openocd/note.html). Hence, only OpenOCD using open-source libftdi (32-bit only) is available and is not supporting Windows 64-bit versions. The ftdichip.com web site says FTD2XX supports all versions of Vista.

I was however able to find old versions of OpenOCD at http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/winarmtests/ (Googling Openocd-r717 thanks to you). ;-) I also can build my own version using the ftd2xx library under cygwin.

So I think my original question is answered...On 64-bit Windows systems for now OpenOCD using the FTD2XX library seems like the only open-source debugging option. I was worried that I would be screwed having already bought a debugger that wouldn't work on my OS. Sounds like it'll work fine once it's set up.

Thanks also for your config file setup - that'll be the next hurdle for me! As complicated as this can be, I enjoyed your remark "It feels a bit like driving a Model T with a manual choke and timing,
and no synchros in the tranny, but it works."!

Henry

--- In l..., Dick Balaska wrote:
>
> Here is my setup.
> http://tech.groups.yahoo.com/group/lpc2000/message/41701
>
> Am 9/4/2009 5:38 PM, also sprach Dick Balaska:
> > I am running openocd-r717-20080619.exe on Vista Ultimate x64. I don't
> > Am 9/4/2009 11:40 AM, also sprach henrym_33:
> >
> >> Hi Everybody,
> >>
> >> I'm new to the ARM platform, but I've got experience doing embedded development on PICs, AVRs, Motorola, etc for a long time in a Windows world.
> >>
> >> I'm trying to set up the Eclipse/GCC environment using the Lynch tutorial on a Vista 64 machine (with Olimex LPC2378STK dev board) and I'm finding out that OpenOCD won't work under 64-bit Windows Vista. Something about the open source library that's linked in not being compatible with 64-bit systems. Is that true? I understand there are two different libraries possible, one having licensing issues (FTD2XX) that necessitates it must be built by the end user. Can one of these work for me but not the other?
> >>
> >> If OpenOCD is a no-go on Vista 64, then what are my options for debugging ARM on Vista (changing OS is not an option at this point), hopefully using an open-source solution. I've searched around on Google but not found a definitive answer, although I admit to not understanding all the technical details yet. I'm on a tight budget so a debugger under say ~$100 is what I'm hoping to find. I had planned on using a Flyswatter but is that an option at this point?
> >>
> >> Thanks...
> >>
> >

I managed to get everything working on my Vista 64 machine. It took a few sorta painful days working with the openocd.cfg and gdb init scripts but now I'm able to remotely debug, single step, etc my program in Eclipse using my new Olimex LPC2378STK board and Flyswatter debugger.

I can also flash my program into the LPC using a flash script from inside Eclipse and the Flyswatter jtag (serial flash using Flash Magic over the flyswatter also works).

I think the tricky things to watch out for are the need to build OpenOCD (using the ftd2xx library) from a cygwin shell in Windows (or acquire an already built version, which isn't freely distributed anymore), and setting up the correct openocd.cfg script and gdb initialization (insode Eclipse) to get the debugger going. There's a lot of openocd and gdb script files floating around the 'net, but most of them seem to be for older versions of openocd that now have unsupported commands. I think this is where a lot of my pain came from.

For reference here's my openocd.cfg script:

#########################################################
#
# daemon configuration
#
#########################################################
telnet_port 4444
gdb_port 10000

#########################################################
#
# tell gdb our flash memory map
# and enable flash programming
#
#########################################################
gdb_memory_map enable
gdb_flash_program enable

#########################################################
#
# Interface, if you want to use an other interface
# you must replace this section here.
#
#########################################################
interface ft2232
ft2232_device_desc "Flyswatter A"
ft2232_layout "flyswatter"
ft2232_vid_pid 0x0403 0x6010
# try jtag_speed 15
jtag_speed 1
# Start slow, speed up after reset
# jtag_khz 30
#########################################################
#
# NXP LPC2378 ARM7TDMI-S with 512kB Flash and 32kB Local On-Chip SRAM (58kB total), clocked
# with 4MHz internal RC oscillator
#
#########################################################
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME lpc2378
}

if { [info exists ENDIAN] } {
set _ENDIAN $ENDIAN
} else {
set _ENDIAN little
}

if { [info exists CPUTAPID ] } {
set _CPUTAPID $CPUTAPID
} else {
set _CPUTAPID 0x4f1f0f0f
}
#########################################################
#
#delays on reset lines
#
#########################################################
jtag_nsrst_delay 200
jtag_ntrst_delay 200

#########################################################
#
# LPC2000 -> SRST causes TRST
#
# NOTE!!! LPCs need reset pulled while RTCK is low. 0 to activate
# JTAG, power-on reset is not enough, i.e. you need to perform a
# reset before being able to talk to the LPC2148, attach is not possible.
#
#########################################################
reset_config trst_and_srst srst_pulls_trst

jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID

set _TARGETNAME [format "%s.cpu" $_CHIPNAME]

target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi-s_r4

#########################################################
#
# LPC2378 has 32kB of SRAM on its main system bus (so-called Local On-Chip SRAM)
#
#########################################################
$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x40000000 -work-area-size 0x8000 -work-area-backup 0

# $_TARGETNAME configure -event reset-start {
# jtag_khz 30

$_TARGETNAME configure -event reset-init {
# Force target into ARM state
soft_reset_halt
# Do not remap 0x0000-0x0020 to anything but the flash (i.e. select
# "User Flash Mode" where interrupt vectors are _not_ remapped,
# and reside in flash instead).
#
# See section 7.1 on page 32 ("Memory Mapping control register") in
# "UM10139: Volume 1: LPC214x User Manual", Rev. 02 -- 25 July 2006.
# http://www.standardics.nxp.com/support/documents/microcontrollers/pdf/user.manual.lpc2141.lpc2142.lpc2144.lpc2146.lpc2148.pdf
mwb 0xE01FC040 0x01
}

# jtag_khz 1500

#########################################################
#
# LPC2378 has 512kB of FLASH, but upper 8kB are occupied by bootloader.
# After reset the chip uses its internal 4MHz RC oscillator
#
#########################################################
#flash bank lpc2000 0 0
flash bank lpc2000 0x0 0x0007D000 0 0 0 lpc2000_v2 4000 calc_checksum

# 4MHz / 6 = 666kHz, so use 500
jtag_khz 500

# init

# reset init

Here's my gdb init script (inside Eclipse debug config window):

target remote localhost:10000
monitor gdb_breakpoint_override hard
monitor reset
monitor mww 0xE01FC040 0x0001
monitor halt
load
thbreak main
continue

Here's my flash script (call from a .cmd file that gets called from Eclipse):

#########################################################
#
# Flash LPC2138 memory using openocd
# and a FTDI FT2232-based JTAG-interface
#
#########################################################
#
# daemon configuration
#
#########################################################
telnet_port 4444
gdb_port 10000

#########################################################
#
# Interface, if you want to use an other interface
# you must replace this section here.
#
#########################################################
interface ft2232
ft2232_device_desc "Flyswatter A"
ft2232_layout "flyswatter"
ft2232_vid_pid 0x0403 0x6010
# try jtag_speed 15
jtag_speed 1
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME lpc2378
}

if { [info exists ENDIAN] } {
set _ENDIAN $ENDIAN
} else {
set _ENDIAN little
}

if { [info exists CPUTAPID ] } {
set _CPUTAPID $CPUTAPID
} else {
set _CPUTAPID 0x4f1f0f0f
}

#########################################################
#
#delays on reset lines
#
#########################################################
jtag_nsrst_delay 200
jtag_ntrst_delay 200

#########################################################
#
# LPC2000 -> SRST causes TRST
#
# NOTE!!! LPCs need reset pulled while RTCK is low. 0 to activate
# JTAG, power-on reset is not enough, i.e. you need to perform a
# reset before being able to talk to the LPC2148, attach is not possible.
#
#########################################################
reset_config trst_and_srst srst_pulls_trst
#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
# jtag_device 4 0x1 0xf 0xe
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID

set _TARGETNAME [format "%s.cpu" $_CHIPNAME]

target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi-s_r4

$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x40000000 -work-area-size 0x8000 -work-area-backup 0

$_TARGETNAME configure -event reset-init {
# Force target into ARM state
soft_reset_halt
# Do not remap 0x0000-0x0020 to anything but the flash (i.e. select
# "User Flash Mode" where interrupt vectors are _not_ remapped,
# and reside in flash instead).
#
# See section 7.1 on page 32 ("Memory Mapping control register") in
# "UM10139: Volume 1: LPC214x User Manual", Rev. 02 -- 25 July 2006.
# http://www.standardics.nxp.com/support/documents/microcontrollers/pdf/user.manual.lpc2141.lpc2142.lpc2144.lpc2146.lpc2148.pdf
mwb 0xE01FC040 0x01
}

# flash-options LPC2378
# target_script 0 reset LPC2378_Flash.script
# working_area 0 0x40000000 0x8000 nobackup
# LPC2378 @ 12MHz / 0x7D000 from 500*1024 (not 512!)
flash bank lpc2000 0x0 0x0007D000 0 0 0 lpc2000_v2 4000 calc_checksum

jtag_khz 500

init
halt
#sleep 20
#wait_halt

flash write_image erase C:/Projects/ARM/LPC2378STK_Blinky/main.hex
#flash write_image erase C:/Projects/ARM/Original_Olimex_LPC-2378-STK_Firmware.hex

sleep 30
reset
#sleep 30
shutdown

Hope this helps somebody...

--- In l..., "henrym_33" wrote:
>
> Thanks for the info, Dik. That's a lot to chew on for me. Since I'm still waiting for my LPC2378 board and flyswatter to arrive in the mail, I'm only setting up the development environment and book learnin' for now...
>
> I think you're using an older version of OpenOCD (openocd-r717) that includes the commercial FTD2xx driver. According to http://openocd.berlios.de/web/, that's got licensing issues and is not distributed freely any more (see also http://www.yagarto.de/howto/openocd/note.html). Hence, only OpenOCD using open-source libftdi (32-bit only) is available and is not supporting Windows 64-bit versions. The ftdichip.com web site says FTD2XX supports all versions of Vista.
>
> I was however able to find old versions of OpenOCD at http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/winarmtests/ (Googling Openocd-r717 thanks to you). ;-) I also can build my own version using the ftd2xx library under cygwin.
>
> So I think my original question is answered...On 64-bit Windows systems for now OpenOCD using the FTD2XX library seems like the only open-source debugging option. I was worried that I would be screwed having already bought a debugger that wouldn't work on my OS. Sounds like it'll work fine once it's set up.
>
> Thanks also for your config file setup - that'll be the next hurdle for me! As complicated as this can be, I enjoyed your remark "It feels a bit like driving a Model T with a manual choke and timing,
> and no synchros in the tranny, but it works."!
>
> Henry
>
> --- In l..., Dick Balaska wrote:
> >
> > Here is my setup.
> > http://tech.groups.yahoo.com/group/lpc2000/message/41701
> >
> > Am 9/4/2009 5:38 PM, also sprach Dick Balaska:
> > > I am running openocd-r717-20080619.exe on Vista Ultimate x64. I don't
> > > Am 9/4/2009 11:40 AM, also sprach henrym_33:
> > >
> > >> Hi Everybody,
> > >>
> > >> I'm new to the ARM platform, but I've got experience doing embedded development on PICs, AVRs, Motorola, etc for a long time in a Windows world.
> > >>
> > >> I'm trying to set up the Eclipse/GCC environment using the Lynch tutorial on a Vista 64 machine (with Olimex LPC2378STK dev board) and I'm finding out that OpenOCD won't work under 64-bit Windows Vista. Something about the open source library that's linked in not being compatible with 64-bit systems. Is that true? I understand there are two different libraries possible, one having licensing issues (FTD2XX) that necessitates it must be built by the end user. Can one of these work for me but not the other?
> > >>
> > >> If OpenOCD is a no-go on Vista 64, then what are my options for debugging ARM on Vista (changing OS is not an option at this point), hopefully using an open-source solution. I've searched around on Google but not found a definitive answer, although I admit to not understanding all the technical details yet. I'm on a tight budget so a debugger under say ~$100 is what I'm hoping to find. I had planned on using a Flyswatter but is that an option at this point?
> > >>
> > >> Thanks...

The 2024 Embedded Online Conference