Share via


Startup (OAL) (Compact 2013)

3/26/2014

Some of the startup tasks performed by the OAL include initializing the CPU, jumping to the entry point of kernel.dll, and then initializing other components of the system at the kernel’s request. The OAL startup code is located in %_WINCEROOT%\Platform\<BSP Name>\Src\OAL\Oallib. It is typically linked into a static OAL library called oal.lib.

The following table lists the main OAL startup functions. You must customize these functions to your hardware platform. In addition to these functions, initialization functions such as OALCacheGlobalsInit, OALTimerInit, OALIntrInit, and OEMKitlStartup are listed in the tables in the following sections: Cache (OAL), Timer (OAL), Interrupts (OAL) and KITL Code Overview.

Purpose

Function name

Executes from power-on reset (POR) and prepares the CPU/SOC to run C code. Usually, this function enables core logic, memory controller, clocks, and PLLs.

StartUp

Initializes board-level hardware and interfaces, such as busses.

OEMInit

The following figure shows an example of the system startup sequence beginning where the boot loader left off. The OAL starts the kernel, and then the kernel calls OAL functions to initialize various components.

OAL/kernel startup sequence

The following steps describe the OAL and kernel startup sequence shown in the figure:

  1. At the end of the boot process, the boot loader jumps to the OAL’s StartUp function, which is the entry point of the OS image. (For information about what actions led to this point, see Boot Loader Overview.) The StartUp function is responsible for operations such as switching into supervisor/privileged mode, initializing system-level clocks and phase-locked loop (PLL), initializing and flushing the caches, enabling the SDRAM controller and memory interfaces, and calling KernelStart, which is a CPU architecture-specific function implemented by the kernel.
  2. The KernelStart function performs minimal initialization, turns on the memory management unit (MMU) to set up the virtual address space used by the OS, initializes the kernel global variables, and then jumps to the entry point of kernel.dll. The entry point of kernel.dll is a CPU architecture-specific kernel function that performs the rest of the initialization. The KernelStart function never returns.
  3. In the kernel initialization function, the kernel exchanges global pointers with the OAL. From this point on, the kernel has access to all functions and variables that are defined by the OAL in the OEMGLOBAL structure, and the OAL has access to all functions and variables that are defined by the kernel in the NKGLOBAL structure. The kernel initialization function also performs additional CPU setup, such as setting up interrupt vectors and enabling the cache.
  4. The kernel initialization function then calls the OEMInitDebugSerial function to initialize the debug serial port on the device, which can send serial debug messages before the KITL connection and kernel debugger are enabled. The serial port initialization process is similar to the one performed by the boot loader.
  5. The kernel initialization function then calls the OEMInit function, at which time optional functions in the OEMGLOBAL structure are initialized or overridden if applicable. The OEMInit function also performs any other hardware-specific initialization, such as initializing additional global variables, initializing a watchdog timer, and initializing coprocessors. To do this initializing, the OEMInit function calls the following BSP functions:
    1. The OEMInit function calls the OALCacheGlobalsInit function to initialize the global variables that hold the cache parameters.
    2. The OEMInit function initializes the interrupt hardware by calling the OALIntrInit function, which in turn calls the OALIntrMapInit function to initialize the mappings between interrupt requests (IRQs) and SYSINTR logical interrupts.
    3. The OEMInit function calls the OALTimerInit function, which initializes the timer state structure.
    4. The OEMInit function calls a routine to initialize hardware bus-level logic to gain access to a KITL device or other boot-critical bus architectures. For example, if the board contains a PCI bus, OEMInit calls the OALPCIInit function to initialize it.
    5. The OEMInit function calls the kernel’s KITLIoctl function by using the IOCTL_KITL_STARTUP IOCTL. The KITLIoctl function then calls the OEMKitlStartup function. For information about the continuation of the KITL startup procedure, see KITL Code Overview.
  6. After the OEMInit function returns, the kernel initialization function calls the KernelInit function, which completes the kernel initialization by setting up the heap, initializing threads, and so on. The KernelInit function then schedules the first thread, and the OS startup sequence is complete.

See Also

Concepts

OAL Code Overview