Skip to contentSkip to conversation

package/openocd: explicitly disable unselected adapters

PATCH New Samuel Martin 2 participants 7 messages Jan 2, 2015 – Jan 5, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 package/openocd: explicitly disable unselected adapters

Some adapters are automatically enabled, but may not be built because of missing (archecture) dependencies. So, just set the options symetrically.

---
 package/openocd/openocd.mk | 58 +++++++++++++++++++++++-----------------------
 1 file changed, 29 insertions(+), 29 deletions(-)
package/openocd/openocd.mk +29 -29
index b0bcb7e..ad1f95b 100644
@@ -29,35 +29,35 @@ OPENOCD_DEPENDENCIES = \
 
 # Adapters
 OPENOCD_CONF_OPTS += \
-	$(if $(BR2_PACKAGE_OPENOCD_FTDI),--enable-ftdi) \
-	$(if $(BR2_PACKAGE_OPENOCD_STLINK),--enable-stlink) \
-	$(if $(BR2_PACKAGE_OPENOCD_TI_ICDI),--enable-ti-icdi) \
-	$(if $(BR2_PACKAGE_OPENOCD_ULINK),--enable-ulink) \
-	$(if $(BR2_PACKAGE_OPENOCD_UBLASTER2),--enable-usb-blaster-2) \
-	$(if $(BR2_PACKAGE_OPENOCD_JLINK),--enable-jlink) \
-	$(if $(BR2_PACKAGE_OPENOCD_OSDBM),--enable-osbdm) \
-	$(if $(BR2_PACKAGE_OPENOCD_OPENDOUS),--enable-opendous) \
-	$(if $(BR2_PACKAGE_OPENOCD_AICE),--enable-aice) \
-	$(if $(BR2_PACKAGE_OPENOCD_VSLLINK),--enable-vsllink) \
-	$(if $(BR2_PACKAGE_OPENOCD_USBPROG),--enable-usbprog) \
-	$(if $(BR2_PACKAGE_OPENOCD_RLINK),--enable-rlink) \
-	$(if $(BR2_PACKAGE_OPENOCD_ARMEW),--enable-armjtagew) \
-	$(if $(BR2_PACKAGE_OPENOCD_CMSIS_DAP),--enable-cmsis-dap) \
-	$(if $(BR2_PACKAGE_OPENOCD_PARPORT),--enable-parport) \
-	$(if $(BR2_PACKAGE_OPENOCD_FT2XXX),--enable-legacy-ft2232_libftdi) \
-	$(if $(BR2_PACKAGE_OPENOCD_VPI),--enable-jtag_vpi) \
-	$(if $(BR2_PACKAGE_OPENOCD_UBLASTER),--enable-usb_blaster_libftdi) \
-	$(if $(BR2_PACKAGE_OPENOCD_AMTJT),--enable-amtjtagaccel) \
-	$(if $(BR2_PACKAGE_OPENOCD_ZY1000_MASTER),--enable-zy1000-master) \
-	$(if $(BR2_PACKAGE_OPENOCD_ZY1000),--enable-zy1000) \
-	$(if $(BR2_PACKAGE_OPENOCD_EP93XX),--enable-ep93xx) \
-	$(if $(BR2_PACKAGE_OPENOCD_AT91RM),--enable-at91rm9200) \
-	$(if $(BR2_PACKAGE_OPENOCD_BCM2835),--enable-bcm2835gpio) \
-	$(if $(BR2_PACKAGE_OPENOCD_GW16012),--enable-gw16012) \
-	$(if $(BR2_PACKAGE_OPENOCD_PRESTO),--enable-presto_libftdi) \
-	$(if $(BR2_PACKAGE_OPENOCD_OPENJTAG),--enable-openjtag_ftdi) \
-	$(if $(BR2_PACKAGE_OPENOCD_BUSPIRATE),--enable-buspirate) \
-	$(if $(BR2_PACKAGE_OPENOCD_SYSFS),--enable-sysfsgpio)
+	$(if $(BR2_PACKAGE_OPENOCD_FTDI),--enable-ftdi,--disable-ftdi) \
+	$(if $(BR2_PACKAGE_OPENOCD_STLINK),--enable-stlink,--disable-stlink) \
+	$(if $(BR2_PACKAGE_OPENOCD_TI_ICDI),--enable-ti-icdi,--disable-ti-icdi) \
+	$(if $(BR2_PACKAGE_OPENOCD_ULINK),--enable-ulink,--disable-ulink) \
+	$(if $(BR2_PACKAGE_OPENOCD_UBLASTER2),--enable-usb-blaster-2,--disable-usb-blaster-2) \
+	$(if $(BR2_PACKAGE_OPENOCD_JLINK),--enable-jlink,--disable-jlink) \
+	$(if $(BR2_PACKAGE_OPENOCD_OSDBM),--enable-osbdm,--disable-osbdm) \
+	$(if $(BR2_PACKAGE_OPENOCD_OPENDOUS),--enable-opendous,--disable-opendous) \
+	$(if $(BR2_PACKAGE_OPENOCD_AICE),--enable-aice,--disable-aice) \
+	$(if $(BR2_PACKAGE_OPENOCD_VSLLINK),--enable-vsllink,--disable-vsllink) \
+	$(if $(BR2_PACKAGE_OPENOCD_USBPROG),--enable-usbprog,--disable-usbprog) \
+	$(if $(BR2_PACKAGE_OPENOCD_RLINK),--enable-rlink,--disable-rlink) \
+	$(if $(BR2_PACKAGE_OPENOCD_ARMEW),--enable-armjtagew,--disable-armjtagew) \
+	$(if $(BR2_PACKAGE_OPENOCD_CMSIS_DAP),--enable-cmsis-dap,--disable-cmsis-dap) \
+	$(if $(BR2_PACKAGE_OPENOCD_PARPORT),--enable-parport,--disable-parport) \
+	$(if $(BR2_PACKAGE_OPENOCD_FT2XXX),--enable-legacy-ft2232_libftdi,--disable-legacy-ft2232_libftdi) \
+	$(if $(BR2_PACKAGE_OPENOCD_VPI),--enable-jtag_vpi,--disable-jtag_vpi) \
+	$(if $(BR2_PACKAGE_OPENOCD_UBLASTER),--enable-usb_blaster_libftdi,--disable-usb_blaster_libftdi) \
+	$(if $(BR2_PACKAGE_OPENOCD_AMTJT),--enable-amtjtagaccel,--disable-amjtagaccel) \
+	$(if $(BR2_PACKAGE_OPENOCD_ZY1000_MASTER),--enable-zy1000-master,--disable-zy1000-master) \
+	$(if $(BR2_PACKAGE_OPENOCD_ZY1000),--enable-zy1000,--disable-zy1000) \
+	$(if $(BR2_PACKAGE_OPENOCD_EP93XX),--enable-ep93xx,--disable-ep93xx) \
+	$(if $(BR2_PACKAGE_OPENOCD_AT91RM),--enable-at91rm9200,--disable-at91rm9200) \
+	$(if $(BR2_PACKAGE_OPENOCD_BCM2835),--enable-bcm2835gpio,--disable-bcm2835gpio) \
+	$(if $(BR2_PACKAGE_OPENOCD_GW16012),--enable-gw16012,--disable-gw16012) \
+	$(if $(BR2_PACKAGE_OPENOCD_PRESTO),--enable-presto_libftdi,--disable-presto_libftdi) \
+	$(if $(BR2_PACKAGE_OPENOCD_OPENJTAG),--enable-openjtag_ftdi,--disable-openjtag_ftdi) \
+	$(if $(BR2_PACKAGE_OPENOCD_BUSPIRATE),--enable-buspirate,--disable-buspirate) \
+	$(if $(BR2_PACKAGE_OPENOCD_SYSFS),--enable-sysfsgpio,--disable-sysfsgpio)
 
 # Enable all configuration options for host build.
 #
