summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorfulup <fulup.arfoll@iot.bzh>2017-07-23 01:23:37 +0200
committerfulup <fulup.arfoll@iot.bzh>2017-07-23 01:23:37 +0200
commita7a6ae4be87ee9178905ab784d84a4c0a8303f9b (patch)
treee5aa96fba9c7ed59f60dd1641fc30c2eeb512e50 /README.md
parent044828c43097362973c82088a7afee760eab06ec (diff)
Added TLV->DBscale into HAL control
1st Working version of HAL ctl-get with TLV Cleanup HTML5 test pages WIP Only
Diffstat (limited to 'README.md')
-rw-r--r--README.md146
1 files changed, 146 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a746cbf
--- /dev/null
+++ b/README.md
@@ -0,0 +1,146 @@
+------------------------------------------------------------------------
+AGL-AUDIO bindings expose low+high level API through AGL framework
+------------------------------------------------------------------------
+
+Cloning Audio-Binding from Git
+-------------------------------------------------------
+
+```
+git clone --recurse-submodules https://github.com/iotbzh/audio-bindings
+cd audio-binding
+
+```
+
+AFB_daemon dependency on Standard Linux Distributions
+-------------------------------------------------------
+ # handle dependencies > (OpenSuse-42.2, Fedora-25, Ubuntu 16.04.2LTS)
+ gcc > 4.8
+ systemd-devel (libsystemd-dev>=222)
+ libuuid-devel
+ file-devel(OpenSuSe) or libmagic-dev(Ubuntu)
+ libjson-c-devel
+ alsa-devel
+ ElectricFence (BUG should not be mandatory)
+ libopenssl-devel libgcrypt-devel libgnutls-devel (optional but requested by libmicrohttpd for https)
+
+ OpenSuse >=42.2
+ zypper in gcc5 gdb gcc5-c++ git cmake make ElectricFence systemd-devel libopenssl-devel libuuid-devel alsa-devel libgcrypt-devel libgnutls-devel libjson-c-devel file-devel mxml-devel
+
+ Ubuntu >= 16.4 libuuid-devel
+ apt-get install cmake git electric-fence libsystemd-dev libssl-dev uuid-dev libasound2-dev libgcrypt20-dev libgnutls-dev libgnutls-dev libjson-c-dev libmagic-dev libmxml-dev
+
+ libmicrohttpd>=0.9.55 (as today OpenSuse-42.2 or Ubuntu-.16.4 ship older versions)
+ afb-daemon from AGL Gerrit git clone https://gerrit.automotivelinux.org/gerrit/src/app-framework-binder
+
+```
+ # Might want to add following variables into ~/.bashrc
+ echo "#---------- AGL options Start ---------" >>~/.bashrc
+ echo "# Object: AGL cmake option for binder/bindings" >>~/.bashrc
+ echo "# Date: `date`" >>~/.bashrc
+ echo 'export CC=gcc-5; export CXX=g++-5' >>~/.bashrc # if using gcc5
+ echo 'export INSTALL_PREFIX=$HOME/opt' >>~/.bashrc
+ echo 'export LD_LIBRARY_PATH=$INSTALL_PREFIX/lib64:$INSTALL_PREFIX/lib' >>~/.bashrc
+ echo 'export LIBRARY_PATH=$INSTALL_PREFIX/lib64:$INSTALL_PREFIX/lib' >>~/.bashrc
+ echo 'export PKG_CONFIG_PATH=$INSTALL_PREFIX/lib64/pkgconfig:$INSTALL_PREFIX/lib/pkgconfig' >>~/.bashrc
+ echo 'export PATH=$INSTALL_PREFIX/bin:$PATH' >>~/.bashrc
+ echo 'export RSYNC_TARGET=MY_TARGET_HOSTNAME' >>~/.bashrc
+ echo 'export RSYNC_PREFIX=./opt' >>~/.bashrc
+
+ echo "#---------- AGL options End ---------" >>~/.bashrc
+ source ~/.bashrc
+
+ # install LibMicroHttpd
+ LIB_MH_VERSION=0.9.55
+ wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-${LIB_MH_VERSION}.tar.gz
+ tar -xzf libmicrohttpd-${LIB_MH_VERSION}.tar.gz
+ cd libmicrohttpd-${LIB_MH_VERSION}
+ ./configure --prefix=${INSTALL_PREFIX}
+ make
+ sudo make install-strip
+
+ # retrieve last AFB_daemon from AGL
+ git clone https://gerrit.automotivelinux.org/gerrit/src/app-framework-binder
+
+ # Warning: previous GCC options should be set before initial cmake (clean Build/*)
+ cd app-framework-binder; mkdir -p build; cd build
+ cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX ..
+ make
+ make install
+```
+
+
+# Compile binding
+
+```
+ source ~/.bashrc # or any other file where your have place your compilation preferences
+ mkdir -p build
+ cd build
+ cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX ..
+ make
+
+ afb-daemon --workdir=.. --ldpaths=build --port=1234 --roothttp=./htdocs --token="" --verbose
+```
+
+# Local Source Debug with GDB
+
+Warning: technically AGL bindings are shared libraries loaded thought 'dlopen'. GDB supports source debug of dynamically
+loaded libraries, but user should be warn that the actual path to sharelib symbols is directly inherited from DLOPEN.
+As a result if you change your directory after binder start with --workdir=xxx then GDB will not find symbols anymore
+
+
+```
+ Examples:
+
+ # WORK when running in direct
+ afb-daemon --workdir=.. --ldpaths=build --port=1234 --roothttp=./htdocs
+
+ # FAIL when using GDB with warning: Could not load shared library ....
+ gdb -args afb-daemon --workdir=.. --ldpaths=build --port=1234 --roothttp=./htdocs
+ ...
+ warning: Could not load shared library symbols for ./build/ucs2-afb/afb-ucs2.so.
+ Do you need "set solib-search-path" or "set sysroot"?
+ ...
+```
+
+To debug sharelib symbol path: start your binder under GDB. Then break your session after the binder has
+loaded its bindings. Finally use "info sharedlibrary" and check 'SymsRead'. If equal to 'No' then either you start GDB
+from the wrong relative directory, either you have to use 'set solib-search-path' to force the path.
+
+```
+ gdb -args afb-daemon --workdir=.. --ldpaths=build --port=1234 --roothttp=./htdocs
+ run
+ ...
+ NOTICE: API UNICENS added
+ NOTICE: Waiting port=1234 rootdir=.
+ NOTICE: Browser URL= http://localhost:1234
+ (hit Ctrl-C to break the execution)
+ info sharedlibrary afb-*
+```
+
+
+# Running an debugging on a target
+
+```
+export RSYNC_TARGET=root@xx.xx.xx.xx
+export RSYNC_PREFIX=/opt # WARNING: installation directory should exist
+
+mkdir $RSYNC_TARGET
+cd $RSYNC_TARGET
+
+cmake -DRSYNC_TARGET=$RSYNC_TARGET -DRSYNC_PREFIX=$RSYNC_PREFIX ..
+make remote-target-populate
+
+ ./build/target/start-${RSYNC_TARGET}.sh
+ firefox http://localhost:1234 # WARNING: do not forget firewall if any
+
+ ssh -tt ${RSYNC_TARGET} speaker-test -twav -D hw:ep01 -c 2
+```
+
+Note: remote-target-populate will
+ - create a script to remotely start the binder on the target in ./build/target/start-on-target-name.sh
+ - create a gdbinit file to transparently debug remotely in source code with gdb -x ./build/target/gdb-on-target-name.ini
+ - to run and debug directly from your IDE just configure the run and debug properties with the corresponding filename
+
+Note that Netbeans impose to set debug directory to ./build/pkgout or it won't find binding symbols for source debugging
+
+
#0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#!/bin/sh

