Developing windows ce 5 0 oal
This presentation is the property of its rightful owner.
Sponsored Links
1 / 44

Developing Windows CE 5.0 OAL PowerPoint PPT Presentation


  • 74 Views
  • Uploaded on
  • Presentation posted in: General

Developing Windows CE 5.0 OAL. Li-Ming Fan Escalation Engineer Microsoft GCR-GTSC. Agenda. Windows CE 5.0 BSPs and Kernels Development Process OAL Architecture and Design Boot Sequence and Required OAL Functions Kernel and KITL Optional OAL Functions Building Power Management.

Download Presentation

Developing Windows CE 5.0 OAL

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Developing windows ce 5 0 oal

DevelopingWindows CE 5.0 OAL

Li-Ming Fan

Escalation Engineer

Microsoft GCR-GTSC


Agenda

Agenda

  • Windows CE 5.0 BSPs and Kernels

  • Development Process

  • OAL

    • Architecture and Design

    • Boot Sequence and Required OAL Functions

    • Kernel and KITL

    • Optional OAL Functions

    • Building

    • Power Management


Agenda1

Agenda

  • Windows CE 5.0 BSPs and Kernels

  • Development Process

  • OAL

    • Architecture and Design

    • Boot Sequence and Required OAL Functions

    • Kernel and KITL

    • Optional OAL Functions

    • Building

    • Power Management


Windows ce 5 0 bsps

Windows CE 5.0 BSPs

  • Intel Assabet and Lubbock (use Mainstone II)

  • ARM Integrator (use Samsung SMDK2410)

  • SH3 Keywest (deprecated)

BSPs NO LONGER

SUPPORTED


Windows ce 5 0 kernels

Windows CE 5.0 Kernels

  • Kernels & OS builds in 4.2 = 9

    • ARMV4, ARMV4I, ARMV4T

    • MIPSIIB/16, MIPSII, MIPSII_FP, MIPSIV, MIPSIV_FP

    • SH3, SH4

    • x86

  • Kernels & OS builds in 5.0 = 7

    • ARMV4I, ARMV4

    • MIPSII, MIPSII_FP, MIPSIV, MIPSIV_FP

    • SH4, SH3

    • x86


Agenda2

Agenda

  • Windows CE 5.0 BSPs and Kernels

  • Development Process

  • OAL

    • Architecture and Design

    • Boot Sequence and Required OAL Functions

    • Kernel and KITL

    • Optional OAL Functions

    • Building

    • Power Management


Bsp development process

BSP Development Process

Test Hardware,

Rom Monitor

Clone Reference

BSP

Develop

Boot Loader

Power

Management

Add

Device Drivers

Develop OAL

(Minimal Kernel)

Package

(CEC/MSI)


Boot loader architecture

Boot Loader Architecture

A typical development boot loader

blcommon

OEM code

eboot

RTL8139

DP83815

bootpart

NE2000

flash FMD

EDBG drivers


Bootloader architecture

Bootloader Architecture

  • Blcommon – generic boot loader framework

  • OEM code – general board init and extensions

  • Eboot – Ethernet functions (UDP, DHCP, TFTP)

  • EDBG drivers – Ethernet drivers

    • 3Com 3C90x, AMD AM79C97x, CS8900A, NS DP83815, NE2000, RealTek RTL8139, SMSC9000 & SMSC100

  • Bootpart – storage partition management

  • FMD – flash management driver

    • Samsung/Sandisk (NAND), Intel StrataFlash (NOR)


Agenda3

Agenda

  • Windows CE 5.0 BSPs and Kernels

  • Development Process

  • OAL

    • Architecture and Design

    • Boot Sequence and Required OAL Functions

    • Kernel and KITL

    • Optional OAL Functions

    • Building

    • Power Management


Windows ce 5 0 bsps1

Windows CE 5.0 BSPs

  • Reduce OS “bring-up” time on OEM hardware

  • Avoid changing the "public" OAL interface

  • Provide production features (power management, performance optimizations, IOCTLs, etc.)

  • Maximize code re-use (and testing)

  • Provide a consistent OAL architecture that can be easily extended/customized

  • Increase BSP coverage in-the-box

    • One BSP for each supported CPU

    • Integrate BSPs into the IDE Catalog

    • Integrate BSPs into the Platform Wizard

  • Enable third parties to create BSPs easily

    • Ship CSP drivers for many CPUs and SOCs

    • PB Tools - BSP Wizard and IDE tools

    • Enables faster, easier porting to OEM devices


Pqoal design

PQOAL Design

Kernel

  • Collection of OAL software libraries organized by CPU architecture (or model) and by OAL “function”

  • Common Code Directory Structure

  • BSP configuration files are located in a single location (platform\<BSP>\src\inc)

