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
Lab1 Cross Compiler, Assembler & Linker

2 Experimental Goal Build an development environment for embedded system
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 Lab1 2019/4/11

3 Environment Host System Build System Software
Windows XP Build System Ubuntu 8.04 Software GNU Binutils source code GNU Compiler Collection source code Red Hat Newlib source code makeinfo_version.patch Ubuntu 8.04 PC desktop CD & Test code You can download all the source codes from RSWiki CSL Course Software Lab1 2019/4/11

4 Create Build System Install VirtualBox Install Guest Additions
At least 20 GB disk space Install Guest Additions Click Devices  Install Guest Additions % sudo /media/cdrom/VBoxLinuxAdditions.run Create Shared Folders Click Devices  Shared Folders Select Folder Path & Name, mark it to be auto-mounted % mkdir /mnt/<your path> % sudo mount.vboxsf Folder Name /mnt/<your path> Lab1 2019/4/11

5 GNU Cross-Binutils Compilation
Prerequisite % sudo apt-get install libc6-dev texinfo vim patch Step1 : download source code % ftp sources.redhat.com (Name:ftp Password:-) ftp> cd pub/binutils/releases ftp> bi ftp> get binutils tar.gz Step2 : extract source code % tar –zxvf binutils tar.gz Step3 : set compilation options % cd binutils % ./configure --target=arm-elf \ --prefix=$HOME/<your path> Step4 : compile cross-binutils % make –j4 Lab1 2019/4/11

6 GNU Cross-Binutils Compilation (Cont.)
Step5 : install cross-binutils % make –j4 install Step6 : append installation directory to PATH % sudo vim /etc/environment % source /etc/environment Test % arm-elf-as –version Tip If you open another terminal, you need to source again PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$HOME/<your path>/bin" Lab1 2019/4/11

7 GNU Cross-Compiler Compilation
Step1 : download source code % ftp sources.redhat.com ftp> cd pub/gcc/releases/gcc-3.3.6 ftp> bi ftp> get gcc tar.gz Step2 : extract source code % tar –zxvf gcc tar.gz Step3 : set compilation options % cd gcc-3.3.6 % ./configure --target=arm-elf \ --prefix=$HOME/<the your path previously> \ --enable-languages=c --with-newlib Step4 : compile cross-compiler % make –j4 Lab1 2019/4/11

8 GNU Cross-Compiler Compilation (Cont.)
Step5 : install cross-compiler % make –j4 install Test % arm-elf-gcc -v Lab1 2019/4/11

9 GNU Cross-Newlib Compilation
Step1 : download source code % ftp sources.redhat.com ftp> cd pub/newlib ftp> bi ftp> get newlib tar.gz Step2 : extract source code % tar –zxvf newlib tar.gz Step3 : apply the patch % cd newlib % patch < makeinfo_version.patch Step4 : set compilation options % ./configure --target=arm-elf \ --prefix=$HOME/<the your path previously> Step5 : compile cross-newlib % make –j4 Lab1 2019/4/11

10 GNU Cross-Newlib Compilation (Cont.)
Step6 : install cross-newlib % make –j4 install Test Check assembly code generation % arm-elf-gcc –S test1.c % vim test1.s Check executable % arm-elf-gcc test1.c –o test1 % file test1 This executable can run on ARM target board Lab1 2019/4/11


Download ppt "Computer System Laboratory"

Similar presentations


Ads by Google