Documente Academic
Documente Profesional
Documente Cultură
Equipment Requirement
PC with
Linux
OS installed
Native
Internet
access
Software Requirement
GNU binutils source code (version 2.16.1)
ftp://sources.redhat.com/pub/binutils/releases/binutils2.16.1.tar.gz
http://ftp.gnu.org/gnu/binutils/binutils-2.16.1.tar.gz
ftp://sources.redhat.com/pub/gcc/releases/gcc-3.3.6/gcc3.3.6.tar.gz
ftp://ftp.nctu.edu.tw/computer-languages/C/gcc/releases/gcc3.3.6/gcc-3.3.6.tar.gz
ftp://sources.redhat.com/pub/newlib/newlib-1.14.0.tar.gz
Outline
Introduction
Basic Linux commands
Build cross assembler / linker
Build cross compiler
Build cross C standard library
Testing
Outline
Introduction
Basic Linux commands
Build cross assembler / linker
Build cross compiler
Build cross C standard library
Testing
Introduction
A total solution for embedded system development
Hardware
Software-development tools
GNU Binutils
The GNU binutils are a collection of binary tools
ld - the GNU linker
as - the GNU assembler
Other binary tools
GPL Licensed
Free
Front Ends
CC++Objective C
Ada 95 (GNAT)
Fortran77Fortran95
Pascal
Modula-2Modula-3
Java (supported from gcc 3.0)
Java->Bytecode, Bytecode->native code
Java->Native code
Cobol
Chill (Cygnus, a language in the Modula II family used in
European telecommunications )
10
GCC Execution
gcc
cpp
cc1
g++
gas
(assembler)
Input file
output file
ld
(linker)
12
13
Limited memory
Diskless
No output screen
Poor performance
Cross-compiler
Remote debug
For embedded system, we need cross systemdevelopment tools to help software development
14
Machine Classification
Build machine
The
Host machine
The
Target machine
The
15
Machine Identification
Three items to identify machine
CPU type
Company name
System type
Example
vax-dec-ultrix4.2
i386-redhat-linux
m68k-coff
arm-elf
16
Outline
Introduction
Basic Linux commands
Build cross assembler / linker
Build cross compiler
Build cross C standard library
Testing
17
Description
Change directory
Change the current working directory
to /home
cd ..
cd ~
cp
Copy files
cp file1 file2 Copy the file file1 to the file file2
18
Description
Show the amount of disk space used on
each mounted filesystem
ls
ls
List files
List files in the current working directory
except those starting with . and only show
the file name
List all files in the current working
directory in long listing format showing
permissions, ownership, size, and time
and date stamp
ls -al
19
Description
Sends file contents to standard
output
cat /etc/hosts Sends the contents of the /etc/hosts"
file to the screen
less
20
Description
Allows file contents or piped output
to be sent to the screen one page at
a time
more /etc/hosts Lists the contents of the "/etc/profile"
file to the screen one page at a time
ls al |more
Performs a directory listing of all
files and pipes the output of the
listing through more. If the directory
listing is longer than a page, it will
be listed one page at a time
21
Description
Delete the files
Delete the file file1
mv
Move or rename files
mv file1 file2 Move the file from file1" to file2".
This effectively changes the name of
file1" to file2
mv file1 .
Locates binaries and manual pages
for the ls command
22
Description
Show the name of the current working
directory
whereis
whereis ls
man
man ls
Description
Report process status
TIME CMD
00:00:00 bash
00:00:00 ps
$ ps
PID TTY
13580 pts/11
13626 pts/11
$
TIME CMD
00:00:00 csh
00:00:00 ps
Bash Shell
C shell
24
$ export PATH=/foo/bin:$PATH
Bash Shell
C shell
25
file: myexec
Log file: log.txt
Direct both standard output and standard error
to the file log.txt
Bash Shell
$ myexec
>
$ myexec
>&
log.txt
log.txt
2>&1
C Shell
26
Outline
Introduction
Basic Linux commands
Build cross assembler / linker
Build cross compiler
Build cross C standard library
Testing
27
Build Cross-Binutils
download source code of GNU binutils
uncompress source code
configure binutils
make install
28
Outline
Introduction
Basic Linux commands
Build cross assembler / linker
Build cross compiler
Build cross C standard library
Testing
29
make
make install
31
Outline
Introduction
Basic Linux commands
Build cross assembler / linker
Build cross compiler
Build cross C standard library
Testing
32
Build Cross-Newlib
Add the directory of binutilsgcc executable to PATH
download source code of GNU newlib
uncompress source code
configure newlib
make
make install
33
Directory Structure
/foo
bin
include
lib
gcc-lib
arm-elf
bin
man
include
info
lib
share
34
Outline
Introduction
Basic Linux commands
Build cross assembler / linker
Build cross compiler
Build cross C standard library
Testing
35
Testing
/foo/bin/arm-elf-gcc -S test1.c
/* test1.c */
#include <stdio.h>
int main(void)
{
printf(Hello World\n);
return 0;
}
.LC0:
main:
.L3:
.L2:
.file
"test1.c"
.section
.rodata
.align 2
.ascii
.text
.align
.global
.type
"Hello World\n\000"
2
main
main, %function
.word
.size
.ident
.LC0
main, .-main
"GCC: (GNU) 3.3.6"
36
Reference
Linux/UNIX commands
http://www.computerhope.com/unix.htm#04
GNU binutils
http://sources.redhat.com/binutils
GCC
http://gcc.gnu.org
GNU newlib
http://sources.redhat.com/newlib
37