I am learning a bootloader code, can some please tell me why mmu initialization must be implemented in assambly instead of c?
- posted
15 years ago
I am learning a bootloader code, can some please tell me why mmu initialization must be implemented in assambly instead of c?
The initialization may require special opcodes, or access special registers which can't be done in standard C. Or perhaps you want to be sure that the stack isn't used, which can be hard to guarantee in C.
C runtime startup often inits the stack pointer first, then clears rw memory, all of which may be inaccessable until the mmu is setup...
Chris
In article , " snipped-for-privacy@gmail.com" writes
In a self hosted system Or where you are running the code from a hardware reset NOTHING is set up. No registers, memory spaces, interrupts, watchdogs or stack.
Before you get to the start of the C code* which requires a stack (most of the time) and to know where it's memory spaces are for initialised and uninitialised variables globals etc. you have to set it up. You can't do thins in C (see recursion :-)
BTW in a self hosted system the fist C function, called "main" in hosted systems does not have to be called "main" in self hosted systems but usually is by tradition
-- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
Thank you :-)
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.