There are a lot of different variants of the PowerPC architectures out there. This is what worked for me when cross compiling for the Freescale P2041 processor. The P2041 contains four e500mc cores. e500mc cores are not the same thing as e500v2. My test platform was the Freescale P2041RDB development board. The development board is running a custom port of Linux. My host platform is a virtual machine running Ubuntu 14.04.2 LTS.
Cross compile tool chain
The cross compile tool chain that I used was version 5.5.3 of the ELDK tool kit. When downloading the tool kit you need eldk-5.5.3-powerpc.iso. When I installed the tool kit I used the command line
./install -r "lsb-dev" powerpc
The ELDK tool kit does not come with a pre-compiled version of libsodim and you have to build your own. Download libsodium from libsodium. I used libsodium-1.0.3.tar.gz. Extract libsodium to a local directory. I used the following command line to build the library.
# Setup environment variables for cross compiling source /opt/eldk-5.5.3/powerpc/environment-setup-powerpc-linux ./configure \ --host=powerpc-linux \ --prefix=/opt/eldk-5.5.3/powerpc/sysroots/powerpc-linux make # must execute in a root shell make install
This places the compiled library files in a directory /opt/eldk-5.5.3/powerpc/sysroots/powerpc-linux The actual location is going to vary based upon the cross compile tool chain that you use. The make install command must be executed from a root shell if you are using Ubuntu as your host machine. When I used "sudo make install" the install failed. To start a root shell execute the command
Download the source for zeromq. I used zeromq-4.1.2.tar.gz. Extract to a local directory. I used the following command line to build the library
# Setup environment variables for cross compiling source /opt/eldk-5.5.3/powerpc/environment-setup-powerpc-linux ./configure \ --host=powerpc-linux \ --prefix=/opt/eldk-5.5.3/powerpc/sysroots/powerpc-linux \ PKG_CONFIG_PATH=/opt/eldk-5.5.3/powerpc/sysroots/powerpc-linux/lib/pkgconfig \ CPPFLAGS=-I/opt/eldk-5.5.3/powerpc/sysroots/powerpc-linux/include \ LDFLAGS=-L/opt/eldk-5.5.3/powerpc/sysroots/powerpc-linux/lib make # must execute from root shell, see previous note make install
I built the examples with the following command line
# Setup environment variables for cross compiling source /opt/eldk-5.5.3/powerpc/environment-setup-powerpc-linux # build client powerpc-linux-gcc /home/chen2/work/zeromq/examples/C/hwclient.c \ -o /home/chen2/work/chassisStaging/hwclient \ -I/opt/eldk-5.5.3/powerpc/sysroots/powerpc-linux/include \ -lzmq -lsodium # build server powerpc-linux-gcc /home/chen2/work/zeromq/examples/C/hwserver.c \ -o /home/chen2/work/chassisStaging/hwserver \ -I/opt/eldk-5.5.3/powerpc/sysroots/powerpc-linux/include \ -lzmq -lsodium
I copied the sodium and zeromq libraries to /lib on my target. The list of files that I copied over was
libsodium.a libsodium.so.13 libzmq.la libzmq.so.5.0.0 libsodium.la libsodium.so.13.2.0 libzmq.so pkgconfig libsodium.so libzmq.a libzmq.so.5
I then copied the entire directory chassisStaging, which contained hwserver, hwclient over to my target.
For the server
~/work/chassisStaging$ ./hwserver Received Hello Received Hello Received Hello Received Hello Received Hello Received Hello Received Hello Received Hello Received Hello Received Hello ^C
For the client
~/work/chassisStaging$ ./client Connecting to hello world server... Sending Hello 0... Received World 0 Sending Hello 1... Received World 1 Sending Hello 2... Received World 2 Sending Hello 3... Received World 3 Sending Hello 4... Received World 4 Sending Hello 5... Received World 5 Sending Hello 6... Received World 6 Sending Hello 7... Received World 7 Sending Hello 8... Received World 8 Sending Hello 9... Received World 9
Written: 07 Mar 2016 10:35
Revised: 07 Mar 2016 10:37
If you found this page useful, please rate it up so others will find it.
Who's watching this page?Dominic Luciano
Fernando J Quintero
... and more