Bug 137945 - devel/openocd 0.2.0 fails to find ATMEL SAM-ICE as Segger jlink
Summary: devel/openocd 0.2.0 fails to find ATMEL SAM-ICE as Segger jlink
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-19 05:30 UTC by Robert Jenssen
Modified: 2010-02-12 10:20 UTC (History)
0 users

See Also:


Attachments
file.diff (587 bytes, patch)
2009-08-19 05:30 UTC, Robert Jenssen
no flags Details | Diff
patch-src-jtag-jlink.c (563 bytes, application/octet-stream)
2009-09-15 23:54 UTC, CeDeROM
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Jenssen 2009-08-19 05:30:00 UTC
Thanks for updating the openocd port. 

I find that the original source needs to be patched to work with the ATMEL SAM-ICE (a.k.a. Segger jlink) on FreeBSD. In the attached patch the extra find_jlink_device() and usb_open() calls in openocd-0.2.0/src/jtag/jlink.c:jlink_usb_open() are #ifdef'ed out.

There is a lengthy thread at:
http://lists.berlios.de/pipermail/openocd-development/2009-July/009397.html
FreeBSD isn't mentioned. It seems there is a portability problem in libusb.

Fix: Patch with the attached file and recompile giving:


/usr/local/arm-toolchain/bin/openocd -f ./samice.cfg
Open On-Chip Debugger 0.2.0 (2009-08-03-16:55) Release
$URL: http://svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.2.0/src/openocd.c $
For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
RCLK - adaptive
fast memory access is enabled
core state: ARM
Info : J-Link initialization started / target CPU reset initiated
Info : J-Link ARM V8 compiled Jun 30 2009 11:00:16
Info : JLink caps 0xb9ff7bbf
Info : JLink hw version 80000
Info : JLink max mem block 9792
Info : Vref = 3.280 TCK = 1 TDI = 0 TDO = 1 TMS = 0 SRST = 0 TRST = 0

Info : J-Link JTAG Interface ready
Info : JTAG tap: sam7s256.cpu tap/device found: 0x3f0f0f0f (mfg: 0x787, part: 0xf0f0, ver: 0x3)
Info : JTAG Tap/device matched
target state: halted
target halted in ARM state due to breakpoint, current mode: Supervisor
cpsr: 0x40000053 pc: 0x00101a18




Patch attached with submission follows:
How-To-Repeat: I am using an ATMEL AT91SAM7S-EK baord with the ATMEL SAM-ICE JTAG emulator. Using the following samice.cfg:

# Daemon configuration
telnet_port 4444
gdb_port 3333

# Interface is SAM-ICE
interface jlink
jtag_khz 0

reset_config srst_only srst_pulls_trst

set _CHIPNAME sam7s256
set _ENDIAN little
set _CPUTAPID 0x3f0f0f0f
set _TARGETNAME [format "%s.cpu" $_CHIPNAME]

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

target create $_TARGETNAME arm7tdmi \
       -endian $_ENDIAN \
       -chain-position $_TARGETNAME \
       -variant arm7tdmi \
       -work-area-virt 0 \
       -work-area-phys 0x00200000 \
       -work-area-size 0x4000 \
       -work-area-backup 0

# Commands performed after a reset-init event
$_TARGETNAME configure -event reset-init {
   mww 0xfffffd44 0x00008000
   mww 0xfffffd08 0xa5000001
   mww 0xfffffc20 0x00000601
   sleep 100
   mww 0xfffffc30 0x00000001
   sleep 1000
   mww 0xffffff60 0x003c0100
   sleep 100
}

flash bank at91sam7 0 0 0 0 0
arm7_9 fast_memory_access enable
armv4_5 core_state arm

init
halt

# end of samice.cfg

I run:

/usr/local/bin/openocd -f ./samice.cfg
Open On-Chip Debugger 0.2.0 (2009-08-19-13:58) Release
$URL: http://svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.2.0/src/openocd.c $
For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
RCLK - adaptive
fast memory access is enabled
core state: ARM
Error: Cannot find jlink Interface! Please check connection and permissions.
Runtime error, file "./samice.cfg", line 47:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2009-08-27 10:38:18 UTC
Maintainer of devel/openocd,

Please note that PR ports/137945 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/137945

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2009-08-27 10:38:19 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 CeDeROM 2009-09-15 23:54:54 UTC
Hello and sorry for the huge delay!

I have no Jlink interface to verify, but I can see Robert's log looks fine.
My only remark is that WRKSRC is already set to openocd-0.2.0, so this
part should be removed from the patch to work correctly.

Best regards,
Tomek

-- 
CeDeROM, http://www.tomek.cedro.info
Comment 4 Philip M. Gollucci freebsd_committer freebsd_triage 2010-01-18 07:26:48 UTC
ping....
Comment 5 Pav Lucistnik freebsd_committer freebsd_triage 2010-02-12 10:06:50 UTC
State Changed
From-To: feedback->closed

Committed, thanks!
Comment 6 dfilter service freebsd_committer freebsd_triage 2010-02-12 10:12:53 UTC
pav         2010-02-12 10:12:44 UTC

  FreeBSD ports repository

  Modified files:
    devel/openocd        Makefile 
  Added files:
    devel/openocd/files  patch-src-jtag-jlink.c 
  Log:
  - Fix runtime of jlink module
  
  PR:             ports/137945
  Submitted by:   Robert Jenssen <robertjenssen@ozemail.com.au>
  Approved by:    CeDeROM <tomek.cedro@gmail.com> (maintainer)
  
  Revision  Changes    Path
  1.3       +1 -0      ports/devel/openocd/Makefile
  1.1       +19 -0     ports/devel/openocd/files/patch-src-jtag-jlink.c (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"