Beruflich Dokumente
Kultur Dokumente
1
Introduction
Assembly of Raspberry Pi
The rst step before the cross-development is to assembly the components to-
gether, to get a Raspberry Pi inside the case with the 3.5 inch monitor on the
top.
To ensure that the processors do not overheat in case of the larger pro-
grammes that are being run by it, it was neccessary to place the heat sinks on
them. This was done by placing the double sided tape onto heat sinks, and
placing them on the processors. Heat sink will ensure the regulation of the
temperature of the device, and stabilize it to the optimal level.
When nishing up with the heat sinks implementation, the monitor is added
onto the Raspberry Pi. This is a 3.5 inch RPi Display Touch monitor that
allows us a nice communication with our Raspberry Pi. Display is set up to
sink into the general purpose input and output (GPIO) part of our computer,
and it is connected by the HDMI to HDMI converter (male to male adapter),
that is pluged in the monitors and Raspberry Pi's HDMI port simultaneously.
To ensure that the screen and computer stays safe, it is placed into the case
that we screwed on placing these two safely and tightly together.
Next step was to plug in the keyboard, mouse, place in SD card with the
operating system inside, and power up the Raspberry Pi.
To install the working operating system for our computer, rst step is to
download the NOOBS, or New Out Of The Box Software, from the Raspberry
Pi site. This software will allow us to choose from the range of the operating
2
systems for our computer. The default operating system is Rasbian, that we
installed onto the Raspberry Pi.
Cross-Development
Since our host computer was based on the Windows operating system, we install
the virtual machine (Virtual Box) to use as the Ubuntu that is needed for our
cross compilation. We used the Ubuntu 16.04 on the laptop to ensure that the
cross-development goes smoothly, and followed the steps from the internet links
that were provided to us.
First step was to install build tools, C and C++ compire and build tools
for the Pi's ARM processor, and debugging tool. These are three lines of codes
that we entered into terminal:
• arm-linux-gnueabihf-g++ -v
The last command entered was to check if the G++ compiler is installed. Af-
terwards, we made a simple hello.cpp le inside the directory that was created.
The source code looks as follows:
• #include <iostream>
• int main()
• {
• int a=2;
• int b=5;
• int c=a+b;
• return 0;
• }
Firstly, we changed the directory using -cd command, so that we could create
the compilation le of the one we wrote down as the source code. Then, we
used following code lines to implement that le:
3
• arm-linux-gnueabihf-g++ -O3 -g3 -Wall -c -fPIC -o hello.o hello.cpp
The next step is to move this le to our Raspberry Pi. Now, we set up the
Raspberry Pi connection by using gdbserver. This is the way of connecting our
system to the host computer via IP address and port number. IP address used
here was the IP address of our Virtual Box through the wireless network, that
was found using ipcong on the Windows command prompt. The code entered
in terminal of Raspberry Pi is following:
Hello is the name of the executable le that we want to move, pi is the name
of the system we want to move it to together with the IP address of it, and
the other part is the path of the directory that we want to move it to, together
with the name of le that will be executed. It also looked for password of the
Raspberry Pi (it is, by default, raspberry). We see that the output shows us
that the 100% of le was moved.
The transfer of le could also be done using USB, but this way is more suit-
able and convenient way for future use as well. Since we use gdb for debugging,
we now enter this command on our host computer as well in order to establish
connection and debug and run the executable program. Code is following:
• gdb-multiarch
4
• set remote exec-le emina/hello
• le hello
• run
As we can see from the gure, the program was run successfully, and our
outputs (the outputs were number 7 and line Hello World!) were shown on
the Raspberry Pi terminal.
To see that we could access the code, and check the variables inside, we used
breakpoint to stop the execution at one line, and we tried to access the value of
one integer inside the code. We used command break at line 11, and later on
the command p, where we check for the value of integer a.
5
Figure 4: Breakpoint
As we can see from the gure, when we place breakpoint at some line of our
le (in our case, line 11), the line where breakpoint was made will be shown on
our terminal. The next step was to check if we could see the values inserted in
our le, and if they were correct (in our case, to check the value of the integer
a). It was as expected, it gave correct output based on our source code.
Conclusion