[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Targetting an embedded ARM chip?

Hi. I have had some experience building cross-gcc compilers, and the
gist of it is using the autotools "configure" program. Now, before
you go any further, I need to confirm that you app is running arm-linux
right? (Not CE). If so, then you will be booting an arm linux kernel
and will be using the ELF binary file format. If you are trying to build
for WinCE then we can't help you here.

The key to making it all work, then, is your cross-compiling binutils
which will give you a cross-linker. This is always the first step in
making a cross-gcc setup. I won't tell you its easy, because it just
isn't, there are a lot of things that can go wrong and you need to
have compatible sources for a lot of different packages.

Here is a guide by Jeff Bailey for building an X86->Hurd cross compiler.
The steps for arm will be similar except your target will be something
like "arm4vl-unknown-linux-gnu" and you won't need MIG, gnumach, or Hurd.


The secret to success is the configure command line. Typically you
will use something like:

$ ./configure --host=i386-pc-linux-gnu --target=arm4vl-unknown-linux-gnu

When you "$make install" the cross compiler files will be put into
/usr/lib/gcc-lib/arm4vl-linux and gcc will know to look there for
headers, binaries, libs, etc.

You mention flash format, I hope you aren't writing a bootloader or
something because for that I have no idea what format to recommend,
and you might have to write the first hunk of it in raw machine
language. That is out of my area of expertise, although Ralph might
be able to give you some tips.

Michael D. Crawford wrote:
I'm thinking of maybe using gcc to compile the code for this embedded ARM device I'm working with.

I expect to be getting a netwinder soon from one of the list members here, and so wouldn't even have to cross-compile. But what I would need to do is make an executable that's in the format for uploading to a flash rom.

I have a windows-based development system the vendor supplied me with, it includes a flash upload utility. I'm not sure what it wants for its format, maybe just a file of raw code, but I'm sure the vendor would tell me if I asked (it might already be in the doc I have).

I know some people use gcc set up as a cross-compiler for various kinds of embedded work. My question is how to link the code into the right executable format. Does anyone here know where I can find information about that?

I know the GNU ld can be customized with some manner of script, so maybe I can do it with the standard ld. Or maybe there is a special GNU linker for embedded work.

There is a small quantity of assembly code involved but it's short enough that it wouldn't be hard to hand-translate it into gas' idea of assembly syntax.

Thanks for any tips you can give me,


Reply to: