Cross-compiling (ES series)


From SamyGO
Revision as of 17:47, 6 January 2013 by E3V3A (talk | contribs) (Original Entry)
Jump to: navigation, search

This is Work In Progress !!

No answers/solutions can be expected here yet. If you need quick answers Google the forums.

@developers:
Do not change or update this page without first checking/asking on the "Talk" page or support forum thread for latest status/info.


Cross Compiling

This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV sets. It is primary intended as a crash course for getting even a novice to be able to quickly compile his/her own programs to run on their TV sets. As such, we will assume that you are using a Windows based PC with a basic installation of Cygwin. The modification for using a Linux based PC will then be minimal and even simpler.

Introduction

If you have never cross-compiled anything before, this is the right place for you. If you already have experience and knowledge with cross compilation, this wiki may still be helpful to get you started. If you are looking for information on how to build your own cross-compiler, this place is not for you. (Look HERE instead.)


What this Wiki will cover and not.

- We will use a popular pre-compiled cross-compiler.
- We will work on a Windows (Intel/AMD) based PC.
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same.

- We will not cover the compilation of a cross-compiler!
- We will not cover other cross-compilers, operating systems or processor architectures.


A few Questions and Answers:

Q:  What is a cross-compiler?
A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), 
    but which is built and configured for compiling code for another processor (e.g. ARM).
Q:  Should I get a pre-compiled cross-compiler or compile my own?
A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!
Q:  Where can I find help to configure my cross-compiler?
A:  Not here. If it's not already in here or in our forums, we don't know.
Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)
A: ** It depends on what you need to compile. (See below.)
Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)
A:  ** Hopefully not, but it depends on what you need to compile. (See below.)

** = unknown and not fact!


Things you need to get started.

WIP! This need checking and adjustment...

1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)
2. Install a good text editor (EditPlus, Notepad++ etc.)
3. Download a suitable pre-compiled cross-compiler. 
4. Download your TV kernel sources.
5. Download your TV firmware sources. (?)
6. 



Steps:

(A) Install & Verify the pre-compiled cross-compiler on your PC.
(B) Verify your TV sets processor / architecture. 
(C) Compile "HelloWorld" and run it on TV.

Extras:

(D) Installing the Samsung cross-compiler.

(E) Installing your TV Kernel sources.   
(F) Installing your TV firmware sources.

(G) Compiling the Kernel
(H) Compiling a Kernel module


(A) Installing the Cross-Compiler

Go to the Mentor Graphics website, and download the "Sourcery CodeBench Lite Edition" from HERE. (You'll need to supply an email to get a download link.) There you will get a few different choices based on the platform. You will have choices such as:

arm-2012.09-63-arm-none-eabi.exe
arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2
arm-2012.09-64-arm-none-linux-gnueabi.exe
arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2
arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

If you use a x86 Windows based system, choose: "arm-2012.09-64-arm-none-linux-gnueabi.exe". Run it, and when asked, change the installation directory to something simple like: C:\zarm\csbench
The rest of the installation procedure is self explanatory.

After installation, verify that the cross-compiler PATH variable is properly set and working:

$ arm-none-linux-gnueabi-gcc --version

arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

Since this is a Windows installer, Cygwin may or may not catch the updated system PATH variable. Open a new Cygwin shell and check:

$ echo $PATH

If it's not working, you'll have to add the following line in your ~/.bash_profile file. (On some systems this file is called ".profile".)

PATH=${PATH}:/cygdrive/path/to/csbench/bin;

This should do it.

*******************************************************************************
If you want to have access to the cross-compiler's man pages you'll have to 
add the following line to /etc/man.conf:

 MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man

and/or possibly this line to your ~/.bashrc

 MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;

*******************************************************************************


If you have more questions, check out the Sourcery ARM FAQ.