This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: [Fwd: Modes, stack setup for "no-OS" ARM app]
- From: Nick Clifton <nickc at redhat dot com>
- To: Toralf Lund <toralf at procaptura dot com>
- Cc: newlib at sources dot redhat dot com
- Date: Tue, 20 Apr 2004 14:54:45 +0100
- Subject: Re: [Fwd: Modes, stack setup for "no-OS" ARM app]
- References: <408425C0.9060007@redhat.com> <40850C82.1080506@redhat.com> <40851A5B.5030205@procaptura.com>
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