[Home] [Info collection]
Few notes on my target, before we start. This is very simple 16bit more-or-less risc like special-purpose processor. It is not intended to be used as CPU, but rather as coprocessor for use in compression/decompression applications. Thus my target doesn't need anything fancy, such as dynamic linking. I was at first thinking of coming up with my own format, that would handle some requirements specific to this arch, such as overlays, but then thought tha it will take a while before I actually need it. If I ever get to doing that, I'll modify this guide accordingly. For now, I chose aout format, as it seemes to be simplest one to write.
To do this port I found an inital patch set for some other port ( PDP11 actually) and followed it. You can get mine if you want to look at it from here.
To add new arch to BFD, you will need to modify following files:
cpu-<arch>.lo: cpu-<arch<.c $(INCDIR)/filenames.h
<format>-<arch>.lo: aout-<arch>.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \ aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h
<my_arch>_vec) tb="$tb aout-bsp.lo" ;;
<arch>-*-*) targ_defvec=<my_arch>_vec ;;
_bfd_target_vector[]
Make sure you don't stick it in #ifdef BFD64 section somewhere
if it's not 64bit-only target.
extern const bfd_arch_info_type bfd_<arch>_arch;
. bfd_arch_<arch>, {* Describtion of your arch *}Note the dot in the beginning of line. Also note those curly braces ({}) - they are used instead of forward slash (/) for comments.
const bfd_arch_info_type bfd_<arch>arch =
{
16, /* 16 bits in a word */
8, /* 8 bits in an address */
8, /* 8 bits in a byte */
your_arch_enum_name, /* from enum in archures.c, remember? */
0, /* only 1 machine */
"your_arch_name",
"printable name",
1, /* aligment = 16 bit */
true, /* the one and only */
bfd_default_compatible,
bfd_default_scan,
0,
};
Look at cpu-mmix.c for reference.
#include "aoutx.h"
and #include "aout-target.h"
make headers
to rgenerate is, after you are done
with all other files. It is important to stress: run "make headers"
in your $BUILD_DIR/bfd directory right after you run configure for the
first time