OAL

OS Timer

Library

Cache

Library

Startup

Library

Interrupt

Library

IOCTL

Library

KITL

Library

RTC

Library

RTC

Timers

Caches

USB

port

Ethernet

port

Serial

port

Hardware


Directory structure example

Directory Structure Example

Common code directory

BSP code directory

platform\common\src

inc

ARM

common

cache

memory

ARM720T

ARM920T

Intel

Samsung

S3C2410

inc

interrupt

power

RTC

startup

timer

MIPS, SHx, x86

common

platform\<BSP_name>

cesysgen

files

intltrns

0409

src

bootloader

kernel

OAL

kern

kernkitl

kernkitlprof

inc

common

debug

drivers

PCMCIA


Bsp configuration files

BSP Configuration Files

  • BSP configuration files are located in a single location (platform\<BSP>\src\inc)

    • Simplifies porting/customization work

    • Consistent file naming scheme

      • args.h – bootloader-OAL shared memory structure

      • bsp.h – master bsp include file

      • bsp_base_regs.h – board-level address definitions

      • bsp_cfg.h – general BSP configs (device name, clock settings,…)

      • image_cfg.h – memory layout address definitions

      • ioctl_cfg.h – definitions used by BSP IOCTL routines

      • ioctl_tab.h – IOCTL function table

      • kitl_cfg.h – KITL transport name/device/driver table

      • oemaddrtab_cfg.inc – (ARM/x86) VA-PA mapping table


Shared design

Shared Design

  • Chip/set Support Package (CSP) drivers will share include files that define hardware registers and layout

    public\common\oak\csp\arm\samsung\s3c2410x\inc:

s3c2410x_lcd.h

s3c2410x_memctrl.h

s3c2410x_nand.h

s3c2410x_pwm.h

s3c2410x_rtc.h

s3c2410x_sdi.h

s3c2410x_spi.h

s3c2410x_uart.h

s3c2410x_usbd.h

s3c2410x_wdog.h

s3c2410x.h

s3c2410x.inc

s3c2410x_adc.h

s3c2410x_base_regs.h

s3c2410x_base_regs.inc

s3c2410x_clkpwr.h

s3c2410x_dma.h

s3c2410x_iicbus.h

s3c2410x_iisbus.h

s3c2410x_intr.h

s3c2410x_ioport.h


Creating a bsp

Creating A BSP

  • BSP wizard

    • IDE Tool to clone BSP or create a BSP definition

    • Can add/remove drivers to a BSP definition

  • Export wizard

    • IDE Tool to export feature components from the IDE Catalog to other PB users

    • Creates a MS Windows Installer (MSI) file

  • CEC editor

    • IDE Tool to create and/or edit .CEC files

    • A .CEC file defines the properties of an object/component in the IDE catalog

    • No more .bsp files

  • Two methods to create a BSP

    • Use the command line method

    • Use the BSP Wizard

    • Both methods rely on cloning a sample BSP


Creating an oal

Creating An OAL

  • Create directory for OAL code in the BSP

    • platform\<BSPname>\kernel\oal

    • Add <dirname> to “dirs” file to build OAL with BSP

  • Required OAL functions

    • Startup

    • Debug serial

    • OEMInit

    • System timer

    • Interrupt processing

    • Kernel input/output, KITL

  • Optional OAL functions (Platform Dependent)

    • Real-time clock and timer

    • Parallel port I/O code

    • Ethernet port debug

  • More information in PB docs

    • “How-to Create an OEM adaptation layer”


Agenda4

Agenda

  • Windows CE 5.0 BSPs and Kernels

  • Development Process

  • OAL

    • Architecture and Design

    • Boot Sequence and Required OAL Functions

    • Kernel and KITL

    • Optional OAL Functions

    • Building

    • Power Management


Required oal functions

Required OAL Functions

  • Startup

  • Debug Serial

  • OEMInit

  • System Timer

  • Interrupt Processing

  • Kernel Input/Output

  • Example: Custom Kernel IOCTL

  • KITL


Startup

StartUp

  • First function called when target device boots

  • Purpose is to initialize CPU to known state and to call the kernel initialization function (KernelInitialize for x86 and KernelStart on all other platforms)

LEAF_ENTRY StartUp

. . .

; Initialize CPU to a known state

; Set up OEMAddressTable for KernelStart

. . .

bl KernelStart

. . .

; KernelStart should never return

ARM example


Ce 5 0 boot sequence

CE 5.0 Boot Sequence


Debug serial

