Re: [Openocd-development] arm-jtag-ew + swd

2011-10-18 Thread Tomek CEDRO
On Tue, Oct 18, 2011 at 2:47 AM, Michael Ashton d...@gtf.org wrote:
 Hi,
 I'm wondering if anyone can say whether it's possible, or might ever be
 possible, to use the Olimex ARM-JTAG-EW with SWD in OpenOCD?
 I can't find any mention of SWD in arm-jtag-ew.c, but I'm not sure whether
 that really means anything.
 thanks! --Michael

Driver is generic for FT2232 devices, you can play with some
resistor/diode to make JTAG interface work as SWD :-)

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


[Openocd-development] clang static analyzer

2011-10-18 Thread Øyvind Harboe
Does anyone want to take clang static analyzer for a spin on openocd?

http://clang-analyzer.llvm.org/scan-build.html

-- 
Øyvind Harboe - Can Zylin Consulting help on your project?
US toll free 1-866-980-3434
http://www.zylin.com/
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


[Openocd-development] New patch to review for openocd: cc362b6 xscale: fix bug in xscale_receive()

2011-10-18 Thread Gerrit
This is an automated email from Gerrit.

?yvind Harboe (oyvindhar...@gmail.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/32

-- gerrit
commit cc362b6a38d9eaa1d30af13cdf2cb6fe1bb042a5
Author: Matt Reimer mrei...@sdgsystems.com
Date:   Mon Sep 19 10:30:13 2011 -0400

xscale: fix bug in xscale_receive()

The code in xscale_receive() that tries to skip invalid reads (i.e.
reads that don't have the DBG_SR[0] 'valid' bit set) seems to be
wrong, as it only looks at the first word's valid flag rather than
each word's own valid flag. Am I reading the code correctly? If so,
the attached patch should fix it.

If this looks correct, I'll generate a proper patch and commit message.

Matt

Change-Id: I74ebe2ad7a36d340a9dd3b8487578b6ea7f3cf1e
Signed-off-by: Øyvind Harboe oyvind.har...@zylin.com

diff --git a/src/target/xscale.c b/src/target/xscale.c
index 3b56745..b469b86 100644
--- a/src/target/xscale.c
+++ b/src/target/xscale.c
@@ -317,7 +317,7 @@ static int xscale_receive(struct target *target, uint32_t 
*buffer, int num_words
/* examine results */
for (i = words_done; i  num_words; i++)
{
-   if (!(field0[0]  1))
+   if (!(field0[i]  1))
{
/* move backwards if necessary */
int j;

-- 
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] clang static analyzer

2011-10-18 Thread Spencer Oliver

On 18/10/2011 18:18, Øyvind Harboe wrote:

Does anyone want to take clang static analyzer for a spin on openocd?

http://clang-analyzer.llvm.org/scan-build.html



seems jenkins already has a plugin for that :)
https://wiki.jenkins-ci.org/display/JENKINS/Clang+Scan-Build+Plugin

Spen
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] clang static analyzer

2011-10-18 Thread Øyvind Harboe
On Tue, Oct 18, 2011 at 9:46 PM, Spencer Oliver s...@spen-soft.co.uk wrote:
 On 18/10/2011 18:18, Øyvind Harboe wrote:

 Does anyone want to take clang static analyzer for a spin on openocd?

 http://clang-analyzer.llvm.org/scan-build.html


 seems jenkins already has a plugin for that :)
 https://wiki.jenkins-ci.org/display/JENKINS/Clang+Scan-Build+Plugin

Can we have it? :-)

Perhaps we can add that as an additional lint/analysis check step so that
we can weed out more.


-- 
Øyvind Harboe - Can Zylin Consulting help on your project?
US toll free 1-866-980-3434
http://www.zylin.com/
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


[Openocd-development] New patch to review for openocd: 2ce508b jlink libusb1 driver with libusb1 common driver interface.

2011-10-18 Thread Gerrit
This is an automated email from Gerrit.

