Working on Raspberry Pi 3 - Part 2

Working on Raspberry Pi 3 - Part 2

The next step is to either build a tool chain or use a already existing tool chain. Let us look at the next steps with one leg already on the accelerator to race ahead.
Create a folder in the Linux machine:
Go to "Home" directory in your Linux machine.
Create a folder "linuxwork" in the "Home" directory
Note: You can name the folder as per your convenience. Make sure that you name the folder as simple as possible as you might have to call this folder from command prompt. Simple name is easy to use.

Move the "linux-4.9.9.tar.xz" kernel image to the "linuxwork" folder. Now all our work happens from the same folder.

Downloading cross tool chain:
We remember from college days that we need a compiler to compile the written program in C or C++. The purpose of compiler is to convert the high level language to machine level language. If you take Linux, it comes with in-built GNU tool chain, which has a gcc compiler. Using this we can compile C programs. Now we are writing programs for processor boards for which generic GNU tool chain is not enough as it doesn't support the processor architecture. We have to install a processor specific tool chain in order to compile a written code. The tool chain used for embedded development is a cross tool chain, or more commonly known as a cross compiler.

What is cross compilation?
All the programs we write run on a host system (your own laptop or personal computer) of a specific architecture but produce binary code to run on a different architecture (e.g. ARM). This process is called cross compilation and is the common method of building embedded software.

For example, Raspberry Pi has BCM2837 processor from Broadcom, Beagle Bone Black has AM335x processor from Texas Instruments. They are ARM architecture based processors. So, there are specific tool chains for these boards. Tool chains can be readily available or they must be built on our own. The below frame works are used to build a tool chain for specific boards,

1. Build Root
2. Yocto
3. OpenADK
3. Open Embedded
4. Crossdev (Gentoo)
5. Crosstool-NG
6. EmbToolkit
7. Crossdev/tsrpm (Timesys)
8. Bitbake

Other than building a tool chain, we can use a readily availalbe tool chain provided by the vendors. Like fo example, Linaro (ARM) and Fedora ARM.

Raspberry pi 3 doesn't have a pre-built tool chain where as Raspberry Pi 1 has such tool chain. If you are using Raspberry Pi 1 download the tool chain from github.
https://github.com/raspberrypi/tools

Check if you have the latest version of gcc compiler or not:
cat /proc/version

If you have any doubts regarding the readily available tool chain, try to build your own cross-compiler using the frame works available. In the next steps, we will try to build a tool chain on our own.

Post a Comment

0 Comments