Skip to content

Building OpenSplice DDS for LinkIt Smart 7688 (and other OpenWRT on MIPS)

1. Introduction

DDS (Data Distribution Service) is a middleware standard aiming interoperability in machine-to-machine data exchange using a publish–subscribe pattern (wiki).

OpenSplice is a DDS implementation by PrismTech licensed under Apache 2 (github).

LinkIt Smart 7688 is an open development board by Seeed, based on the OpenWrt Linux distribution and Mediatek’s MT7688 SoC (wiki).

2. Overview

Out-of-the-box OpenSplice supports several targets, including some IoT platforms – armv6.linux, armv7.linux and armv8.linux. The goal of this research is to build OpenSplice DDS for LinkIt Smart 7688 and prove its operability by running an example application. Results of this activities are available on github (https://github.com/hutorny/opensplice) as a forked repository with all necessary changes made. This post describes what has been done and how to build OpenSplice from the forked repository.

LinkIt Smart 7688 is based on Mediatek’s MT7688 SoC, which is MIPS little endian, or mipsel.linux in terms of target architectures. But since it is OpenWRT, building for another OpenWRT platform is pretty much the same. To make the reading simpler, select your platform in the choice below and it will hide irrelevant text:

3. Prerequisites

  • Operating system - OpenWRT build system works on Linux, BSD or MacOSX. OpenSplice build needs Linux, Windows or Solaris. So we select Linux as the common basement.
  • Toolchain - A prebuilt LinkIt Smart toolchain is available for download on Mediatek site
  • Toolchain - For most targets OpenWRT needs building the toolchain first.
  • OpenWRT SDK - OpenWRT toolchain requires staging_dir, which is a part of SDK.
  • OpenWRT build prerequisites - subversion zlib1g-dev git python rsync man-db libncurses5-dev gawk gettext unzip file libssl-dev wget zip time
  • OpenSplice build prerequisites - flex bison perl gmake g++ bash

4. Preparations

Download the toolchain and the SDK, and extract them on your build machine.

If a prebuilt toochain is not available

  • follow instructions given OpenWRT wiki: Table of hardware, Build system – Installation, Quick Start and others as needed.

  • Install OpenWRT build prerequisites
    sudo apt-get install subversion zlib1g-dev git python rsync man-db libncurses5-dev gawk gettext unzip file libssl-dev wget zip time
  • Build OpenWRT toolchain and image
    make defconfig
    make

Install OpenSplice build prerequisites (see details on http://www.prismtech.com/dds-community/building)

sudo apt-get build-essential install flex bison perl g++ bash

Ensure cross compiler binaries (mipsel-openwrt-linux-g++mips-openwrt-linux-g++ and its companions) are in the path. If no, add their location to PATH variable or create symbolic links to link them in /usr/bin).

Note: Some toolchains may have extra part in the binaries' names, such as uclibc or musl while missing symbolic links to the toolchain binary without that part. In such case you will need symlinking mipsel-openwrt-linux-*mips-openwrt-linux-* to mipsel-openwrt-linux-musl-*mips-openwrt-linux-musl-* or mipsel-openwrt-linux-uclibc-*mips-openwrt-linux-uclibc-*

5. Enabling Builds for MIPS

OpenSplice build system is implemented as a set of well-structured make files and configured with the configure script, which prompts to select a target from a list of supported targets

So we just copy a subset for armv6.linux and replace armv6.linux with mips.openwrt_linuxmipsel.openwrt_linux

Since there is no native build for OpenWRT, these scripts force CROSS_COMPILE to mips-openwrt-linux-mipsel-openwrt-linux-

6. Compilation

Each new platform for a cross-platform product potentially creates compilation errors. Luckily OpenSplice for OpenWRT had only two issues:

  • Assumption on signal count - os_signalHandler.c:422 - in this place signal number is formatted as a string of two digits. OpenWRT has 129 or more.
  • Use of execinfo.h - sysdeps.c:277 - it provides extended logging capabilities with stack traces.

After fixing those issues, OpenSplice build for OpenWRT succeeds.

7. Building

On the build machine

git clone https://github.com/hutorny/opensplice.git
cd opensplice
export STAGING_DIR=<path to OpenWRT SDK>/staging_dir/
source configure
The last command shows the following choice:
Setup at 16:47:56 for Vortex - Version 6.7.180404OSS - Date 2018-09-05

Available targets are:
1 > armv6l.linux-dev
2 > armv6l.linux-release
3 > armv7l.linux-debug
4 > armv7l.linux-dev
5 > armv7l.linux-release
6 > armv8.linux-dev
7 > armv8.linux-release
8 > mipsel.openwrt_linux-release
9 > mips.openwrt_linux-release
10 > x86_64.linux_clang-dev
11 > x86_64.linux-debug
12 > x86_64.linux-dev
13 > x86_64.linux-gcov
14 > x86_64.linux_icc-dev
15 > x86_64.linux_icc-release
16 > x86_64.linux_opencc-release
17 > x86_64.linux-release
18 > x86.linux-debug
19 > x86.linux-dev
20 > x86.linux-devdat
21 > x86.linux-efence
22 > x86.linux-gcov
23 > x86.linux-release
24 > x86.linux-test
Please select a target number:

Enter 98 then build as the following:

make 
make install

8. Deploying

A successful build populates directory install/RTS/mipsel.openwrt_linux/install/RTS/mips.openwrt_linux/
Lets just strip and tar them, leaving OpenWRT packaging to more knowledgeable developers

cd install/RTS/mipsel.openwrt_linux/
mipsel-openwrt-linux-strip lib/*.so
tar czf ../../RTS.mipsel.openwrt_linux.tar.gz bin etc lib
scp ../../RTS.mipsel.openwrt_linux.tar.gz root@mylinkit:/tmp
cd install/RTS/mipsel.openwrt_linux/
mipsel-openwrt-linux-strip lib/*.so
tar czf ../../RTS.mipsel.openwrt_linux.tar.gz bin etc lib
scp ../../RTS.mipsel.openwrt_linux.tar.gz root@myrouter:/tmp
cd install/RTS/mips.openwrt_linux/
mips-openwrt-linux-strip lib/*.so
tar czf ../../RTS.mips.openwrt_linux.tar.gz bin etc lib
scp ../../RTS.mips.openwrt_linux.tar.gz root@myrouter:/tmp

Note: Here we intentionally omit release.com, because it is based on bash, which is not in the default OpenWRT image

Now, connect to the OpenWRT device, unpack the tar and complete installation

mkdir -p /usr/share/ospldds
cd  /usr/share/ospldds
tar xzvf /tmp/RTS.mipsel.openwrt_linux.tar.gz
export OSPL_HOME=`pwd`
echo export LD_LIBRARY_PATH=$OSPL_HOME/lib >> release.com
echo export OSPL_HOME=$OSPL_HOME > release.com
echo export LD_LIBRARY_PATH=$OSPL_HOME/lib >> release.com
echo export PATH=$OSPL_HOME/bin:$PATH >> release.com
echo export export LD_LIBRARY_PATH=$OSPL_HOME/lib >> release.com
echo export OSPL_URI=file://$OSPL_HOME/etc/config/ospl.xml >> release.com
echo export export OSPL_LOGPATH=/tmp/ >> release.com
mkdir -p /usr/share/ospldds
cd  /usr/share/ospldds
tar xzvf /tmp/RTS.mips.openwrt_linux.tar.gz
export OSPL_HOME=`pwd`
echo export LD_LIBRARY_PATH=$OSPL_HOME/lib >> release.com
echo export OSPL_HOME=$OSPL_HOME > release.com
echo export LD_LIBRARY_PATH=$OSPL_HOME/lib >> release.com
echo export PATH=$OSPL_HOME/bin:$PATH >> release.com
echo export export LD_LIBRARY_PATH=$OSPL_HOME/lib >> release.com
echo export OSPL_URI=file://$OSPL_HOME/etc/config/ospl.xml >> release.com
echo export export OSPL_LOGPATH=/tmp/ >> release.com

Before running DDS application, source release.com

# Note leading dot
. /usr/share/ospldds/release.com

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

*

This blog is protected by dr Dave\'s Spam Karma 2: 211 Spams eaten and counting...