#This test is writen taking the DRA7xx-EVM board as an example
#these tests will be skipped if 2 interfaces are not detected.
#Theorical values of bitrate is from 1Kbit/s to 1Mbit/s
#Real values to provide transmission are between 10797 bit/s and 1909090git bit/s
#Real values that doesn't provide transmission but belong to the domain are between 781 bit/s and 5209999 bit/s

if [ ! -e /sys/class/net/can1 ];then
	lava-test-case can0_bitrate_range_start --result skip
	lava-test-case can1_bitrate_range_start --result skip
	lava-test-case can1_xfer_config_range_start --result skip
	lava-test-case can1_xfer_tx_range_start --result skip
	lava-test-case can1_xfer_tx_range_end  --result skip
	lava-test-case can0_bitrate_range_end --result skip
	exit 0
fi

#This is the first part of the test, that tests if the bitrate inserted belongs to the domain and if
#this first bitrate afford frames transmission or not
ip link set can0 down
if [ $? -eq 0 ];then
    lava-test-case stop_can0 --result pass
else
    lava-test-case stop_can0 --result fail
fi
sleep 2
ip link set can1 down
if [ $? -eq 0 ];then
    lava-test-case stop_can1 --result pass
else
    lava-test-case stop_can1 --result fail
fi
sleep 2

# b refers to bitrate

