This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Fwd: Modes, stack setup for "no-OS" ARM app]


Nick Clifton wrote:

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.

Yes, that's a good point...


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 :-)

But of course...



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.

Yeah, I know.


There is none that assumes a plain system, though - i.e. one that doesn't even have anything like RedBoot - which is what I want. Or *maybe* I should port RedBoot after all (I decided not to earlier on), but that's a different discussion entirely. newlib/libc/sys/arm/crt0.S is mostly fine, though, except for the stack issues discussed here ;-)

I also looked for startup files that would set up for multiple modes on other platforms, but didn't find anything good.


Cheers Nick




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]