gnu_arm_tools (1)

4
Development Tools The process of converting the source code representation of your embedded software into an executable binary image involves three distinct steps. First, each of the source files must be compiled or assembled into an object file. Second, all of the object files that result from the first step must be linked together to produce a single object file, called the relocatable program. Finally, physical memory addresses must be assigned to the relative offsets within the relocatable program in a process called relocation. The result of this third step is a file that contains an executable binary image that is ready to be run on the embedded system. Compiler and Assembler: Compiler’s job is mainly to translate programs written in some human- readable language into an equivalent set of opcodes for a particular processor. In that sense, an assembler is also a compiler (you might call it an "assembly language compiler") but one that performs a much simpler one- to-one translation from one line of human-readable mnemonics to the equivalent opcode. Linker & Locator: Linker combines all the object files created by the compiler in such a way that it resolves all of the unresolved symbols. This is done merging the text, data and bss sections of input files. The tool that performs the conversion from relocatable program to executable binary image is called locator. In most of the cases locater is inbuilt in linker. The memory information required by the GNU linker can be passed to it in the form of a linker script Linker Script:

Upload: crsarin

Post on 18-Nov-2015

214 views

Category:

Documents


1 download

DESCRIPTION

jkjkjjjk

TRANSCRIPT

Development Tools

The process of converting the source code representation of your embedded software into an executable binary image involves three distinct steps. First, each of the source files must be compiled or assembled into an object file.

Second, all of the object files that result from the first step must be linked together to produce a single object file, called the relocatable program. Finally, physical memory addresses must be assigned to the relative offsets within the relocatable program in a process called relocation. The result of this third step is a file that contains an executable binary image that is ready to be run on the embedded system.Compiler and Assembler:Compilers job is mainly to translate programs written in some human-readable language into an equivalent set of opcodes for a particular processor. In that sense, an assembler is also a compiler (you might call it an "assembly language compiler") but one that performs a much simpler one-to-one translation from one line of human-readable mnemonics to the equivalent opcode.

Linker & Locator:Linker combines all the object files created by the compiler in such a way that it resolves all of the unresolved symbols. This is done merging the text, data and bss sections of input files. The tool that performs the conversion from relocatable program to executable binary image is called locator. In most of the cases locater is inbuilt in linker.The memory information required by the GNU linker can be passed to it in the form of a linker script

Linker Script:

GNU Tools:

gnu-arm-gcc,

gnu-arm-as

gnu-arm-ld

CygwinCygwin is a Linux-like environment for Windows. It consists of two parts:

A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality.

A collection of tools which provide Linux look and feel.Installing Cygwin:

1. Installing from internet

2. Installing from a local directory.

PDF have detailed steps.

Makefilemake is a utility for automatically building executable programs and libraries from source code. makefiles specify how to derive the target program from each of its dependencies.make

GNU make utility to maintain groups of programs.

make is used to:

save time by not recompiling files that haven't changed,

make sure all files that have changed do get recompiled.

A typical makefile (Makefile so that it appears near the top of the directory listing) contains:

Variable definitions: $(foo) or ${foo} is a valid reference to the variable foo.

Dependecy rules:

target: dependencies ...

commands

...

Comments (line beginning with #).

GCC=gcc

OBJ=file1.o file2.o file3.o

all:$(OBJ)

$(GCC) $(OBJ) -o my_program

file1.o:file1.c

file2.o:file2.c

file3.o:file3.c

clean:

/bin/rm -f $(OBJ) my_program

Startup File

Startup code is a small block of assembly language code that prepares the way for the execution of software written in a high-level language. Each high-level language has its own set of expectations about the runtime environment. For example, C and C++ both utilize an implicit stack. Space for the stack has to be allocated and initialized before software written in either language can be properly executed. That is just one of the responsibilities assigned to startup code for C/C++ programs. Most cross-compilers for embedded systems include an assembly language file called startup.asm, startup.s , crt0.s (short for C runtime), or something similar.

Startup code for C/C++ programs usually consists of the following actions, performed in the order

described:

1. Disable all interrupts.

2. Copy any initialized data from ROM to RAM.

3. Zero the uninitialized data area.

4. Allocate space for and initialize the stack.

5. Initialize the processor's stack pointer.

6. Create and initialize the heap.

7. Execute the constructors and initializers for all global variables (C++ only).

8. Enable interrupts.

9. Call mainMEMORY

{

ram : ORIGIN = 0x00000, LENGTH = 512K

rom : ORIGIN = 0x80000, LENGTH = 512K

}

SECTIONS

{

data ram : /* Initialized data. */

{

_DataStart = . ;

*(.data)

_DataEnd = . ;

} >rom

bss : /* Uninitialized data. */

{

_BssStart = . ;

*(.bss)

_BssEnd = . ;

}

_BottomOfHeap = . ; /* The heap starts here. */

_TopOfStack = 0x80000; /* The stack ends here. */

text rom : /* The actual instructions. */

{

*(.text)

}

}