Specifications
8
A Minimal PowerPCª Boot Sequence for
Executing Compiled C Program
s
Sample Boot Sequence
Much of the required EABI register setup is accomplished through a call to __eabi(). The user does not call
this function directly. Instead, the compiler inserts the call to __eabi() at the beginning of main() in the user
program. Most compile environments provide an __eabi() function that is automatically linked with user
programs. Unfortunately, this standard __eabi() is often designed to work with a particular operating system
or environment.. Because the processor is using the source in this application note, a minimal __eabi()
function is supplied to handle these speciÞc requirements.
The remainder of the registers are listed for completeness and are not modiÞed by the minimal boot code.
They may be modiÞed by the user program.
Part IV Sample Boot Sequence
The sample boot sequence in this section completes minimal processor setup and executes a user program.
It performs only processor setup (no peripheral devices), and leaves external interrupts disabled. It is
designed for use with test cards, evaluation boards, or processor simulators where the developer can directly
view the contents of memory to verify correct program execution. This code sequence is designed to take
the place of the traditional crt0 module, as well as to provide hardware initialization normally performed by
the operating system.
The basic operation of the boot sequence is as follows:
1. Invalidate the BAT entries.
2. If the processor has an L2, program L2CR and perform a global L2 invalidate.
3. Set up the BAT registers to provide address translation and protection.
4. Invalidate all TLB entries.
5. Turn on address translation.
6. Relocate the text, data, and bss sections from ROM to RAM.
7. Enable the L1 and L2 caches, if present.
8. Place the user code main entry address in SRR0.
9. Put the MSR value for the user program into SRR1.
10. Save the return address in the link register.
11. Initialize the time base register to 0.
12. Set up a stack pointer in GPR1 for the user program.
13. Execute
rÞ. This executes the user program by jumping to the address stored in SRR0. Before
running the user code, a compiler-inserted call to __eabi() sets up EABI registers GPR2 and GPR13.
14. Save the time base register values into memory (useful for timing benchmarks).
15. Branch to invalid op vector at 0xFFF0_0700 to indicate completion.
This procedure may be modiÞed or conÞgured to match the desired conÞguration.