Debug Serial

  • OEMInitDebugSerial()

    • Configures Speed, Parity, Stop bit length

  • OEMReadDebugByte()

    • Retrieves a byte from the debug monitor port

  • OEMWriteDebugByte()

    • Outputs a byte to the debug monitor port

  • OEMWriteDebugString()

    • Writes a string to the debug monitor port


Oeminit

OEMInit

  • Required task is to set up hardware and register interrupt for the system tick

  • ISRs and HookInterrupt

  • Setting Up the Interrupt Map

    • Define a mapping of Interrupt IDs

      • Mapping can be dynamic at driver load time

    • Interrupt IDs’ are returned by the ISRs to the kernel and are used to link an incoming IRQ with a software IST


Oeminit an example

OEMInit: An Example

Void OEMInit() {

SetUpInterruptMap();

PCIInitBusInfo();

InitDebugEther();

OEMParallelPortInit()

InitPICs();

InitClock();

if (MainMemoryEndAddress == CEPC_EXTRA_RAM_START)

{

MainMemoryEndAddress += IsDRAM(MainMemoryEndAddress,

CEPC_EXTRA_RAM_SIZE);

}

pKDIoControl = OEMKDIoControl;

}


Interrupt processing

Interrupt Processing

  • OEMInterruptEnable()

    • Performs hardware operations necessary to allow a device to generate the specified interrupt

    • Includes

      • Setting a hardware priority for the device

      • Setting a hardware interrupt enable port

      • Clearing any pending interrupt conditions from the device

  • OEMInterruptDisable()

    • Disables the specified hardware interrupt

  • OEMInterruptDone()

    • Unmasked and reenables of interrupt processing


Interrupt processing1

Interrupt Processing

  • OEMGetInterrupt()

    • Used by the any device wanting and IRQ. Example PCI bus

  • OEMRequestSysIntr()

    • Used in the OEMIoControl routine to implement IOCTL_HAL_TRANSLATE_IRQ and IOCTL_HAL_REQUEST_SYSINTR

  • OEMTranslateIrq()

    • Used by the main ISR to translate a non-shareable IRQ into a SYSINTR

  • OEMTranslateSysIntr()

    • Translates a SYSINTR to its corresponding IRQ


System timer

System Timer

  • Make sure the system timer interrupt is registered with the ISR

  • Program the system timer to generate an interrupt every 1ms

    • Can also support variable tick

  • In the system timer ISR, update the global system tick counter CurMSec and CurTicks. If reschedule time is expired then return SYSINTR_Resched else SYSINTR_NOP


Agenda5

Agenda

  • Windows CE 5.0 BSPs and Kernels

  • Development Process

  • OAL

    • Architecture and Design

    • Boot Sequence and Required OAL Functions

    • Kernel and KITL

    • Optional OAL Functions

    • Building

    • Power Management


Kernel libraries

Kernel Libraries


Kernel input output

Kernel Input/Output

BOOL OEMIoControl(. . .)

{

switch (dwIoControlCode) {

case IOCTL_HAL_SET_DEVICE_INFO :

case IOCTL_HAL_REBOOT:

. . .

default:

return FALSE;

}

return TRUE;

}

  • OEMIoControl is called by the kernel when a device driver or application program calls the KernelIoControl function

  • Extend the Ethernet Debugging Interface


Example custom kernel ioctl

Example: Custom Kernel IOCTL

#define IOCTL_MY_CONTROL1 \

CTL_CODE(FILE_DEVICE_HAL, 2048,

METHOD_NEITHER, FILE_ANY_ACCESS)

