Re: Targetting an embedded ARM chip?
On Sun 15 Sep, Michael D. Crawford wrote:
> Thanks for your help.
> I'm afraid it's not linux, it's a custom embedded application that's
> hardwired to drive an I/O chip.
> Address 0 in the flash rom starts with a little assembly code to set up
> the stack and enable interrupts, and then it jumps into a loop where
> each time through it services some I/O requests.
> It's nothing like Linux, a Linux kernel wouldn't even fit in the available
> amount of flash!
> So maybe I would need to port gcc to the executable format, but I'd be
> surprised if someone hadn't already done that.
> Basically the contents of the flash is a bunch of raw machine code.
> Often, though, the images that an upload utility writes contain some
> extra information like where in the flash to upload it to.
OK - in that case look at the way ARM bootloaders compiled with GCC do
things. The one I am most familiar with is BLOB:
Either here: http://www.lart.tudelft.nl/lartware/blob/
or here: http://sourceforge.net/projects/blob/
This is slightly more complicated than most as it links with a bit of
machine code at 0 and then the main code at 0x400 so is can run, copy
itself to ram and then run itself again (so it can easily upgrade itself).
You may not need this but it shows how to use the linker scripts to get
parts loaded at the address you want, how to mix assembler and C and how to
strip the elf executables down to raw machine code so it will run unaided -
which is the bit you are really interested in.
Obviously other arm bootloaders do simiar things and will also serve as
examples. (bootldr, redboot, shoehorn (that one is arm7-specific so should
be of interest). I wrote a comparison of arm bootloaders which lists most
of them: http://www.aleph1.co.uk/armlinux/docs/ARMbooting/x115.html
Aleph One Ltd, Bottisham, CAMBRIDGE, CB5 9BA, UK Tel +44 (0) 1223 811679
work: http://www.aleph1.co.uk/ play: http://www.chaos.org.uk/~wookey/