Adapt a BSP (Compact 2013)

3/26/2014

This topic describes some of the functions and configuration files that you may need to edit as you adapt a cloned BSP to your device. The amount of BSP code that you must modify depends on how well your hardware platform matches the device of the BSP that you cloned. You can often reuse the existing code that is common to your device’s CPU or SOC.

Important

This topic lists only the most commonly-changed functions. You may have to modify additional functions or configuration files depending on your particular implementation and hardware requirements. For a detailed description of each function and configuration file, see Board Support Package (BSP).

As you configure the boot loader, adapt the OAL, and bring up device drivers, you should test each component before your move on to the next one. For more information about selecting and running the appropriate tests, see Compact Test Kit Overview.

Adapt the Boot Loader

The following table describes the boot loader functions and configuration files that you may need to modify to adapt a cloned BSP to your device.

To configure the boot loader startup process

To perform hardware-specific initialization, you may need to edit the following functions:

  • The StartUp for the boot loader, not the StartUp for the OAL.
  • OEMPlatformInit.
  • OEMLaunch.

To define the memory layout on the device

To specify where the boot loader resides in the device’s memory, or to specify a shared memory area for the boot loader arguments that pass information to the OS, you may need to modify the boot.bib configuration file.

To support serial debug message output

To initialize the debug device, you may need to modify OEMDebugInit and OEMInitDebugSerial.

To output debug messages, you may need to modify OEMWriteDebugString and OEMWriteDebugByte.

To accept input to the boot loader, you may need to modify OEMReadDebugByte.

To configure an Ethernet download transport

To initialize the download transport, you may need to modify OEMPreDownload.

To read data from the download transport, you may need to modify OEMReadData.

To send and receive data over an Ethernet connection, you may need to modify OEMEthGetFrame and OEMEthSendFrame.

To support flash memory operations

To support flash address functions, you may need to modify OEMIsFlashAddr and OEMMapMemAddr.

To support erasing of flash memory, you may need to edit the following functions:

  • OEMStartEraseFlash.
  • OEMContinueEraseFlash.
  • OEMFinishEraseFlash.

To support writing to flash memory, you may need to modify OEMWriteFlash.

Adapt the OAL

The table below describes the OAL functions and configuration files that you may need to modify to adapt a cloned BSP to your device.

To configure the OAL startup

To further initialize the hardware and call the kernel initialization function, you may need to modify:

  • The Startup for the OAL, not the StartUp for the boot loader.
  • OEMInit.

To define the memory layout for the run-time image

To configure the memory layout, you may need to modify the config.bib configuration file.

To define the physical-to-virtual address mappings, which apply to ARM and x86-based architectures only, you may need to modify the following functions:

  • OEMAddressTable.
  • OEMDeviceTable, only for ARM and x86-based architectures using more than 512 MB of RAM.
  • OEMRAMTable, only for ARM and x86-based architectures using more than 512 MB of RAM.

To configure the real-time clock (RTC)

To set the time, you may need to modify OEMSetRealTime and OEMSetAlarmTime.

To get the time, you may need to modify OEMGetRealTime.

To handle the cache

To initialize the cache, you may need to modify OALCacheGlobalsInit.

To get cache information, you may need to modify OALIoCtlHalGetCacheInfo.

To clean the cache, you may need to modify:

  • OEMCacheRangeFlush.
  • OALCleanDCache.
  • OALCleanDCacheLines.

To clear the translation lookaside buffers (TLBs), you may need to modify OALClearDTLB and OALClearITLB.

To flush the cache, you may need to modify:

  • OALFlushDCache.
  • OALFlushDCacheLines.
  • OALFlushICache.
  • OALFlushICacheLines.

To configure the timer

To initialize the timer, you may need to modify OALTimerInit and OALTimerInitCount.

To handle timer interrupts, you may need to modify OALTimerIntrHandler.

To get and set the timer, you may need to modify:

  • OALTimerGetCount.
  • OALTimerGetCompare.
  • OALGetTickCount.
  • OALTimerSetCompare.
  • OALTimerUpdate.
  • OALTimerRecharge.

To configure power management

To place the CPU in an Idle state, you may need to modify:

  • OEMIdle or OEMIdleEx (preferred)
  • OALCPUIdle.

To power down or place the CPU in a Suspend state, you may need to modify OEMPowerOff.

To enable an interrupt to wake the system, you may need to modify OALIoCtlHalEnableWake.

To disable an interrupt from waking the system, you may need to modify OALIoCtlHalDisableWake.

To handle interrupts

To enable interrupts, you may need to modify OALIntrEnableIrqs and BSPIntrEnableIrq.

To disable interrupts, you may need to modify OALIntrDisableIrqs and OALIntrDisableIrq.

To initialize interrupts, you may need to modify:

  • OALIntrInit.
  • BSPIntrInit.
  • OALIntrMapInit.

To handle interrupt requests, you may need to modify OALIntrRequestIrqs and BSPIntrRequestIrqs.

To release interrupts, you may need to modify OALIntrReleaseSysIntr.

To handle interrupt translation and mapping, you may need to modify OALIntrStaticTranslate and OALIntrTranslateIrq.

To output serial debug messages

To output debug messages to the serial port, you can often use the boot loader’s debug functions with minor modifications. For more information about these functions, see Serial Debug Message Output (Boot Loader).

To specify which hardware modules to include in the build

To specify the hardware-dependent modules and files, such as driver files, for the device, you may need to modify:

  • The Platform.bib configuration file.
  • The SOURCES files, which determine which files to compile during the build process.
  • The Platform.reg file, which contains registry settings. To modify Platform.reg, see Build and Test Your Device Driver.

Enable KITL

The following list describes the functions and configuration files that you may need to modify to support KITL on a cloned BSP.

  • To enable KITL, you may need to modify OEMKitlInit.
  • To configure the KITL startup process, you may need to modify OEMKitlStartup.

Note

You also need to include KITL in your OS design by using build options. For more information, see Build Configuration Types.

Adapt Device Drivers

Depending on your hardware, you may need to adapt existing device drivers or create new ones. For more information about modifying the device drivers included with Windows Embedded Compact, see Plan Your Device Driver, Implement Your Device Driver, and Build and Test Your Device Driver.

See Also

Concepts

Create or Modify a BSP