Signature · 1 line
2.2.1
#1 lore raw

PATCH 2/3 package/openocd: disable aice programmer on non-MMU architecture

aice sources use fork function, which is only available on architecture with MMU.

---
 package/openocd/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/openocd/Config.in +1 -0
index 1f9889c..7c140c7 100644
@@ -76,6 +76,7 @@ config BR2_PACKAGE_OPENOCD_OPENDOUS
 config BR2_PACKAGE_OPENOCD_AICE
 	bool "Andes JTAG Programmer"
 	select BR2_PACKAGE_LIBUSB
+	depends on BR2_USE_MMU # use fork()
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libusb
 	help
 	  Enable building support for the Andes JTAG
Signature · 1 line
2.2.1
#2 lore raw

PATCH 2/3 package/openocd: disable aice programmer on non-MMU architecture

Dear Samuel Martin,

Quoted 7 lines · Samuel Martin

aice sources use fork function, which is only available on architecture with MMU.

---
 package/openocd/Config.in | 1 +
 1 file changed, 1 insertion(+)

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 3/3 package/openocd: fix libftdi mis-detection

In reply to Samuel Martin

By-pass failing ac_search_libs check when libftdi is enabled.

Fixes:
http://autobuild.buildroot.org/results/e90/e90b4d5ad79d99487f21c9d18581e8eba7034501/

