Cross compile and remote debug

Install yocto poky toolchain

Download latest toolchain: http://update.aizo.com/feeds/digitalstrom-devel/sdk/

Run the installation script :

./poky-glibc-x86_64-meta-toolchain-armv5e-toolchain-2.0.2.sh 
Poky (Yocto Project Reference Distro) SDK installer version 2.0.2
=================================================================
Enter target directory for SDK (default: /opt/poky/2.0.2): 
You are about to install the SDK to "/opt/poky/2.0.2". Proceed[Y/n]? Y
Extracting SDK...................................................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /opt/poky/2.0.2/environment-setup-armv5e-poky-linux-gnueabi

Add the toolchain to your standard search path, library path, pkg-config path:

source /opt/poky/2.0.2/environment-setup-armv5e-poky-linux-gnueabi

Ensure the environment file contains these variables, add if missing

+export ARCH=arm
+export CROSS_COMPILE=arm-poky-linux-gnueabi-

$ arm-poky-linux-gnueabi-gcc --version
arm-poky-linux-gnueabi-gcc (GCC) 5.2.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ pkg-config --list-all | grep ds
libds485-client       libds485-client - digitalSTROM dS485 Client Library
libdsuid              libdsuid - dSUID manipulation and utility library
libdsvdc              libdsvdc - digitalSTROM vDC Interface Library
ds485-netlib          ds485-netlib - dS485 network library

Install oe-core toolchain

Download latest toolchain: http://update.aizo.com/feeds/dss11-devel-eglibc/sdk/

wget http://update.aizo.com/feeds/dss11-devel-eglibc/sdk/angstrom-eglibc-x86_64-armv5te-v2015.03-core-toolchain.tar.bz2
tar xjf angstrom-eglibc-x86_64-armv5te-v2015.03-core-toolchain.tar.bz2 -C /

Add the toolchain to your standard search path, library path, pkg-config path:

source /usr/local/angstrom-eglibc-i686-armv5te/environment-setup-armv5te-angstrom-linux-gnueabi

Ensure the environment file contains these variables, add if missing

+export ARCH=arm
+export CROSS_COMPILE=arm-angstrom-linux-gnueabi-

$ arm-angstrom-linux-gnueabi-gcc --version
arm-angstrom-linux-gnueabi-gcc (GCC) 4.5.4 20110917 (prerelease)

$ pkg-config --list-all | grep ds
libdsvdc                  libdsvdc - digitalSTROM vDC Interface Library
libdsuid                  libdsuid - dSUID manipulation and utility library
ds485-netlib              ds485-netlib - dS485 network library

Cross compile dSS

General description for configuring/building the dSS described here How to build the dSS

