Impact Acquire SDK Java
Embedded Linux

The Impact Acquire runtime libraries (*.so) from the installation script for your target machine (*.sh) are sufficient for including the Impact Acquire framework into your own embedded Linux distribution. The following chapter will demonstrate how to achieve this via the Yocto Project.

Yocto Project

The Yocto Project is an open-source framework that helps users to create a custom Linux distribution. To use Balluff imaging devices on your embedded system, you will need to create Bitbake recipes to package the Impact Acquire libraries which are already compiled by us for your target system, create Bitbake recipes to cross-compile and package your machine vision applications using the Impact Acquire API, and install these packages into your own Linux image. In this example, we will guide you through:

  • Package and install the Impact Acquire libraries for each device (i.e. BVS CA-BN, USB3 Vision™ devices, GigE Vision™ devices, Balluff USB2.0 cameras and Virtual Device support);
  • Cross-compile, package and install the Impact Acquire sample programs;
  • Configure and build the final image.

Install Impact Acquire Libraries

The Yocto Project uses a layer module (i.e. meta-layers) to logically modulate and separate metadata in a build. Therefore, it's a good practice to create a meta-layer for the Impact Acquire framework packages and programs on top of your Linux distribution or on top of a BSP (Board Support Package) provided by your hardware manufacturer. Once the Yocto build environment and the base Linux distribution have been set, create a meta-layer in the source directory:

$ bitbake-layers create-layer meta-impact-acquire

Once the Impact Acquire meta-layer has been created, open the conf/bblayers.conf file in the build directory and add the following line:

BBLAYERS += "${BSPDIR}/sources/meta-impact-acquire"

Now it's time to install the Impact Acquire common runtime libraries and device-specific runtime libraries.

Install Common Impact Acquire Libraries

There are some libraries that are needed by every Impact Acquire capture stack:

  • libmvDeviceManager.so
  • libmvImageProcessing.so
  • libmvPropHandling.so
  • libexpat.so
  • libfreeimage.so

Therefore, if multiple device drivers are going to be installed on the target machine, it might be better to install these common libraries by a separate Bitbake recipe.