---
 package/openocd/openocd.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/openocd/openocd.mk +2 -1
index ad1f95b..34a2bbd 100644
@@ -8,7 +8,8 @@ OPENOCD_VERSION = 0.8.0
 OPENOCD_SOURCE = openocd-$(OPENOCD_VERSION).tar.bz2
 OPENOCD_SITE = http://downloads.sourceforge.net/project/openocd/openocd/$(OPENOCD_VERSION)
 
-OPENOCD_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu99"
+OPENOCD_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu99" \
+	$(if $(BR2_PACKAGE_LIBFTDI),ac_cv_search_ftdi_new=yes)
 
 OPENOCD_CONF_OPTS = \
 	--oldincludedir=$(STAGING_DIR)/usr/include \
Signature · 1 line
2.2.1
#4 lore raw

PATCH 3/3 package/openocd: fix libftdi mis-detection

Dear Samuel Martin,

Quoted 15 lines · Samuel Martin

By-pass failing ac_search_libs check when libftdi is enabled.

Fixes:
http://autobuild.buildroot.org/results/e90/e90b4d5ad79d99487f21c9d18581e8eba7034501/

---
 package/openocd/openocd.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/openocd/openocd.mk +0 -0
index ad1f95b..34a2bbd 100644

package/openocd/openocd.mk OPENOCD_VERSION = 0.8.0 · line 12

Quoted 6 lines
package/openocd/openocd.mk +2 -1
@@ -8,7 +8,8 @@ OPENOCD_VERSION = 0.8.0
 OPENOCD_SOURCE = openocd-$(OPENOCD_VERSION).tar.bz2
 OPENOCD_SITE = http://downloads.sourceforge.net/project/openocd/openocd/$(OPENOCD_VERSION)
 
-OPENOCD_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu99"
+OPENOCD_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu99" \
+	$(if $(BR2_PACKAGE_LIBFTDI),ac_cv_search_ftdi_new=yes)

I don't really like this proposal. The test works just fine on ARM/shared library, and appears to fail only on Blackfin/FLAT. The config.log contains:

configure:14862: checking for library containing ftdi_new
configure:14893: /home/thomas/projets/buildroot/output/host/usr/bin/bfin-uclinux-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -std=gnu99 -I/home/tho
mas/projets/buildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -elf2flt -static conftest.c -L/home/thomas/projets/bu
ildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib -lftdi -lusb >&5
/home/thomas/projets/buildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libusb.a(libusb_la-core.o): In function `_usb_detach_kernel_driver_np':
core.c:(.text+0x96): undefined reference to _libusb_detach_kernel_driver' /home/thomas/projets/buildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libusb.a(libusb_la-core.o): In function _usb_get_driver_np':
core.c:(.text+0xee): undefined reference to _libusb_kernel_driver_active' /home/thomas/projets/buildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libusb.a(libusb_la-core.o): In function _usb_get_descriptor_by_endpoint':
core.c:(.text+0x16a): undefined reference to `_libusb_control_transfer'
[... more of such errors...]

So, I'd prefer to see a solution that actually solves the missing undefined references, rather than working around this by passing ac_cv_search_ftdi_new. Or at least an explanation giving the details as to why passing ac_cv_search_ftdi_new is the appropriate solution for the problem.

I'll mark your patch as Changes Requested. Can you submit an updated version with either more details, or a better solution?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 3/3 package/openocd: fix libftdi mis-detection

Hi all,

Quoted 50 lines · Thomas Petazzoni

Dear Samuel Martin,

Quoted 15 lines · Samuel Martin

By-pass failing ac_search_libs check when libftdi is enabled.

Fixes:
http://autobuild.buildroot.org/results/e90/e90b4d5ad79d99487f21c9d18581e8eba7034501/

