[Fwd: Modes, stack setup for "no-OS" ARM app]
Nick Clifton
nickc@redhat.com
Tue Apr 20 14:04:00 GMT 2004
Hi Toralf,
> Another question is how choose the stack size for each mode. For
> maximum flexibility, I guess I should allow the user to control each
> of the stacks via symbols defined in the linker script or similar, but
> that way the start code perhaps get a bit too dependent on external
> symbols.
The size and location of the stacks is going to be highly dependent upon
the memory layout anyway, and since this layout is going to affect the
linker script used you cannot really avoid this inter-dependence. As a
general rule of thumb you should be able to have very small stacks for
the interrupt handlers and a small stack for the supervisor mode. The
user stack is normally arranged to grow into free memory from the
opposite end of the allocation heap, but you knew that already :-)
> I'm actually trying to write a crt0.S that is sufficiently general to
> be included in the newlib sources, so I don't want to make assumptions
> about the memory layout, or even require the code to be loaded in
> writeable memory. (And if I can assume at least ARMv4, I proably won't
> have to.)
Have you seen the libgloss sources ? These are part of the newlib
module in the sourceware CVS repository and they represent another
attempt at organising and standardising the creating of startup files.
There is even an ARM sub-directory present with a crt0 source file
suitable for use with RedBoot.
Cheers
Nick
More information about the Newlib
mailing list