Cross compile dSS (x86 host)

  1. (once) rm /usr/local/angstrom-eglibc-i686-armv5te/sysroots/armv5te-angstrom-linux-gnueabi/usr/lib/*.la
  2. source /usr/local/angstrom-eglibc-i686-armv5te/environment-setup-armv5te-angstrom-linux-gnueabi
  3. ./configure --host=armv5te-angstrom-linux-gnueabi --with-boost=$OECORE_TARGET_SYSROOT/usr --with-sendmail-location=/usr/sbin/sendmail --with-distro-version-file=/etc/version --enable-http --with-dss-data=/usr/share/dss/data --with-dss-config=/usr/share/dss/data --with-dss-saved-properties=/usr/share/dss/data --enable-debug
  4. make -j3

Cross compile dSS (x86_64 host)

  1. (once) install meta-toolchain package to /
  2. (once) rm /usr/local/angstrom-eglibc-x86_64-armv5te/sysroots/armv5te-angstrom-linux-gnueabi/usr/lib/*.la
  3. source /usr/local/angstrom-eglibc-x86_64-armv5te/environment-setup-armv5te-angstrom-linux-gnueabi
  4. ./configure --host=armv5te-angstrom-linux-gnueabi --with-boost=$OECORE_TARGET_SYSROOT/usr --with-sendmail-location=/usr/sbin/sendmail --with-distro-version-file=/etc/version --enable-http --with-dss-data=/usr/share/dss/data --with-dss-config=/usr/share/dss/data --with-dss-saved-properties=/usr/share/dss/data --enable-debug
  5. make -j3

Cross compile dSS (x86_64 host) with poky

  1. (once) install meta-toolchain package to /opt/poky/2.0.2
  2. (once) rm /opt/poky/2.0.2/sysroots/armv5e-poky-linux-gnueabi/usr/lib/*.la
  3. source /opt/poky/2.0.2/environment-setup-armv5e-poky-linux-gnueabi
  4. ./configure --host=armv5e-poky-linux-gnueabi --with-boost=$OECORE_TARGET_SYSROOT/usr --with-sendmail-location=/usr/sbin/sendmail --with-distro-version-file=/etc/version --enable-http --with-dss-data=/usr/share/dss/data --with-dss-config=/usr/share/dss/data --with-dss-saved-properties=/usr/share/dss/data --with-dss-databases=/usr/share/dss/data/databases --enable-debug
  5. make -j3
  6. (optional) arm-poky-linux-gnueabi-strip build/dss

You can use the attached make_arm script to make without having to remember to set up the environment. Alternatively look into the attached config.cross.sh that gives you some more configuration options.

Problems & Solutions

Command autoreconf - i fails when environment-setup-.... is sourced in current shell.

Run it from other shell.
Run it from other shell every time you happen to modify the tree such that it needs to recreate configure script. Then continue with `make` in shell where with environment-setup-.... is sourced.

Cross compile ds485 stack

Check How_to_build_the_dSS for updates. It describes compilation on x86, not cross-compiling.

$ cat ../../env_at91_poky.sh 
source /opt/poky/2.0.2/environment-setup-armv5e-poky-linux-gnueabi

export PREFIX=$HOME/dSS/sysroot_at91

# pkg-config --list-all to find packages installed in $PREFIX
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH:

# dsm-api-v2
export DSDATA_PATH=$PREFIX/share/digitalstrom
export PYTHONPATH=$PYTHONPATH:$PREFIX/lib/python2.7/dist-packages
#export LUA_CPATH=$LUA_CPATH:$PREFIX/lib/lua/*
export LUA_CPATH=$PREFIX/lib/lua/5.2/?.so

# find libraries installed in PREFIX, e.g. needed when running dss
export LD_LIBRARY_PATH=$PREFIX/lib
export PATH=$PATH:$PREFIX/bin

# MacOS X:
export DYLD_LIBRARY_PATH=$PREFIX/lib
$ cat ../../env_at91.sh 
source /usr/local/angstrom-eglibc-x86_64-armv5te/environment-setup-armv5te-angstrom-linux-gnueabi

export PREFIX=$HOME/dSS/sysroot_at91

# pkg-config --list-all to find packages installed in $PREFIX
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH:

# dsm-api-v2
export DSDATA_PATH=$PREFIX/share/digitalstrom
export PYTHONPATH=$PYTHONPATH:$PREFIX/lib/python2.7/dist-packages
#export LUA_CPATH=$LUA_CPATH:$PREFIX/lib/lua/*
export LUA_CPATH=$PREFIX/lib/lua/5.2/?.so

# find libraries installed in PREFIX, e.g. needed when running dss
export LD_LIBRARY_PATH=$PREFIX/lib
export PATH=$PATH:$PREFIX/bin

# MacOS X:
export DYLD_LIBRARY_PATH=$PREFIX/lib

Autotools

#!/bin/sh
source ../../env_at91.sh
autoreconf -i
mkdir build_at91
cd build_at91
../configure --prefix=$PREFIX --host=${CROSS_COMPILE%-}
# make -C build_at91 -j8

Remote debug

On the host

# @/usr/local/angstrom-eglibc-i686-armv5te/sysroots/i686-angstromsdk-linux/usr/bin/armv5te-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-gdb build/dss@
# @set sysroot /usr/local/angstrom-eglibc-i686-armv5te/sysroots/armv5te-angstrom-linux-gnueabi/@
# @directory /usr/local/angstrom-eglibc-i686-armv5te/sysroots/armv5te-angstrom-linux-gnueabi/@
# @handle SIGUSR1 nostop@
# @target remote <target>:9999@

After a crash: thread apply all bt

On the dSS11

  1. start dss
  2. gdbserver --attach localhost:9999 $(pidof dss)

make_arm - script to setup cross environment and make (116 Bytes) Christian Hitz, 04/03/2014 05:44 PM

config.cross.sh Magnifier (1.2 KB) Michael Troß, 12/09/2015 02:10 PM