User`s guide
3 Porting a BSP to Custom Hardware
3.2 Getting a Minimal Kernel Running
57
3
in romInit( ). The selection of processor registers that must be set early in
development depends on the processor family and your specific processor.
In addition to the minimum set of required processor registers, some board
registers must be initialized. The selection of board control registers that must be
set at this point is determined by the board design.
In most cases, the processor-specific requirements are to:
■
Mask processor interrupts.
■
Set the initial stack pointer to STACK_ADRS (defined in configAll.h).
■
Disable processor caches.
3.2.2 Initializing Memory
Typically, the requirements for DRAM initialization include:
■
wait states
■
refresh rate
■
chip-selects
■
disabling secondary (L2) caches (if needed)
The code in romInit.s must initialize the processor and board control registers
(BCRs), as well as the memory controller. Processor initialization on your board
should be identical to the processor initialization in the reference BSP. You must
modify the BCR initialization code provided by the reference BSP.
If your board does not use the same memory controller as the reference BSP, you
may also need to write the memory controller initialization code. This code is often
available from the memory controller vendor as assembly source code and can
often be used without modification.
It is possible to use an OCD device to verify the values of the memory controller
registers. Using the debugger, set the appropriate registers to the desired values
and verify that RAM is readable and writable. Then use the working values to
create the memory initialization routine sysMemInit( ). For more information on
OCD devices, see On-Chip Debugging (OCD) Devices, p.45.
3.2.3 Using Debug Routines in the Initialization Code
It is usually helpful to validate the development environment by writing code to
turn the board LEDs on and off. This allows you to include debug code that can
provide information about the state of the board initialization.