summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2011-09-20 11:19:52 (GMT)
committer Peter Korsgaard <jacmet@sunsite.dk>2011-09-21 20:59:15 (GMT)
commit6c213d64b3e7babc3685af89921c645992b14aa0 (patch)
tree3bb73ba781b10af8b72d0d7e25fa3a1f68f09c19
parent4d33cb702145f0cb9e1bad3e30cb740c21fe56b7 (diff)
downloadbuildroot-6c213d64b3e7babc3685af89921c645992b14aa0.tar.gz
buildroot-6c213d64b3e7babc3685af89921c645992b14aa0.tar.bz2
package: add openocd support
with only the following Adapters - FTDI FT2xxx/FT4xxx - J-Link (Segger and Atmel SAM-ICE) - Versaloon-Link JTAG Adapter [Peter: Config.in tweaks] Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Patrice Vilchez <patrice.vilchez@atmel.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
-rw-r--r--package/Config.in1
-rw-r--r--package/openocd/Config.in29
-rw-r--r--package/openocd/openocd-0001-fix-cross-compilation-host-libsub-was-used-before.patch33
-rw-r--r--package/openocd/openocd-0002-fix-xscale-uninitialise-breakpoint_pc.patch20
-rw-r--r--package/openocd/openocd-0003-force-gnu99.patch19
-rw-r--r--package/openocd/openocd-0004-force_jimtcl_static.patch25
-rw-r--r--package/openocd/openocd.mk32
7 files changed, 159 insertions, 0 deletions
diff --git a/package/Config.in b/package/Config.in
index 5d7c15d..12fd0dc 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -191,6 +191,7 @@ source "package/memtester/Config.in"
source "package/mtd/Config.in"
source "package/ntfs-3g/Config.in"
source "package/ntfsprogs/Config.in"
+source "package/openocd/Config.in"
source "package/pciutils/Config.in"
source "package/rng-tools/Config.in"
source "package/sdparm/Config.in"
diff --git a/package/openocd/Config.in b/package/openocd/Config.in
new file mode 100644
index 0000000..f67c0a8
--- /dev/null
+++ b/package/openocd/Config.in
@@ -0,0 +1,29 @@
+config BR2_PACKAGE_OPENOCD
+ bool "openocd"
+ select BR2_PACKAGE_LIBUSB
+ select BR2_PACKAGE_LIBUSB_COMPAT
+ help
+ OpenOCD - Open On-Chip Debugger
+
+ http://openocd.berlios.de/web/
+
+if BR2_PACKAGE_OPENOCD
+
+comment "Adapters"
+
+config BR2_PACKAGE_OPENOCD_FT2XXX
+ bool "FT2xxx/FT4xxx Based JTAG Programmer"
+ select BR2_PACKAGE_LIBFTDI
+ help
+ Enable building support for FT2232 based devices
+ using the libftdi driver, opensource alternate of FTD2XX
+
+config BR2_PACKAGE_OPENOCD_JLINK
+ bool "Segger J-Link JTAG Programmer"
+ help
+ Segger J-Link JTAG Programmer and clone such as Atmel SAM-ICE
+
+config BR2_PACKAGE_OPENOCD_VSLLINK
+ bool "Versaloon-Link JTAG Programmr"
+
+endif # BR2_PACKAGE_OPENOCD
diff --git a/package/openocd/openocd-0001-fix-cross-compilation-host-libsub-was-used-before.patch b/package/openocd/openocd-0001-fix-cross-compilation-host-libsub-was-used-before.patch
new file mode 100644
index 0000000..99ff04e
--- /dev/null
+++ b/package/openocd/openocd-0001-fix-cross-compilation-host-libsub-was-used-before.patch
@@ -0,0 +1,33 @@
+From 3728c4af7f6303ccedab56ec220797f8f290580e Mon Sep 17 00:00:00 2001
+From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+Date: Wed, 10 Aug 2011 00:17:29 +0800
+Subject: [PATCH] fix cross compilation: host libsub was used before
+
+tested in buildroot
+
+Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+---
+ configure.in | 7 +++++--
+ 1 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index dfa1e8f..cfe2218 100644
+--- a/configure.in
++++ b/configure.in
+@@ -1046,8 +1046,11 @@ build_usb=no
+ if test $build_jlink = yes -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],[],
+- [AC_MSG_ERROR([usb.h is required to build some OpenOCD driver(s)])])
++ dnl check for libusb
++ PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.11)
++ CFLAGS="$CFLAGS $LIBUSB_CFLAGS"
++ LDFLAGS="$LFFLAGS $LIBUSB_LDFLAGS"
++ LIBS="$LIBS $LIBUSB_LIBS"
+ build_usb=yes
+ fi
+
+--
+1.7.5.4
+
diff --git a/package/openocd/openocd-0002-fix-xscale-uninitialise-breakpoint_pc.patch b/package/openocd/openocd-0002-fix-xscale-uninitialise-breakpoint_pc.patch
new file mode 100644
index 0000000..328241e
--- /dev/null
+++ b/package/openocd/openocd-0002-fix-xscale-uninitialise-breakpoint_pc.patch
@@ -0,0 +1,20 @@
+xscale: fix uninitialise breakpoint_pc
+
+Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+---
+ src/target/xscale.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: b/src/target/xscale.c
+===================================================================
+--- a/src/target/xscale.c
++++ b/src/target/xscale.c
+@@ -2811,7 +2811,7 @@ static int xscale_analyze_trace(struct t
+ struct xscale_common *xscale = target_to_xscale(target);
+ struct xscale_trace_data *trace_data = xscale->trace.data;
+ int i, retval;
+- uint32_t breakpoint_pc;
++ uint32_t breakpoint_pc = 0;
+ struct arm_instruction instruction;
+ uint32_t current_pc = 0; /* initialized when address determined */
+
diff --git a/package/openocd/openocd-0003-force-gnu99.patch b/package/openocd/openocd-0003-force-gnu99.patch
new file mode 100644
index 0000000..106d112
--- /dev/null
+++ b/package/openocd/openocd-0003-force-gnu99.patch
@@ -0,0 +1,19 @@
+force gnu99
+
+Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+---
+ configure.in | 1 +
+ 1 file changed, 1 insertion(+)
+
+Index: b/configure.in
+===================================================================
+--- a/configure.in
++++ b/configure.in
+@@ -28,6 +28,7 @@ AC_DISABLE_SHARED
+ AC_PROG_LIBTOOL
+ AC_SUBST(LIBTOOL_DEPS)
+
++CFLAGS="$CFLAGS -std=gnu99"
+
+ dnl configure checks required for Jim files (these are obsolete w/ C99)
+ AC_C_CONST
diff --git a/package/openocd/openocd-0004-force_jimtcl_static.patch b/package/openocd/openocd-0004-force_jimtcl_static.patch
new file mode 100644
index 0000000..7118b57
--- /dev/null
+++ b/package/openocd/openocd-0004-force_jimtcl_static.patch
@@ -0,0 +1,25 @@
+force jimtcl to build static
+
+Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+---
+ jimtcl/auto.def | 5 -----
+ 1 file changed, 5 deletions(-)
+
+Index: b/jimtcl/auto.def
+===================================================================
+--- a/jimtcl/auto.def
++++ b/jimtcl/auto.def
+@@ -148,13 +148,8 @@ if {[opt-bool references]} {
+ msg-result "Enabling references"
+ define JIM_REFERENCES
+ }
+-if {[opt-bool shared with-jim-shared]} {
+- msg-result "Building shared library"
+- define JIM_LIBTYPE shared
+-} else {
+ msg-result "Building static library"
+ define JIM_LIBTYPE static
+-}
+ if {[opt-bool install-jim]} {
+ define install_jim 1
+ } else {
diff --git a/package/openocd/openocd.mk b/package/openocd/openocd.mk
new file mode 100644
index 0000000..74585d3
--- /dev/null
+++ b/package/openocd/openocd.mk
@@ -0,0 +1,32 @@
+#############################################################
+#
+# openocd
+#
+#############################################################
+OPENOCD_VERSION:=0.5.0
+OPENOCD_SOURCE = openocd-$(OPENOCD_VERSION).tar.bz2
+OPENOCD_SITE = http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/project/openocd/openocd/$(OPENOCD_VERSION)
+
+OPENOCD_AUTORECONF = YES
+OPENOCD_CONF_OPT = \
+ --oldincludedir=$(STAGING_DIR)/usr/include \
+ --includedir=$(STAGING_DIR)/usr/include \
+ --disable-doxygen-html \
+ --enable-dummy
+
+OPENOCD_DEPENDENCIES = libusb-compat
+
+# Adapters
+ifeq ($(BR2_PACKAGE_OPENOCD_FT2XXX),y)
+OPENOCD_CONF_OPT += --enable-ft2232_libftdi
+endif
+
+ifeq ($(BR2_PACKAGE_OPENOCD_JLINK),y)
+OPENOCD_CONF_OPT += --enable-jlink
+endif
+
+ifeq ($(BR2_PACKAGE_OPENOCD_VSLLINK),y)
+OPENOCD_CONF_OPT += --enable-vsllink
+endif
+
+$(eval $(call AUTOTARGETS,package,openocd))