Specifications

A Minimal PowerPCª Boot Sequence for
17
Executing Compiled C Programs
Sample Boot Sequence
4.6 Using the Sample Boot Sequence
Using the sample boot sequence requires setting up the conÞgurable parameters to describe a particular
hardware conÞguration. The process is described as follows:
In ppcinit.h:
1. #deÞne either MPC603e, MPC750, or MPC7400 to match the processor type. One of these must be
deÞned for the code to work properly.
2. To use the instruction cache, #deÞne ICACHE_ON to 1. To disable the instruction cache, deÞne it
to 0.
3. To use the data cache, #deÞne DCACHE_ON to 1. To disable the data cache, deÞne it to 0.
4. To use the L2 cache (MPC750/7400 only), #deÞne L2CACHE_ENABLE to 1. DeÞne L2_INIT and
L2_ENABLE to set the appropriate L2CR values for setting up the cache and enabling it.
5. For the MPC7400, #deÞne VMX_AVAIL to 1 to enable the AltiVec unit. To disable it, or for
processors with no AltiVec, set it to 0.
6. #deÞne STACK_LOC to the desired location of the stack for the user program.
7. To use the MMU, #deÞne MMU_ON to 1.
8. If MMU_ON is deÞned, the BAT setup macros must be deÞned in order to provide basic address
translation and protection. Fill in all sixteen [ID]BATx[UL]_VAL macros with the values for the
associated BAT array entry. Typically, #deÞne a base physical address (like (PROM_BASE and
PRAM_BASE in the sample Þle) and a base virtual address (like VROM_BASE and VRAM_BASE
in the sample Þle) for each memory region. Use these addresses, along with the provided BAT
macros, to form an entry. As an example, to deÞne a data region representing a ROM starting at the
physical address 0xFFF0_0000 that is cache inhibited and has read/write access, #deÞne
PROM_BASE to 0xFFF0_0000. Then #deÞne DBAT0L_VAL to be PROM_BASE |
BAT_CACHE_INHIBITED | BAT_READ_WRITE. Refer to the ppcinit.h source Þle for a list of
available macros.
9. Repeat step 8 until instruction and data BAT entries have been created for all memory regions to be
used by the user program.
10. Fill in entries for the remaining unused BATs with BAT_NO_ACCESS for theappropriate lower
BAT register, and BAT_INVALID for the appropriate upper BAT register.
11. #deÞne USER_ENTRY to the name of the entry function for the user program. The entry function
should typically be called main() so that the EABI initialization code is called. If the entry function
is not called main(), then a call to __eabi() must be inserted at the beginning of the entry function
before any other executable statements.
In MakeÞle:
1. To locate the loadable text section at an address other than 0xFFF0_0000, deÞne
IMAGE_TEXT_START to the desired value.
2. To deÞne the execution address of the text section, change the deÞnition for TEXT_START to
match the desired address. This defaults to 0x0000_0000.
3. By default, the data section is located immediately following the text section in both the load image
and during execution. To change this, deÞne DATA_START and IMAGE_DATA_START to the
appropriate values.
4. List the C source Þles for the user program in the deÞnition for C_SRC.
The code may now be built and executed for the target platform.