BAMBI Binutils
The gnu binutils package provides an assembler, a linker, and some assorted
binary utilities. The programs that we are using are:
ece554-unknown-elf-as - assembler
ece554-unknown-elf-ld - linker
ece554-unknown-elf-nm - prints symbol table of object file
ece554-unknown-elf-objdump - disassembler, also dumps other object-file info
To port binutils to the Bambi architecture the
following files were added to the standard binutils-2.9.1 directory:
-
bfd/cpu-ece554.c
-
This file simply contains a small structure that describes the Bambi
architecture a little.
- bfd/elf32-ece554.c
-
This file contains all of the code necessary to link several object
files, it is used mainly by 'ld'
- gas/config/tc-ece554.c
-
This is the assembler proper, it parses incoming opcodes and builds
instructions from them.
- gas/config/tc-ece554.h
-
I'm not sure if this is used..
- include/elf/ece554.h
-
probably not used, or if it is, not needed
- include/opcode/ece554.h
-
contains several structures used by the assembler to describe
available instructions.
- ld/emulparame/elf32_ece554.sh
-
Linker script template parameters, a few variables that are used when
building the link scripts
- ld/scripttempl/elf_ece554.sc
-
Linker script template, this is a shell script that outputs different
linker scripts. Linker scripts tell the linker how to link
several object files together into an executable.
- opcodes/ece554-dis.c
-
The disassembler proper, takes binary instructions and looks up their
names and parameters and prints them out nicely.
- opcodes/ece554-opc.c
-
File that contains a structure with all of the possible
instruction names, opcodes and parameters.
Assembly
Here's an example of some assembly, this is taken from start.s. It is the first
piece of code executed when the machine boots up.
.global _start
_start:
## disable all interrupts
mtspr mr4, r0
## load _SDA_BASE_ to r13
ori r13, r0, _SDA_BASE_@l
lui r13, r13, _SDA_BASE_@h
## setup system stack
ori r1, r0, _stack_@l
lui r1, r1, _stack_@h
## jump to OS
b _thumperos
Linking
The linker takes a list of .o files, which have been created by the assembler.
Because the Assembler does not know where the code it is assembling will end
up in the final output, it has to leave unknown fields blank, to be filled in
when the final position is known. That final position is known at link time.
The linker does a few main things:
- group sections of the same type from different object files.
- determine the final positions of all code.
- "fixup" all of the fields which were unknown at assembly time.
- output a final "executable" which contains a fully executable program.
The linker outputs code and data into a process image which are loaded directly into memory. For a layout of a process in memory, please see the ThumperOS section.
configuration
mkdir build.binutils
cd build.binutils
../binutils-2.9.1/configure --target=ece554-unknown-elf --prefix=/usr/home/tesch/ece554
Last modified: Sun Mar 11 00:56:44 CST 2001