Modes, stack setup for "no-OS" ARM app
Toralf Lund
toralf@procaptura.com
Fri Apr 16 09:28:00 GMT 2004
I've been wondering about how I should handle processor modes and set up
stack pointers etc. for my newlib-based ARM application running on a
"bare" system (no OS, no debug monitor.) Unlike the default crt0, mine
will definitely have to set up stack pointers for more than one mode,
since I use interrupts actively. Also, I'm not quite sure what mode the
application itself ought to run under. I need to access "privileged"
registers etc. during the init phase at least, so some bits have to run
in Supervisor or System, but do I want to do *everything* in one of
those modes?
Some issues related to this (in no particular order):
1. Once User mode is entered, there is no easy way back, as far as I
know, so I can't simply switch to that mode e.g. to set up the
stack, if I want SVC or System later.
2. System is ARM version 4 and above, so perhaps I shouldn't use that
in my crt0, which I intend to be very general.
3. As far as I can tell, there is no way to access the user mode
stack pointer e.g. from supervisor mode, at least when using gas.
Any thoughts?
- Toralf
More information about the Newlib
mailing list