---
 package/openocd/openocd.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/openocd/openocd.mk +0 -0
index ad1f95b..34a2bbd 100644

package/openocd/openocd.mk OPENOCD_VERSION = 0.8.0 · line 12

Quoted 6 lines
package/openocd/openocd.mk +2 -1
@@ -8,7 +8,8 @@ OPENOCD_VERSION = 0.8.0
 OPENOCD_SOURCE = openocd-$(OPENOCD_VERSION).tar.bz2
 OPENOCD_SITE = http://downloads.sourceforge.net/project/openocd/openocd/$(OPENOCD_VERSION)
 
-OPENOCD_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu99"
+OPENOCD_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu99" \
+     $(if $(BR2_PACKAGE_LIBFTDI),ac_cv_search_ftdi_new=yes)

I don't really like this proposal. The test works just fine on ARM/shared library, and appears to fail only on Blackfin/FLAT. The config.log contains:

configure:14862: checking for library containing ftdi_new
configure:14893: /home/thomas/projets/buildroot/output/host/usr/bin/bfin-uclinux-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wl,-elf2flt -static -std=gnu99 -I/home/tho
mas/projets/buildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -elf2flt -static conftest.c -L/home/thomas/projets/bu
ildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib -lftdi -lusb >&5
/home/thomas/projets/buildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libusb.a(libusb_la-core.o): In function `_usb_detach_kernel_driver_np':
core.c:(.text+0x96): undefined reference to _libusb_detach_kernel_driver' /home/thomas/projets/buildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libusb.a(libusb_la-core.o): In function _usb_get_driver_np':
core.c:(.text+0xee): undefined reference to _libusb_kernel_driver_active' /home/thomas/projets/buildroot/output/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libusb.a(libusb_la-core.o): In function _usb_get_descriptor_by_endpoint':
core.c:(.text+0x16a): undefined reference to `_libusb_control_transfer'
[... more of such errors...]

So, I'd prefer to see a solution that actually solves the missing undefined references, rather than working around this by passing ac_cv_search_ftdi_new. Or at least an explanation giving the details as to why passing ac_cv_search_ftdi_new is the appropriate solution for the problem.

I'll mark your patch as Changes Requested. Can you submit an updated version with either more details, or a better solution?

Quoted 7 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Well, after further investigation, this error seems caused by the "_" prefix prepended to each symbol on BlackFin.

When forcing the test result to pass the configuration, the full build succeeds.
<snip>
[...]
libtool: link: /home/system/src/tmp/br/abo/openocd-e90/host/usr/bin/bfin-uclinux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os
-Wl,-elf2flt -static -std=gnu99 -Wall -Wstrict-prototypes
-Wformat-security -Wshadow -Wextra -Wno-unused-parameter
-Wbad-function-cast -Wcast-align -Wredundant-decls -elf2flt -static -o
openocd main.o ./.libs/libopenocd.a -L/home/system/src/tmp/br/abo/openocd-e90/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib /home/system/src/tmp/br/abo/openocd-e90/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libftdi.a /home/system/src/tmp/br/abo/openocd-e90/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libusb.a /home/system/src/tmp/br/abo/openocd-e90/host/usr/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libusb-1.0.a ../jimtcl/libjim.a -lm -pthread
</snip>

The most noticeable differences between the autotools check and the build command are:
- the build command uses libtool, whereas the autotools check does not;
- the build command uses full path to libftdi.a and libusb.a (from the staging tree), whereas the autotools check uses:
-L$(STAGING_DIR)/usr/lib -lftdi -lusb

Could this behavior result from some libtool trickery?

Note that, in such a case, we usually mark the package as not available on bfin [1-2].
I think I'll do the same for openocd.

[1] http://git.buildroot.net/buildroot/commit/?id=b1cf2b21dd9e2283f9020e3a5ac9ac35f8855c1a
[2] http://git.buildroot.net/buildroot/commit/?id=7f5fec620101dba2e97a08d7e61640aa39a3c3f0

Regards,

Signature · 1 line
Samuel
#6 lore raw

PATCH 1/3 package/openocd: explicitly disable unselected adapters

In reply to Samuel Martin

Dear Samuel Martin,

Quoted 4 lines · Samuel Martin

Some adapters are automatically enabled, but may not be built because of missing (archecture) dependencies. So, just set the options symetrically.

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com