Mauro Gamba (maurill...@gmail.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/33

-- gerrit
commit 2ce508b63db8e59caec36e7b28f5847d91f7cd35
Author: Mauro Gamba maurill...@gmail.com
Date:   Mon Oct 17 22:44:31 2011 +0200

jlink libusb1 driver with libusb1 common driver interface.

It add a libusb1 common interface useful for other driver.

Change-Id: I7eb045d4e2bd553abefad53f3f4023ff46b0f5f6
Signed-off-by: Mauro Gamba maurill...@gmail.com

diff --git a/configure.ac b/configure.ac
index d0386bc..f39e43b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1052,7 +1052,7 @@ fi
 
 # check for usb.h when a driver will require it
 build_usb=no
-if test $build_jlink = yes -o $build_vsllink = yes -o $build_usbprog = yes -o \
+if test -o $build_vsllink = yes -o $build_usbprog = yes -o \
   $build_rlink = yes -o $build_ulink = yes -o $build_armjtagew = yes
 then
   AC_CHECK_HEADERS([usb.h],[],
@@ -1060,6 +1060,16 @@ then
   build_usb=yes
 fi
 
+# check for libusb.h when a driver will require it
+build_libusb=no
+if test $build_jlink = yes
+then
+  AC_CHECK_HEADERS([libusb-1.0/libusb.h],[],
+  [AC_MSG_ERROR([libusb.h is required to build some OpenOCD driver(s)])])
+  build_libusb=yes
+fi
+
+
 AM_CONDITIONAL(RELEASE, test $build_release = yes)
 AM_CONDITIONAL(PARPORT, test $build_parport = yes)
 AM_CONDITIONAL(DUMMY, test $build_dummy = yes)
@@ -1089,6 +1099,7 @@ AM_CONDITIONAL(ARMJTAGEW, test $build_armjtagew = yes)
 AM_CONDITIONAL(REMOTE_BITBANG, test $build_remote_bitbang = yes)
 AM_CONDITIONAL(BUSPIRATE, test $build_buspirate = yes)
 AM_CONDITIONAL(USB, test $build_usb = yes)
+AM_CONDITIONAL(USB1, test $build_libusb = yes)
 AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin = yes)
 AM_CONDITIONAL(IS_MINGW, test $is_mingw = yes)
 AM_CONDITIONAL(IS_WIN32, test $is_win32 = yes)
diff --git a/src/Makefile.am b/src/Makefile.am
index 8375683..94d81c2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -84,9 +84,6 @@ endif
 if USBPROG
 LIBUSB = -lusb
 else
-if JLINK
-LIBUSB = -lusb
-else
 if RLINK
 LIBUSB = -lusb
 else
@@ -101,6 +98,11 @@ endif
 endif
 endif
 endif
+
+if JLINK
+LIBUSB1 = -lusb-1.0
+else
+LIBUSB1 =
 endif
 
 libopenocd_la_LIBADD = \
@@ -114,7 +116,7 @@ libopenocd_la_LIBADD = \
$(top_builddir)/src/server/libserver.la \
$(top_builddir)/src/rtos/librtos.la \
$(top_builddir)/src/helper/libhelper.la \
-   $(FTDI2232LIB) $(MINGWLDADD) $(LIBUSB)
+   $(FTDI2232LIB) $(MINGWLDADD) $(LIBUSB) $(LIBUSB1)
 
 STARTUP_TCL_SRCS = \
$(srcdir)/helper/startup.tcl \
diff --git a/src/jtag/drivers/Makefile.am b/src/jtag/drivers/Makefile.am
index 408ea81..7842e84 100644
--- a/src/jtag/drivers/Makefile.am
+++ b/src/jtag/drivers/Makefile.am
@@ -20,6 +20,10 @@ if USB
 DRIVERFILES += usb_common.c
 endif
 
+if USB1
+DRIVERFILES += libusb_common.c
+endif
+
 if BITBANG
 DRIVERFILES += bitbang.c
 endif
@@ -93,6 +97,7 @@ noinst_HEADERS = \
rlink_dtc_cmd.h \
rlink_ep1_cmd.h \
rlink_st7.h \
-   usb_common.h
+   usb_common.h \
+   libusb_common.h
 
 MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c
index adaa640..d59c052 100644
--- a/src/jtag/drivers/jlink.c
+++ b/src/jtag/drivers/jlink.c
@@ -30,7 +30,7 @@
 
 #include jtag/interface.h
 #include jtag/commands.h
-#include usb_common.h
+#include libusb_common.h
 
 /* See Segger's public documentation:
  * Reference manual for J-Link USB Protocol
@@ -50,7 +50,7 @@ 
http://www.segger.com/cms/admin/uploads/productDocs/RM08001_JLinkUSBProtocol.pdf
 #define PID 0x0101, 0x0102, 0x0103, 0x0104
 
 #define JLINK_WRITE_ENDPOINT   0x02
-#define JLINK_READ_ENDPOINT0x81
+#define JLINK_READ_ENDPOINT0x81
 
 static unsigned int jlink_write_ep = JLINK_WRITE_ENDPOINT;
 static unsigned int jlink_read_ep = JLINK_READ_ENDPOINT;
@@ -199,7 +199,7 @@ static void jlink_tap_append_scan(int length, uint8_t 
*buffer,
 
 /* Jlink lowlevel functions */
 struct jlink {
-   struct usb_dev_handle* usb_handle;
+   struct libusb_device_handle* usb_handle;
 };
 
 static struct jlink *jlink_usb_open(void);
@@ -1407,10 +1407,11 @@ static int jlink_tap_execute(void)
 
 static struct jlink* jlink_usb_open()
 {
-   usb_init();
-
-   struct usb_dev_handle *dev;
-   if (jtag_usb_open(vids, pids, dev) != ERROR_OK)
+   libusb_device_handle *devh;
+   libusb_device *dev;
+   struct libusb_config_descriptor *config;
+   
+   if (jtag_libusb_open(vids, pids, devh) != ERROR_OK)
return NULL;
 
/* BE ***VERY CAREFUL*** ABOUT MAKING CHANGES IN THIS
@@ -1426,7 +1427,7 @@ static struct jlink* jlink_usb_open()
 
 #if IS_WIN32 == 0
 
-   usb_reset(dev);
+   libusb_reset_device(devh);
 
 #if IS_DARWIN == 0
 
@@ -1434,7 +1435,7 @@ static struct jlink* jlink_usb_open()
/* reopen jlink after usb_reset
 * on win32 

Re: [Openocd-development] clang static analyzer

2011-10-18 Thread Marti Bolivar

/delurk

I ran scan-build from today's llvm and clang trunks on openocd commit 
0dac042a107f000936995ea468c3fa02b9896fb6 as follows:


$ scan-build ./configure --enable-maintainer-mode
$ scan-build make

The result was a directory full of HTML reports. They're readable in 
firefox, but the output said the right way to look at them is with 
scan-view.


Even tgz'ed, the output is 5.4 MB, so I'm not sure if it's appropriate 
for inclusion as an attachment on this list. I'll leave it here for now:


http://static.leaflabs.com/mbolivar/tmp/scan-build-2011-10-18-1.tgz

Marti

On 10/18/2011 01:18 PM, Øyvind Harboe wrote:

Does anyone want to take clang static analyzer for a spin on openocd?

http://clang-analyzer.llvm.org/scan-build.html


___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


[Openocd-development] New patch to review for openocd: bc144f4 Toshiba TMPA900 config: Fix incorrect working area.

2011-10-18 Thread Gerrit
This is an automated email from Gerrit.

Uwe Hermann (u...@hermann-uwe.de) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/34

-- gerrit
commit bc144f4ff2d4564bb6528755f5a32313fd5617e1
Author: Uwe Hermann u...@hermann-uwe.de
Date:   Wed Oct 19 01:09:44 2011 +0200

Toshiba TMPA900 config: Fix incorrect working area.

The Toshiba TMPA900 series (TMPA900/901) only has internal RAM regions
RAM-0 (16kB) and RAM-1 (8kB) which we can use as working area.

This is probably a copy-paste error from tmpa910.cfg, which has the
correct values and sizes for the TMPA910 series (TMPA910/911/912/913):
there are RAM-0, RAM-1, and RAM-2 (each 16kB).

Also, change built-in RAM to internal RAM to match what the
datasheet uses.

Change-Id: I993cd6b7fadc28cf34e5cc18426bb2bb42597670
Signed-off-by: Uwe Hermann u...@hermann-uwe.de

diff --git a/tcl/target/tmpa900.cfg b/tcl/target/tmpa900.cfg
index d5b458f..90851f6 100644
--- a/tcl/target/tmpa900.cfg
+++ b/tcl/target/tmpa900.cfg
@@ -42,15 +42,9 @@ jtag_ntrst_delay 20
 set _TARGETNAME $_CHIPNAME.cpu
 target create $_TARGETNAME arm926ejs -endian $_ENDIAN -chain-position 
$_TARGETNAME
 
-# built-in RAM0
-#working_area 0 0xf8004000 0x4000 nobackup
-# built-in RAM1
-#working_area 1 0xf8008000 0x4000 nobackup
-# built-in RAM2
-#working_area 2 0xf800c000 0x4000 nobackup
-# built-in RAM 0-2 48k total
-#working_area 0 0xf8004000 0xc000 nobackup
-
-# Internal sram1 memory
-$_TARGETNAME configure -work-area-phys 0xf8004000 -work-area-size 0x8000 \
+# Internal RAM-0 (16kB): 0xf8004000
+# Internal RAM-1 (8kB): 0xf8008000
+
+# Use internal RAM-0 and RAM-1 as working area (24kB total).
+$_TARGETNAME configure -work-area-phys 0xf8004000 -work-area-size 0x6000 \
 -work-area-backup 0
diff --git a/tcl/target/tmpa910.cfg b/tcl/target/tmpa910.cfg
index fa6f87b..36874d9 100644
--- a/tcl/target/tmpa910.cfg
+++ b/tcl/target/tmpa910.cfg
@@ -42,15 +42,10 @@ jtag_ntrst_delay 20
 set _TARGETNAME $_CHIPNAME.cpu
 target create $_TARGETNAME arm926ejs -endian $_ENDIAN -chain-position 
$_TARGETNAME
 
-# built-in RAM0
-#working_area 0 0xf8004000 0x4000 nobackup
-# built-in RAM1
-#working_area 1 0xf8008000 0x4000 nobackup
-# built-in RAM2
-#working_area 2 0xf800c000 0x4000 nobackup
-# built-in RAM 0-2 48k total
-#working_area 0 0xf8004000 0xc000 nobackup
-
-# Internal sram1 memory
+# Internal RAM-0 (16kB): 0xf8004000
+# Internal RAM-1 (16kB): 0xf8008000
+# Internal RAM-2 (16kB): 0xf800c000
+
+# Use internal RAM-0, RAM-1, and RAM-2 as working area (48kB total).
 $_TARGETNAME configure -work-area-phys 0xf8004000 -work-area-size 0xc000 \
 -work-area-backup 0

-- 
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


[Openocd-development] New patch to review for openocd: a756b1b TMPA900/910 MCUs are always little endian.

2011-10-18 Thread Gerrit
This is an automated email from Gerrit.

Uwe Hermann (u...@hermann-uwe.de) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/35

-- gerrit
commit a756b1bcdffef34a6d60d7a2706da9574663f544
Author: Uwe Hermann u...@hermann-uwe.de
Date:   Wed Oct 19 01:54:25 2011 +0200

TMPA900/910 MCUs are always little endian.

Signed-off-by: Uwe Hermann u...@hermann-uwe.de
Change-Id: I8839f2cf0faf1b5ba9f99901c5ee028b199fabd2

diff --git a/tcl/target/tmpa900.cfg b/tcl/target/tmpa900.cfg
index 90851f6..cfb445e 100644
--- a/tcl/target/tmpa900.cfg
+++ b/tcl/target/tmpa900.cfg
@@ -8,11 +8,8 @@ if { [info exists CHIPNAME] } {
set  _CHIPNAME tmpa900
 }
 
-if { [info exists ENDIAN] } {
-   set  _ENDIAN $ENDIAN
-} else {
-   set  _ENDIAN little
-}
+# Toshiba TMPA900 series MCUs are always little endian as per datasheet.
+set _ENDIAN little
 
 if { [info exists CPUTAPID ] } {
set _CPUTAPID $CPUTAPID
diff --git a/tcl/target/tmpa910.cfg b/tcl/target/tmpa910.cfg
index 36874d9..4d4d3fc 100644
--- a/tcl/target/tmpa910.cfg
+++ b/tcl/target/tmpa910.cfg
@@ -8,11 +8,8 @@ if { [info exists CHIPNAME] } {
set  _CHIPNAME tmpa910
 }
 
-if { [info exists ENDIAN] } {
-   set  _ENDIAN $ENDIAN
-} else {
-   set  _ENDIAN little
-}
+# Toshiba TMPA910 series MCUs are always little endian as per datasheet.
+set _ENDIAN little
 
 if { [info exists CPUTAPID ] } {
set _CPUTAPID $CPUTAPID

-- 
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] clang static analyzer

2011-10-18 Thread Øyvind Harboe
Cool!

Could I ask you to work through and fix some of the bugs and
submit them to Gerrit?

I'd like to see patches having to pass clang static analyzer unscathed before
they're ready for review :-)


-- 
Øyvind Harboe - Can Zylin Consulting help on your project?
US toll free 1-866-980-3434
http://www.zylin.com/
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development