Pages

Tuesday, September 18, 2012

ISU - Exercise 3 - Connecting to Target & Programming to Target

Connecting to target

The goals for the first part of Exercise 3 is to:
have set up the target(DevKit8000) for communication with the host (Kubuntu).
have set up the interfaces for file sharing
have shared a file between host and target 

Important links: 
http://devkit8000.wikispaces.com/SSH+and+SCP  

1. Connect to the target

We have setup the target and host as descriped in the exercise.
We have enabled usb user interface with the following command: sudo ifup usb0

2. Test connection

First we type ifconfig usb0 to check the ip addresse:

We have to connect with a secure connection using ssh root@10.9.8.2 following warning appears:
Because of the warning we have to fulfill the connection by doing following:
We are now connected to the target (root@beagleboard).


3. Move a file

Host:
We use scp to securely copy the file "abc" to the target folder "test".
scp abc root@10.9.8.2:/home/root/test/

Target:
We are checking if the "abc" file is transfered to the target using the ls command.

It is succesfully transfered !


Programming to Target

The goals for part two of Exercise 3 is to:

have learned the difference between compiling for host and target
have learned how to use direct compiler invocation to compile a program for target 
have written a makefile and used make for compilation for both host and target 

1. Cross compiling the program Hello World and running it on target

Host:
We have a cpp file called hello.cpp we compile it with the angstrom compiler like this:

arm-angstrom-linux-gnueabi-g++ -o hello_tgt hello.cpp


2. Using makefiles to build host and target programs

Make files

The makefile for the host, makefile.


The makefile for the target, makefile.target.

















Building programs using makefiles

Host:
We build our program for the host using make

We build our program for the target using make -f  makefile.target 


We execute the host executable on the host using ./hello



Before we can execute the target file we have to copy the executable to the target, to copy the directory with all files included we write this: scp -r hellotarget root@10.9.8.2:/home/test










Target:
We execute the target executable on the target using ./hello.tgt



3. Cross compiling with more extended makefiles

Makefiles


The makefile for the host, makefile.


The makefile for the target, makefile.target.



Building programs using makefiles

Host:
We build our program for the host using make


We build our program for the target using make -f  makefile.target 


We execute the host executable on the host using ./parts






It is succesfully executed !

Before we can execute the target file we have to copy the executable to the target, to copy the directory with all files included we write this: scp -r targetparts root@10.9.8.2:/home/test















Target:
We navigate to the folder with the file: parts.tgt on the target and execute this file on the target using ./parts.tgt


It is succesfully executed  on the target !

4. Improving cross compilation handling in makefiles

Makefile for host:


Makefile for target:




1 comment:

  1. The main goals in the first Exercise "Connect to target", was like the title says connect to target, and try to send a file to target, which you explain in a good way, simple an easy to understand, well done! Good screenshots as well.

    In the second exercise "Building C++ for target", the main goal was to learn the different how to compile for host and for target.
    In exercise1 about the hello_world program, we miss some screenshot's the execution. We miss ass well that you use the command
    "file hello_tgt", to see that the file is made for target (ARM-file).
    Exercise2, makefile to host and target, its good to see both the makefile's. For the next time you can see the difference between both file by typing "diff" and then the names of both makefile's. Good screenshots of the exercise.
    There is one thing, when you copy the executable file to target, you use scp -r ..., but in the exercise "Connect to target", you online use scp and then the name. I'd like you to explain why you write "-r" ass well.

    In exercise3, makefile's for parts, good to have both makefiles. Good screenshot, well done exercise.

    Exercise4, good to have both makefiles, but we miss you document that its working, we miss some screenshot. The code for this exercise is looking right, but to prove that you have to show thats its working.

    Overall nice job, miss some screenshots and some explanation, but good job making the exercises.

    ReplyDelete