BOOL OEMIoControl(. . .) {

switch (dwIoControlCode)

{

case IOCTL_MY_CONTROL1:

. . .

}

RetCode = KernelIoControl( IOCTL_MY_CONTROL1 ,

. . . );


Kitl kernel independent transport layer

KITLKernel Independent Transport Layer

  • Designed to provide an easy way for you to support any debug service

  • OEM Function to implement is OEMKitlINit

  • Including the KITL support in the operating system image

  • Vmini not always necessary. EDBG driver can talk directly to desktop

  • Passive KITL also available


Agenda6

Agenda

  • Windows CE 5.0 BSPs and Kernels

  • Development Process

  • OAL

    • Architecture and Design

    • Boot Sequence and Required OAL Functions

    • Kernel and KITL

    • Optional OAL Functions

    • Building

    • Power Management


Optional oal functions

Optional OAL Functions

  • Real-time Clock and Timer

  • OEMGetExtensionDRAM()


Real time clock and timer

Real-time Clock And Timer

  • OEMGetRealTime()

    • Called by the kernel to get the time from the real-time clock

  • OEMSetRealTime()

    • Sets the real time clock

  • OEMSetAlarmTime()

    • Sets the alarm time

  • OEMQueryPerformanceCounter()

    • Retrieves the current value of the high-resolution performance counter, if one exists

  • OEMQueryPerformanceFrequency()

    • Retrieves the frequency of the high-resolution performance counter, if one exists


Oemgetextensiondram

OEMGetExtensionDRAM()

BOOL OEMGetExtensionDRAM(LPDWORD lpMemStart,

LPDWORD lpMemLen)

{

return FALSE; // no extension DRAM

}

BOOL OEMGetExtensionDRAM(LPDWORD lpMemStart,

LPDWORD lpMemLen)

{

*lpMemStart = 0x81800000;

*lpMemLen = 0x00400000; // 4MB

return TRUE;

}

  • pNKEnumExtensionDRAM AND OEMEnumExtensionDRAM

Example 1No extension DRAM available

Example 2Extended 4MB DRAM available at 0x81800000


Agenda7

Agenda

  • Windows CE 5.0 BSPs and Kernels

  • Development Process

  • OAL

    • Architecture and Design

    • Boot Sequence and Required OAL Functions

    • Kernel and KITL

    • Optional OAL Functions

    • Building

    • Power Management


Building oal and kernel

Building OAL and Kernel

  • No longer necessary to SYSGEN OAL libraries

  • Shared OAL code is built just before the BSP directory (platform\common)

  • BSP kernel (kernkitl.exe) sources file:

    TARGETLIBS= \

    $(_COMMONOAKROOT)\lib\$(_CPUDEPPATH)\nk.lib \

    $(_TARGETPLATROOT)\lib\$(_CPUDEPPATH)\oal.lib \

    $(_PLATCOMMONLIB)\$(_CPUINDPATH)\oal_startup_s3c2410x.lib \

    $(_PLATCOMMONLIB)\$(_CPUINDPATH)\oal_abort_s3c2410x.lib \

    $(_PLATCOMMONLIB)\$(_CPUINDPATH)\oal_cache_s3c2410x.lib \

    $(_PLATCOMMONLIB)\$(_CPUINDPATH)\oal_memory_s3c2410x.lib \

    $(_PLATCOMMONLIB)\$(_CPUDEPPATH)\oal_io_s3c2410x.lib \

    $(_PLATCOMMONLIB)\$(_CPUINDPATH)\oal_intr_s3c2410x.lib \

    $(_PLATCOMMONLIB)\$(_CPUINDPATH)\oal_timer_s3c2410x.lib \

    $(_PLATCOMMONLIB)\$(_CPUINDPATH)\oal_rtc_s3c2410x.lib \

    $(_PLATCOMMONLIB)\$(_CPUINDPATH)\oal_ioctl_s3c2410x.lib \

    $(_PLATCOMMONLIB)\$(_CPUDEPPATH)\oal_other.lib \

    $(_PLATCOMMONLIB)\$(_CPUDEPPATH)\oal_log.lib \

    $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\ddk_io.lib \

    $(_COMMONOAKROOT)\lib\$(_CPUDEPPATH)\kitl.lib \

    $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\fulllibc.lib \

    $(_PLATCOMMONLIB)\$(_CPUINDPATH)\oal_ethdrv_cs8900a.lib


Agenda8

Agenda

  • Windows CE 5.0 BSPs and Kernels

  • Development Process

  • OAL

    • Architecture and Design

    • Boot Sequence and Required OAL Functions

    • Kernel and KITL

    • Optional OAL Functions

    • Building

    • Power Management


Oal power management functions

OAL Power Management Functions

  • OAL Power Management Functions

    • OEMIdle – Puts the CPU in reduced power mode

    • OEMPowerOff – Puts the CPU in suspend mode


Tools resources

Tools & Resources

Build

Develop

Websites

msdn.microsoft.com/embedded

msdn.microsoft.com/mobility

Newsgroups

microsoft.public.pocketpc.developer smartphone.developer dotnet.framework.compactframework

microsoft.public.windowsxp.embedded

windowsce.platbuilder

windowsce.embedded.vc

Blogs

blogs.msdn.com/mikehall

blogs.msdn.com/windowsmobilevsdteamnetcfteam

Tools

Windows CE 5.0 Eval KitWindows XP Embedded Eval Kit

Windows Mobile 5.0 Eval Kit


Developing windows ce 5 0 oal

大会注意事项

请在课程结束后填写课程培训反馈表,参加抽奖。

请填写资料袋内的蓝色大会满意度反馈表,到大会接待台领取

《Windows Mobile手机应用开发》工具书。

您还可以:

参加Windows Mobile动手实验室;

参观微软及合作伙伴展区;

体验基于 Windows Mobile平台开发的最新硬件产品及解决方案。


  • Login