found_bitrate=0
for b in `seq 778 790`;do
	ip link set can0 type can bitrate $b
	x=$?
	if [ $x -eq 0 ];then
		lava-test-case can0_bitrate_range_start --result pass --measurement $b --units bit/s
		echo "$b is the first bitrate in the domain"
		found_bitrate=1
		ip link set can1 type can bitrate $b
		if [ $? -eq 0 ];then
			lava-test-case can1_bitrate_range_start --result pass --measurement $b --units bit/s
		else
			lava-test-case can1_bitrate_range_start --result fail --measurement $b --units bit/s
		fi
		sleep 2
		ip link set can0 up
		if [ $? -eq 0 ];then
			lava-test-case start_can0 --result pass
		else
			lava-test-case start_can0 --result fail
		fi
		sleep 2
		ip link set can1 up
		if [ $? -eq 0 ];then
			lava-test-case start_can1 --result pass
		else
			lava-test-case start_can1 --result fail
		fi
		sleep 2
		file_can=$(mktemp)
		cangen can0 &
		candump can1 > $file_can &
		sleep 3
		if [ -s $file_can ];then
			lava-test-case can1_xfer_config_range_start --result fail --measurement $b --units bit/s
		else
			lava-test-case can1_xfer_config_range_start --result pass --measurement $b --units bit/s
			sleep 2
			echo "This bitrate $b belongs to the domain but doesn't provide frames transmission"
		fi
		rm $file_can
		break
	fi
done

if [ $found_bitrate -eq 0 ];then
	lava-test-case can0_bitrate_range_start --result fail --measurement $b --units bit/s
	sleep 2
	echo "There is no supportable bitrate in this interval"
fi
ip link set can0 down
ip link set can1 down
sleep 2
#This is the second part of the test, it tests the first bitrate to provide frames transmission

ip link set can0 down
ip link set can1 down
found_bitrate_for_transmisson=0
for b in `seq 10790 10800`;do
    ip link set can0 type can bitrate $b
    ip link set can1 type can bitrate $b
    ip link set can0 up
    ip link set can1 up
    sleep 3
    file_can=$(mktemp)
	cangen can0 &
	candump can1 > $file_can &
	sleep 4
    if [ -s $file_can ];then
		found_bitrate_for_transmisson=1
		lava-test-case can1_xfer_tx_range_start --result pass --measurement $b --units bit/s
        sleep 2
		echo "$b is the first supportable bitrate to provide transmission"
		rm $file_can
		break
	fi
	ip link set can0 down
	ip link set can1 down
	rm $file_can
done

if [ $found_bitrate_for_transmisson -eq 0 ];then
	lava-test-case can1_xfer_tx_range_start --result fail --measurement $b --units bit/s
	sleep 2
	echo "There is no bitrate in this interval to provide frames transmission"
fi


#This is the third part of the test, it tests the last bitrate to provide frames transmission

ip link set can0 down
ip link set can1 down
bitrate_no_transmission=0
for b in `seq 1909088 1909092`;do
    ip link set can0 type can bitrate $b
    ip link set can1 type can bitrate $b
    ip link set can0 up
    ip link set can1 up
    sleep 2
    file_can=$(mktemp)
    cangen can0 &
    candump can1 > $file_can &
    sleep 3
	size=$(stat -c %s $file_can)
	if [ $size -eq 0 ];then
		bitrate_no_transmission=1
		lava-test-case can1_xfer_tx_range_end --result pass --measurement $(($b-1)) --units bit/s
		sleep 2
		echo "This bitrate $b doesn't provide frames transmission"
		echo "The last bitrate to provide frames transmission is $(($b-1))"
		break
	fi
	ip link set can0 down
	ip link set can1 down
    rm $file_can
done

if [ $bitrate_no_transmission -eq 0 ];then
	lava-test-case can1_xfer_tx_range_end --result skip --measurement $b --units bit/s
	echo "All bitrates in this interval provide frames transmission, the last bitrate not found in this range"
	ip link set can0 down
	ip link set can1 down
fi

#This is the last part of the test, it tests the last bitrate that belongs to the domain
sleep 3
ip link set can0 down
ip link set can1 down
out_of_domain=0
for b in `seq 5290999 5291000`;do
	ip link set can0 type can bitrate $b
	x=$?
	sleep 2
	if [ $x -ne 0 ];then
		out_of_domain=1
		lava-test-case can0_bitrate_range_end --result pass --measurement $(($b-1)) --units bit/s
		echo "$b is the first bitrate to be out of the domain"
		echo "The last bitrate to belong to the domain is $(($b-1))"
		break
	fi
done

if [ $out_of_domain -eq 0 ];then
	lava-test-case can0_bitrate_range_end --result fail --measurement $b --units bit/s
	echo "All bitrates in this interval belong to the domain"
	canconfig can0 stop
	canconfig can1 stop
fi