From 6c213d64b3e7babc3685af89921c645992b14aa0 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 20 Sep 2011 13:19:52 +0200 Subject: 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 Cc: Nicolas Ferre Cc: Patrice Vilchez Signed-off-by: Peter Korsgaard --- package/openocd/Config.in | 29 +++++++++++++++++++ ...s-compilation-host-libsub-was-used-before.patch | 33 ++++++++++++++++++++++ ...002-fix-xscale-uninitialise-breakpoint_pc.patch | 20 +++++++++++++ package/openocd/openocd-0003-force-gnu99.patch | 19 +++++++++++++ .../openocd/openocd-0004-force_jimtcl_static.patch | 25 ++++++++++++++++ package/openocd/openocd.mk | 32 +++++++++++++++++++++ 6 files changed, 158 insertions(+) create mode 100644 package/openocd/Config.in create mode 100644 package/openocd/openocd-0001-fix-cross-compilation-host-libsub-was-used-before.patch create mode 100644 package/openocd/openocd-0002-fix-xscale-uninitialise-breakpoint_pc.patch create mode 100644 package/openocd/openocd-0003-force-gnu99.patch create mode 100644 package/openocd/openocd-0004-force_jimtcl_static.patch create mode 100644 package/openocd/openocd.mk (limited to 'package/openocd') diff --git a/package/openocd/Config.in b/package/openocd/Config.in new file mode 100644 index 000000000..f67c0a841 --- /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 000000000..99ff04eb7 --- /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 +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 +--- + 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 000000000..328241ee4 --- /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 +--- + 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 000000000..106d11295 --- /dev/null +++ b/package/openocd/openocd-0003-force-gnu99.patch @@ -0,0 +1,19 @@ +force gnu99 + +Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD +--- + 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 000000000..7118b57d7 --- /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 +--- + 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 000000000..74585d363 --- /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)) -- cgit v1.2.3