Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer System Laboratory

Similar presentations


Presentation on theme: "Computer System Laboratory"— Presentation transcript:

1 Computer System Laboratory
Lab3 - Cross Tools

2 Experimental Goal Build a development environment for embedded systems. Cross compiler, assembler, linker Cross C standard library C program compiler Assembly language program assembler Transforms the C program into an assembly language program Object: Machine language module Object: Library routine (machine language) linker Executable: Machine language program 2013/10/1 / 15

3 Environment Host System Build System Target System Software
Windows XP Build System VirtualBox + Ubuntu 8.04 Target System Creator XScale PXA270 Software GNU Binutils GNU Compiler Collection (GCC) Red Hat Newlib makeinfo_version.patch You can download all software from RSWiki CSL Course Software 2013/10/1 / 15

4 Change Apt Sources List
Ubuntu 8.04 is now out of support and no longer receiving updates and security patches. There are repositories available at releases.ubuntu.com. Step1: modify /etc/apt/sources.list. % sudo sed -i -e 's/tw.archive.ubuntu.com\|security.ubuntu.com/old- releases.ubuntu.com/g' /etc/apt/sources.list You have to be careful of the area which was set during the installation. If you chose the area other than Taiwan, you have to modify the command to the correct one. You can type “man sed” to see more information. Step2: upgrate the sources list. % sudo apt-get update 2013/10/1 / 15

5 GNU Cross-Binutils Compilation (1/2)
Prerequisite % sudo apt-get install libc6-dev texinfo vim patch Step1: download the source codes. % wget ils tar.gz Step2: extract the source codes. % tar zxvf binutils tar.gz Step3: set configuration before you compile the source codes. % cd binutils % ./configure --target=arm-elf --prefix=$HOME/<your path> configure command is used to automatically create a Makefile according to your configurations. Makefile is used to specify how to build your source codes. 2013/10/1 / 15

6 GNU Cross-Binutils Compilation (2/2)
Step4: compile the cross-binutils. % make -j4 Step5: install the cross-binutils. % make -j4 install Step6: append the installation directory to PATH. % sudo vim /etc/environment PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/g ames:$HOME/<your path>/bin" % source /etc/environment If you open another terminal, you need to source again. Test your cross-binutils. % arm-elf-as -version 2013/10/1 / 15

7 GNU Cross-Compiler Compilation (1/2)
Step1: download the source codes. % wget tar.gz Step2: extract the source codes. % tar zxvf gcc tar.gz Step3: set configuration. % cd gcc-3.3.6 % ./configure --target=arm-elf --prefix=$HOME/<the your path previously> --enable-languages=c --with-newlib Step4: compile the cross-compiler. % make -j4 2013/10/1 / 15

8 GNU Cross-Compiler Compilation (2/2)
Step5: install the cross-compiler. % make -j4 install Test your cross-compiler. % arm-elf-gcc -v 2013/10/1 / 15

9 GNU Cross-Newlib Compilation (1/3)
Step1: download the source codes. % wget b tar.gz Step2: extract the source codes. % tar zxvf newlib tar.gz Step3: apply the patch. % cd newlib % wget nfo_version.patch % patch < makeinfo_version.patch 2013/10/1 / 15

10 GNU Cross-Newlib Compilation (2/3)
Step4: set configuration. % ./configure --target=arm-elf --prefix=$HOME/<the your path previously> Step5: compile the cross-newlib. % make -j4 Step6: install the cross-newlib. % make -j4 install Test a assembly code generation. The test source code, test1.c, can be downloaded from our course website. % arm-elf-gcc -S test1.c % vim test1.s 2013/10/1 / 15

11 GNU Cross-Newlib Compilation (3/3)
Test an executable. % arm-elf-gcc test1.c -o test1 % file test1 2013/10/1 / 15

12 Install PXA270 Cross-Compiler (1/2)
However, since previous cross-compiler does not contain related PXA270 headers and configurations, it can not compile executable for PXA270. Actually, it can only be used for U-Boot (bootloader) only. If we want to cross compile a program which can be executed on PXA270, we should install the cross-compiler provided by microtime (新華). Step1: download new cross-compiler. % wget linux-toolchain-bin tar.gz 2013/10/1 / 15

13 Install PXA270 Cross-Compiler (2/2)
Step2: extract the tar.gz file to the home directory. % tar zxvf arm-linux-toolchain-bin tar.gz -C $HOME Step3: append the installation directory (bin) to PATH. Do not forget to source again to load new PATH. Test the new cross-compiler. % arm-unknown-linux-gnu-gcc -v 2013/10/1 / 15

14 Compile a PXA270 Executable
Step1: use the new cross-compiler to compile test1.c. % arm-unknown-linux-gnu-gcc -static test1.c -o test1 Please add –static flag to compile an executable with static library. Step2: transfer the executable to Linux on PXA270. Step3: change the permission of the executable. $ chmod +x test1 Step4: try to execute test1. 2013/10/1 / 15

15 Lab Requirement & Bonus
Show that you can cross compile a program for PXA270. Bonus: Answer the question of lab3 on RSWiki CSL course website. Write it in your report. Please send your report to both TAs. Please use this title format: [CSL] G# Lab# Ver# E.g., [CSL] G13 Lab3 Ver1 2013/10/1 / 15


Download ppt "Computer System Laboratory"

Similar presentations


Ads by Google