Since these runtime libraries are shipped in the Impact Acquire installation archive, you first need to download the latest *.sh script for your target machine from the Balluff website (https://www.balluff.com). In this demonstration, the ImpactAcquire-arm64-linux-3.3.0.sh for an arm64 platform will be used.

Note
Please download the *.sh file that is suitable for your devices and your target system.

You now need to extract the Impact Acquire libraries from the installer and save them as a tgz archive. The installer may be used to do this by specifying the -x or --extract option.

./ImpactAcquire-arm64-linux-3.3.0.sh -x

Once the libraries have been extracted, navigate to the source directory, copy the new *.tgz file to the recipe directory and create a Bitbake recipe for installing the common runtime libraries:

$ cd meta-impact-acquire && mkdir -p recipes-impact-acquire/impact-acquire/files
$ cp -r /tmp/ImpactAcquire-arm64-3.3.0.tgz recipes-impact-acquire/impact-acquire/files/
$ touch recipes-impact-acquire/impact-acquire/impact-acquire-base_3.3.0.bb

The demo Bitbake recipe impact-acquire-base_3.3.0 looks like this:

SUMMARY = "Installs Impact Acquire base libraries"
DESCRIPTION = "This recipe installs Impact Acquire framework base libraries for all Balluff imaging and image capture devices."
HOMEPAGE = "https://www.balluff.com"
LICENSE_FLAGS = "EULA"
LICENSE_FLAGS_WHITELIST = "EULA"
LICENSE = "EULA"
LIC_FILES_CHKSUM = "file://${WORKDIR}/ImpactAcquire-ARM64-3.3.0/doc/EULA/EULA.txt;md5=83910cf672befabf2f24435e2581c79f"
PACKAGE_ARCH = "${MACHINE_ARCH}"
S = "${WORKDIR}"
SRC_URI = "file://ImpactAcquire-arm64-3.3.0.tgz"
TARGET = "arm64"
MVIA_SUBDIR = "opt/ImpactAcquire"
MVIA_LIB_SUBDIR = "lib"
TOOLKITS_LIB_SUBDIR = "Toolkits"
MV_DATA_DIR = "opt/ImpactAcquire/data"
do_install() {
# install Impact Acquire runtime binaries
install -m 0755 -d ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
install -m 0755 -d ${D}${base_prefix}/${MVIA_SUBDIR}/${TOOLKITS_LIB_SUBDIR}
install -m 0755 -d ${D}${base_prefix}/${MVIA_SUBDIR}/${TOOLKITS_LIB_SUBDIR}/FreeImage3180/Dist/${TARGET}
oe_soinstall ${S}/ImpactAcquire-ARM64-${PV}/lib/${TARGET}/libmvDeviceManager.so.${PV} ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
oe_soinstall ${S}/ImpactAcquire-ARM64-${PV}/lib/${TARGET}/libmvImageProcessing.so.${PV} ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
oe_soinstall ${S}/ImpactAcquire-ARM64-${PV}/lib/${TARGET}/libmvPropHandling.so.${PV} ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
oe_soinstall ${S}/ImpactAcquire-ARM64-${PV}/${TOOLKITS_LIB_SUBDIR}/expat/bin/${TARGET}/lib/*.so.* ${D}${base_prefix}/${MVIA_SUBDIR}/${TOOLKITS_LIB_SUBDIR}
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/${TOOLKITS_LIB_SUBDIR}/FreeImage3180/Dist/${TARGET}/*.so ${D}${base_prefix}/${MVIA_SUBDIR}/${TOOLKITS_LIB_SUBDIR}/FreeImage3180/Dist/${TARGET}
# set environment variables for Impact Acquire
install -m 0755 -d ${D}${sysconfdir}/profile.d
echo 'export MVIMPACT_ACQUIRE_DIR=/opt/ImpactAcquire' >> ${D}${sysconfdir}/profile.d/acquire.sh
echo 'export MVIMPACT_ACQUIRE_DATA_DIR=/opt/ImpactAcquire/data' >> ${D}${sysconfdir}/profile.d/acquire.sh
# set library search paths for the dynamic linker
install -m 0755 -d ${D}${sysconfdir}/ld.so.conf.d
echo '/opt/ImpactAcquire/lib' >> ${D}${sysconfdir}/ld.so.conf.d/acquire.conf
echo '/opt/ImpactAcquire/Toolkits' >> ${D}${sysconfdir}/ld.so.conf.d/acquire.conf
# set up logfiles
install -m 0755 -d ${D}${base_prefix}/${MV_DATA_DIR}/logs
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/apps/mvDebugFlags.mvd ${D}${base_prefix}/${MV_DATA_DIR}/logs/
}
INHIBIT_PACKAGE_STRIP = "1"
INSANE_SKIP_${PN} += "dev-so \
already-stripped \
ldflags"
PACKAGES = "${PN} ${PN}-dev ${PN}-doc"
FILES_${PN} += "${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/lib*.so.* \
${base_prefix}/${MVIA_SUBDIR}/${TOOLKITS_LIB_SUBDIR}/lib*.so.* \
${base_prefix}/${MVIA_SUBDIR}/${TOOLKITS_LIB_SUBDIR}/FreeImage3180/Dist/${TARGET}/lib*.so \
${sysconfdir}/profile.d/*.sh \
${sysconfdir}/ld.so.conf.d/*.conf"
FILES_${PN}-dev += "${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/lib*.so \
${base_prefix}/${MVIA_SUBDIR}/${TOOLKITS_LIB_SUBDIR}/lib*.so"
FILES_${PN}-doc += "${base_prefix}/${MV_DATA_DIR}/logs"
Note
As a unique signature of a task's inputs, checksum indicates when the input data change. Therefore, you need to update the checksum of the license file if it has been changed. Run md5sum [file_name] to check the current MD5 checksum of the file and update it in your recipe.

After the recipe has been created, run bitbake to build it:

$ bitbake impact-acquire-base

Install GenICam™ GenTL Specific Impact Acquire Libraries

Apart from the common Impact Acquire runtime libraries, you need to install the GenICam™ GenTL specific libraries from the Impact Acquire installation archive in order to use USB3 Vision™ devices, GigE Vision™ devices or BVS CA-BN devices. Therefore, download the ImpactAcquire-ARM64_gnu-3.3.0.tgz from the Balluff website (https://www.balluff.com/en-de/downloads/software). Assume the target platform is arm64. Skip this step if the same *.tgz has been downloaded during the previous step Install Common Impact Acquire Libraries.

$ cp -r ~/Downloads/ImpactAcquire-ARM64_gnu-3.3.0.tgz recipes-impact-acquire/impact-acquire/files/

Create a Bitbake recipe for installing GenICam™ GenTL specific Impact Acquire libraries:

$ touch recipes-impact-acquire/impact-acquire/impact-acquire-gentl_3.3.0.bb

The demo Bitbake recipe impact-acquire-gentl_3.3.0 looks like this:

SUMMARY = "Installs GenICam GenTL specific Impact Acquire libraries"
DESCRIPTION = "This recipe installs Impact Acquire GenTL framework libraries for USB3 Vision, GigE Vision and BVS CA-BN (mvBlueNAOS) devices on ARM64 platforms."
HOMEPAGE = "https://www.balluff.com"
LICENSE_FLAGS = "EULA"
LICENSE_FLAGS_WHITELIST = "EULA"
LICENSE = "EULA"
LIC_FILES_CHKSUM = "file://${WORKDIR}/ImpactAcquire-ARM64-3.3.0/doc/EULA/EULA.txt;md5=83910cf672befabf2f24435e2581c79f"
PACKAGE_ARCH = "${MACHINE_ARCH}"
S = "${WORKDIR}"
SRC_URI = "file://ImpactAcquire-arm64-3.3.0.tgz"
TARGET = "arm64"
MVIA_SUBDIR = "opt/ImpactAcquire"
MVIA_LIB_SUBDIR = "lib"
GENICAM_LIB_SUBDIR = "runtime"
MV_DATA_DIR = "opt/ImpactAcquire/data"
RDEPENDS_${PN} += " impact-acquire-base"
do_install() {
# install Impact Acquire runtime binaries and dependencies for USB3 Vision, GigE Vision and BVS CA-BN devices.
install -m 0755 -d ${D}${base_prefix}
install -m 0755 -d ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
install -m 0755 -d ${D}${base_prefix}/${MVIA_SUBDIR}/${GENICAM_LIB_SUBDIR}
install -m 0755 -d ${D}${base_prefix}/${MVIA_SUBDIR}/${GENICAM_LIB_SUBDIR}/bin/Linux64_ARM
oe_soinstall ${S}/ImpactAcquire-ARM64-${PV}/lib/${TARGET}/libmvGenTLConsumer.so.${PV} ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
oe_soinstall ${S}/ImpactAcquire-ARM64-${PV}/lib/${TARGET}/libmvGenTLProducer.so.${PV} ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
oe_soinstall ${S}/ImpactAcquire-ARM64-${PV}/lib/${TARGET}/libmvGenTLProducer.PCIe.so.${PV} ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/lib/${TARGET}/libBVS_CA-BN.H.*.so ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/lib/${TARGET}/libBVS_CA-BN.S.*.so ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/runtime/bin/Linux64_ARM/*.so ${D}${base_prefix}/${MVIA_SUBDIR}/${GENICAM_LIB_SUBDIR}/bin/Linux64_ARM
# create softlink for libmvGenTLProducer
cd ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
ln -sf libmvGenTLProducer.so libmvGenTLProducer.cti
ln -sf libmvGenTLProducer.PCIe.so libmvGenTLProducer.PCIe.cti
# set environment variables for Impact Acquire GenICAM devices
install -m 0755 -d ${D}${sysconfdir}/profile.d
echo 'export GENICAM_ROOT=/opt/ImpactAcquire/runtime' >> ${D}${sysconfdir}/profile.d/genicam.sh
echo 'export GENICAM_ROOT_V3_4=/opt/ImpactAcquire/runtime' >> ${D}${sysconfdir}/profile.d/genicam.sh
echo 'export GENICAM_GENTL64_PATH=/opt/ImpactAcquire/lib' >> ${D}${sysconfdir}/profile.d/genicam.sh
echo 'export GENICAM_CACHE_V3_4=/opt/ImpactAcquire/runtime/cache/v3_4' >> ${D}${sysconfdir}/profile.d/genicam.sh
echo 'export GENICAM_LOG_CONFIG_V3_4=/opt/ImpactAcquire/runtime/log/config-unix/DefaultLogging.properties' >> ${D}${sysconfdir}/profile.d/genicam.sh
# set library search path for the dynamic linker
install -m 0755 -d ${D}${sysconfdir}/ld.so.conf.d
echo '/opt/ImpactAcquire/runtime/bin/Linux64_ARM' >> ${D}${sysconfdir}/ld.so.conf.d/genicam.conf
# define udev rules for USB3 Vision devices
install -m 0755 -d ${D}${sysconfdir}/udev/rules.d
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/Scripts/52-mvbf3.rules ${D}${sysconfdir}/udev/rules.d/
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/Scripts/52-U3V.rules ${D}${sysconfdir}/udev/rules.d/
# define udev rules for pcie cameras
install -m 0755 -d ${D}/usr/local/bin/
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/Scripts/51-udev-pcie.rules ${D}${sysconfdir}/udev/rules.d/
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/Scripts/make_device.sh ${D}/usr/local/bin/
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/Scripts/device_namer.sh ${D}/usr/local/bin/
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/Scripts/change_permissions.sh ${D}/usr/local/bin/
# install GenICam Cache and Logs
cp -r ${S}/ImpactAcquire-ARM64-${PV}/runtime/cache ${D}${base_prefix}/${MVIA_SUBDIR}/${GENICAM_LIB_SUBDIR}
cp -r ${S}/ImpactAcquire-ARM64-${PV}/runtime/log ${D}${base_prefix}/${MVIA_SUBDIR}/${GENICAM_LIB_SUBDIR}
# set up GenICam cache and xml file location
install -m 0755 -d ${D}${base_prefix}/${MV_DATA_DIR}/genicam
# increase usb core memory for USB3 Vision devices
echo 'sh -c "echo 128 > /sys/module/usbcore/parameters/usbfs_memory_mb"' > ${D}${sysconfdir}/profile.d/usbfs_memory.sh
# increase GigE buffer size for GigE Vision devices
install -m 0755 -d ${D}${sysconfdir}/sysctl.d
echo 'net.core.wmem_max=16777216' >> ${D}${sysconfdir}/sysctl.d/62-buffers-performance.conf
echo 'net.core.rmem_max=16777216' >> ${D}${sysconfdir}/sysctl.d/62-buffers-performance.conf
echo 'net.core.wmem_default=16777216' >> ${D}${sysconfdir}/sysctl.d/62-buffers-performance.conf
echo 'net.core.rmem_default=16777216' >> ${D}${sysconfdir}/sysctl.d/62-buffers-performance.conf
echo 'net.core.udp_mem=10240 87380 16777216' >> ${D}${sysconfdir}/sysctl.d/62-buffers-performance.conf
echo 'net.core.netdev_max_backlog=10000' >> ${D}${sysconfdir}/sysctl.d/62-buffers-performance.conf
echo 'net.ipv4.conf.all.rp_filter = 2' >> ${D}${sysconfdir}/sysctl.d/62-buffers-performance.conf
echo 'net.ipv4.conf.default.rp_filter = 2' >> ${D}${sysconfdir}/sysctl.d/62-buffers-performance.conf
}
INHIBIT_PACKAGE_STRIP = "1"
INSANE_SKIP_${PN} += "dev-so \
already-stripped \
ldflags"
PACKAGES = "${PN}-dbg ${PN} ${PN}-dev ${PN}-doc"
FILES_${PN} += "${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/lib*.so.* \
${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/libBVS_CA-BN.H.*.so \
${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/libBVS_CA-BN.S.*.so \
${base_prefix}/${MVIA_SUBDIR}/${GENICAM_LIB_SUBDIR}/bin/Linux64_ARM/lib*.so \
${sysconfdir}/profile.d/*.sh \
${sysconfdir}/ld.so.conf.d/*.conf \
${sysconfdir}/udev/rules.d/*.rules \
${sysconfdir}/sysctl.d/*.conf"
FILES_${PN}-dev += "${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/lib*.so \
${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/*.cti
FILES_${PN}-doc += "/usr/local/bin/*.sh \
${base_prefix}/${MVIA_SUBDIR}/${GENICAM_LIB_SUBDIR}/cache \
${base_prefix}/${MVIA_SUBDIR}/${GENICAM_LIB_SUBDIR}/log \
${base_prefix}/${MV_DATA_DIR}/genicam"
Note
  • As a unique signature of a task's inputs, checksum indicates when the input data change. Therefore, you need to update the checksum of the license file if it has been changed. Run md5sum [file_name] to check the current MD5 checksum of the file and update it in your recipe.
  • When installing the Impact Acquire libraries for USB3 Vision™ devices, please make sure that libudev and libusb are present in the system BSP.

After the recipe has been created, run bitbake to build it:

$ bitbake impact-acquire-gentl

Install the Impact Acquire PCIe Kernel Module

The Impact Acquire PCIe kernel module is needed in order to use BVS CA-BN devices. Before compiling the out-of-tree kernel module, run the configuration of the virtual kernel from the build directory to create a workspace directory containing the kernel source:

$ bitbake -c menuconfig virtual/kernel
Note
Since the Impact Acquire PCIe kernel module uses the userspace I/O driver, please make sure that it is marked as built-in or as module in the kernel configuration.

The source code of Impact Acquire PCIe kernel module is provided by the Impact Acquire installation archive (version >= 2.44.0), therefore you first need to download the ImpactAcquire-ARM64_gnu-3.3.0.tgz from the Balluff website (https://www.balluff.com/en-de/downloads/software). Assume the target platform is arm64. Skip this step if the same *.tgz has been downloaded during the previous step Install Common Impact Acquire Libraries.

$ cp -r ~/Downloads/ImpactAcquire-ARM64_gnu-3.3.0.tgz recipes-impact-acquire/impact-acquire/files/

Now navigate to the source directory and create a Bitbake recipe for installing the Impact Acquire kernel module:

$ touch recipes-impact-acquire/impact-acquire/mvpci-mod_3.3.0.bb

The demo Bitbake recipe mvpci-mod_3.3.0 looks like this:

SUMMARY = "Builds the BVS CA-BN (mvBlueNAOS) external Linux kernel module"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${WORKDIR}/ImpactAcquire-ARM64-3.3.0/kernelmodules/linux/PCIe/README.txt;md5=ef7c92a2141d1b613ae0072bf978cd85 \
file://${WORKDIR}/ImpactAcquire-ARM64-3.3.0/kernelmodules/linux/PCIe/LICENSES/GPL-2.0-or-later.txt;md5=3d26203303a722dedc6bf909d95ba815"
inherit module
SRC_URI = "file://ImpactAcquire-ARM64_gnu-3.3.0.tgz"
S = "${WORKDIR}/ImpactAcquire-ARM64-3.3.0/kernelmodules/linux/PCIe"
# The inherit of module.bbclass will automatically name module packages with
# "kernel-module-" prefix as required by the oe-core build environment.
RPROVIDES_${PN} += "kernel-module-mvpci"
Note
As a unique signature of a task's inputs, checksum indicates when the input data change. Therefore, you need to update the checksum of the license file if it has been changed. Run md5sum [file_name] to check the current MD5 checksum of the file and update it in your recipe.

After the recipe has been created, run bitbake to build it:

$ bitbake mvpci-mod

Install USB2.0 specific Impact Acquire Libraries

Apart from the common Impact Acquire runtime libraries, you need to install the USB2.0 specific libraries from the Impact Acquire installation archive in order to use BVS CA-MLC/-IGC devices. Therefore, download the ImpactAcquire-ARM64_gnu-3.3.0.tgz from the Balluff website (https://www.balluff.com/en-de/downloads/software). Assume the target platform is arm64. Skip this step if the same *.tgz has been downloaded during the previous step Install Common Impact Acquire Libraries.

$ cp -r ~/Downloads/ImpactAcquire-ARM64_gnu-3.3.0.tgz recipes-impact-acquire/impact-acquire/files/

Create a Bitbake recipe for installing USB2.0 specific Impact Acquire libraries:

$ touch recipes-impact-acquire/impact-acquire/impact-acquire-usb2_3.3.0.bb

The demo Bitbake recipe impact-acquire-usb2_3.3.0 looks like this:

SUMMARY = "Installs USB2.0 specific Impact Acquire libraries"
DESCRIPTION = "This recipe installs Impact Acquire USB2.0 framework libraries for Balluff BVS CA-MLC/-IGC cameras."
HOMEPAGE = "https://www.balluff.com"
LICENSE_FLAGS = "EULA"
LICENSE_FLAGS_WHITELIST = "EULA"
LICENSE = "EULA"
LIC_FILES_CHKSUM = "file://${WORKDIR}/ImpactAcquire-ARM64-3.3.0/doc/EULA/EULA.txt;md5=83910cf672befabf2f24435e2581c79f"
PACKAGE_ARCH = "${MACHINE_ARCH}"
S = "${WORKDIR}"
SRC_URI = "file://ImpactAcquire-arm64-3.3.0.tgz"
TARGET = "arm64"
MVIA_SUBDIR = "opt/ImpactAcquire"
MVIA_LIB_SUBDIR = "lib"
RDEPENDS_${PN} += " impact-acquire-base"
do_install() {
# install Impact Acquire runtime binaries and dependencies for BVS CA-MLC/-IGC devices
install -m 0755 -d ${D}${base_prefix}
install -m 0755 -d ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
oe_soinstall ${S}/ImpactAcquire-ARM64-${PV}/lib/${TARGET}/libmvBlueFOX.so.${PV} ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
# define udev rules for BVS CA-MLC/-IGC devices
install -m 0755 -d ${D}${sysconfdir}/udev/rules.d
install -m 0755 ${S}/ImpactAcquire-ARM64-${PV}/Scripts/51-mvbf.rules ${D}${sysconfdir}/udev/rules.d/
}
INHIBIT_PACKAGE_STRIP = "1"
INSANE_SKIP_${PN} += "dev-so \
already-stripped \
ldflags"
PACKAGES = "${PN}-dbg ${PN} ${PN}-dev"
FILES_${PN} += "${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/lib*.so.* \
${sysconfdir}/udev/rules.d/*.rules"
FILES_${PN}-dev += "${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/lib*.so"
FILES_${PN}-dbg += "${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/.debug"
Note
  • As a unique signature of a task's inputs, checksum indicates when the input data change. Therefore, you need to update the checksum of the license file if it has been changed. Run md5sum [file_name] to check the current MD5 checksum of the file and update it in your recipe.
  • When installing the Impact Acquire libraries for USB2.0 specific devices, please make sure that libudev and libusb are present in the system BSP.

After the recipe has been created, run bitbake to build it:

$ bitbake impact-acquire-usb2

Install Virtual Device Specific Impact Acquire Libraries

Apart from the common Impact Acquire runtime libraries, you need to install the virtual device specific libraries from either the Impact Acquire installation archive in order to use the virtual device. In this example, the ImpactAcquire-ARM64_gnu-3.3.0.tgz will be downloaded and used. Assume the target platform is arm64. Skip this step if the same *.tgz has been downloaded during the previous step Install Common Impact Acquire Libraries or Install GenICam™ GenTL Specific Impact Acquire Libraries.

$ cp -r ~/Downloads/ImpactAcquire-ARM64_gnu-3.3.0.tgz recipes-impact-acquire/impact-acquire/files/

Create a Bitbake recipe for installing Balluff virtual device specific Impact Acquire libraries:

$ touch recipes-impact-acquire/impact-acquire/impact-acquire-virtualdevice_3.3.0.bb

The demo Bitbake recipe impact-acquire-virtualdevice_3.3.0 looks like this:

SUMMARY = "Installs virtual device specific Impact Acquire libraries"
DESCRIPTION = "This recipe installs Impact Acquire driver libraries for virtual devices."
HOMEPAGE = "https://www.balluff.com"
LICENSE_FLAGS = "EULA"
LICENSE_FLAGS_WHITELIST = "EULA"
LICENSE = "EULA"
LIC_FILES_CHKSUM = "file://${WORKDIR}/ImpactAcquire-ARM64-3.3.0/doc/EULA/EULA.txt;md5=83910cf672befabf2f24435e2581c79f"
PACKAGE_ARCH = "${MACHINE_ARCH}"
S = "${WORKDIR}"
SRC_URI = "file://ImpactAcquire-ARM64_gnu-3.3.0.tgz"
TARGET = "arm64"
MVIA_SUBDIR = "opt/ImpactAcquire"
MVIA_LIB_SUBDIR = "lib"
RDEPENDS_${PN} += " impact-acquire-base"
do_install() {
# install Impact Acquire runtime binaries and dependencies for virtual devices.
install -m 0755 -d ${D}${base_prefix}
install -m 0755 -d ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
oe_soinstall ${S}/ImpactAcquire-ARM64-${PV}/lib/${TARGET}/libmvVirtualDevice.so.${PV} ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}
}
INHIBIT_PACKAGE_STRIP = "1"
INSANE_SKIP_${PN} += "dev-so \
already-stripped \
ldflags"
PACKAGES = "${PN} ${PN}-dev"
FILES_${PN} += "${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/lib*.so.*"
FILES_${PN}-dev += "${base_prefix}/${MVIA_SUBDIR}/${MVIA_LIB_SUBDIR}/lib*.so"
Note
As a unique signature of a task's inputs, checksum indicates when the input data change. Therefore, you need to update the checksum of the license file if it has been changed. Run md5sum [file_name] to check the current MD5 checksum of the file and update it in your recipe.

After the recipe has been created, run bitbake to build it:

$ bitbake impact-acquire-virtualdevice

Cross-Compile Impact Acquire Sample Programs

After the required Impact Acquire framework packages have been successfully built, we can use Bitbake to cross-compile programs with the Impact Acquire API. Since the Impact Acquire installation archive already provides sample program source code with CMake files and Bitbake supports CMake, we can use CMake to cross-compile these programs.

First, create a Bitbake recipe for cross-compiling the sample programs:

$ touch recipes-impact-acquire/impact-acquire/impact-acquire-examples_3.3.0.bb

All source code is shipped with ImpactAcquire-ARM64_gnu-3.3.0.tgz and is located under its apps directory.

Here is how the demo recipe impact-acquire-examples_3.3.0.bb looks like:

SUMMARY = "Builds and installs Impact Acquire sample programs"
DESCRIPTION = "This recipe builds and installs Impact Acquire sample programs."
HOMEPAGE = "https://www.balluff.com"
LICENSE_FLAGS = "EULA"
LICENSE_FLAGS_WHITELIST = "EULA"
LICENSE = "EULA"
LIC_FILES_CHKSUM = "file://${WORKDIR}/ImpactAcquire-ARM64-3.3.0/doc/EULA/EULA.txt;md5=83910cf672befabf2f24435e2581c79f"
SRC_URI = "file://ImpactAcquire-ARM64_gnu-3.3.0.tgz"
PACKAGE_ARCH = "${MACHINE_ARCH}"
S = "${WORKDIR}/ImpactAcquire-ARM64-${PV}/apps"
MVIA_SUBDIR = "opt/ImpactAcquire"
MVIA_APP_SUBDIR = "apps"
RDEPENDS_${PN} += " impact-acquire-base"
export MVIMPACT_ACQUIRE_DIR="${WORKDIR}/ImpactAcquire-ARM64-${PV}/"
export LDFLAGS="${TARGET_LDFLAGS} \
-Wl,-rpath-link,${MVIMPACT_ACQUIRE_DIR}lib/arm64 \
-Wl,-rpath-link,${MVIMPACT_ACQUIRE_DIR}Toolkits/expat/bin/arm64/lib"
do_softlink() {
#!/bin/sh -e
cd ${MVIMPACT_ACQUIRE_DIR}Toolkits/expat/bin/arm64/lib
ln -sf libexpat.so.1.* libexpat.so.1
ln -sf libexpat.so.1 libexpat.so
}
addtask softlink after do_fetch before do_configure
inherit pkgconfig cmake
do_install() {
install -m 0755 -d ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_APP_SUBDIR}
install -m 0755 ${WORKDIR}/build/bin/* ${D}${base_prefix}/${MVIA_SUBDIR}/${MVIA_APP_SUBDIR}
}
FILES_${PN} += "${base_prefix}/${MVIA_SUBDIR}/${MVIA_APP_SUBDIR}/*"
Note
As a unique signature of a task's inputs, checksum indicates when the input data change. Therefore, you need to update the checksum of the license file if it has been changed. Run md5sum [file_name] to check the current MD5 checksum of the file and update it in your recipe.

After the recipe has been created, run bitbake to build it:

$ bitbake impact-acquire-examples
Note
In order for the Impact Acquire CMake to be correctly configured, you may need to set the CMAKE_FIND_ROOT_PATH_MODE_INCLUDE variable to BOTH in the cmake.bbclass file.

Configure and Build the Image

Before building the custom Linux image with the Impact Acquire API, we need to install the successfully built Impact Acquire packages to the custom Linux image. In the following demonstration, all packages from above will be installed. You can also just install the ones that you need.

IMAGE_INSTALL_append = " impact-acquire-base"
IMAGE_INSTALL_append = " impact-acquire-base-dev"
IMAGE_INSTALL_append = " impact-acquire-base-doc"
IMAGE_INSTALL_append = " impact-acquire-gentl"
IMAGE_INSTALL_append = " impact-acquire-gentl-dev"
IMAGE_INSTALL_append = " impact-acquire-gentl-doc"
IMAGE_INSTALL_append = " impact-acquire-usb2"
IMAGE_INSTALL_append = " impact-acquire-usb2-dev"
IMAGE_INSTALL_append = " impact-acquire-virtualdevice"
IMAGE_INSTALL_append = " impact-acquire-virtualdevice-dev"
IMAGE_INSTALL_append = " impact-acquire-examples"

After that, bitbake the image to build it for your target system.