Pages

2012 Millennium Technology Prize Laureate Linus Torvalds


Iperf for ARM: cross-compile

What is Iperf? 
"Iperf was developed by NLANR/DAST as a modern alternative for measuring maximum TCP and UDP bandwidth performance. Iperf allows the tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter, datagram loss." [1] 

Download Iperf 2.x
Iperf 2.x is hosted in source forge server. The latest stable Iperf 2.x version can be downloaded from here

Compile Iperf for your ARM device
In this example I have used the Iperf version 2.0.5 and the Sourcery G++ Lite 2010q1-188 toolchain [2]

1. Setting up compiler variables
$ export CROSS_COMPILE=arm-none-linux-gnueabi-
$ export CC=${CROSS_COMPILE}gcc
$ export CPP=${CROSS_COMPILE}cpp
$ export CXX=${CROSS_COMPILE}g++
$ export LD=${CROSS_COMPILE}ld
$ export AR=${CROSS_COMPILE}ar
2. Start Iperf configuration
$ configure --build=arm-none-linux-gnueabi \
            --host=armv9-none-linux-gnueabi
3. Compile Iperf tool statically
$ make CFLAGS=-static CXXFLAGS=-static
4. The Iperf executable binary is located at src folder of the root compilation path. The following is an example of the output when the ARM device is acting as a server (This tutorial doesn't cover Iperf measurement process):
bash-4.0# ./iperf -s -w 2M -i 1
-----------------------------------------------------
Server listening on TCP port 5001
TCP window size:  256 KByte (WARNING: requested 2.00 MByte)
-----------------------------------------------------
[  4] local 128.247.75.107 port 5001 connected with 128.247.75.64 port 48647
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0- 1.0 sec  11.0 MBytes  92.0 Mbits/sec
[  4]  1.0- 2.0 sec  11.2 MBytes  94.0 Mbits/sec
[  4]  2.0- 3.0 sec  11.2 MBytes  94.1 Mbits/sec
[  4]  3.0- 4.0 sec  11.2 MBytes  94.1 Mbits/sec
[  4]  4.0- 5.0 sec  11.2 MBytes  93.9 Mbits/sec
[  4]  5.0- 6.0 sec  11.2 MBytes  94.2 Mbits/sec
[  4]  6.0- 7.0 sec  8.42 MBytes  70.7 Mbits/sec
[  4]  7.0- 8.0 sec  11.2 MBytes  93.6 Mbits/sec
[  4]  8.0- 9.0 sec  11.2 MBytes  94.1 Mbits/sec
[  4]  9.0-10.0 sec  11.2 MBytes  94.0 Mbits/sec
[  4]  0.0-10.0 sec   109 MBytes  91.5 Mbits/sec
Troubleshooting
If a undefined reference to 'rpl_malloc' problem occurs during the compilation process you can do the following as mentioned in this forum thread:
$ export ac_cv_func_malloc_0_nonnull=yes
 Note: Preferable to start a clean build after setting up this variable to avoid further errors.


[1] http://sourceforge.net/projects/iperf/
[2] https://sourcery.mentor.com/sgpp/lite/arm/portal/release1294