Download presentation
Presentation is loading. Please wait.
Published byFrederick Nichols Modified over 9 years ago
2
Developing Windows CE 5.0 OAL Li-Ming Fan Escalation Engineer Microsoft GCR-GTSC
3
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
4
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
5
Windows CE 5.0 BSPs Windows CE 5.0 BSPs/CSPs FamilyBSP/CSPKernel ARM Intel Mainstone IIARMV4I Samsung SMDK-2410ARMV4I CSP Only - Intel Xscale LubbockARMV4I MIPS AMD DBAu1000MIPSII AMD DBAu1100MIPSII AMD DBAu1500MIPSII NEC Solution Gear2 Vr4131MIPSII NEC Solution Gear2 Vr5500MIPSII & II_PF, MIPSIV & IV_FP Broadcom VoIP ReferenceMIPSII SH SH4 AspenSH4 x86 x86 (CEPC)x86 x86 Emulatorx86 Geodex86 Intel Assabet and Lubbock (use Mainstone II) ARM Integrator (use Samsung SMDK2410) SH3 Keywest (deprecated) BSPs NO LONGER SUPPORTED
6
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
7
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
8
BSP Development Process Test Hardware, Rom Monitor Develop Boot Loader Clone Reference BSP PowerManagement Develop OAL (Minimal Kernel) Add Device Drivers Package(CEC/MSI)
9
Boot Loader Architecture A typical development boot loader blcommon OEM code eboot … NE2000 RTL8139DP83815 bootpart flash FMD EDBG drivers
10
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)
11
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
12
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
13
PQOAL Design 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\ \src\inc) RTC Cache Library Interrupt Library IOCTL Library Startup Library RTC Library KITL Library OS Timer Library TimersCachesSerialportEthernetportUSBport OAL Kernel Hardware
14
Directory Structure Example platform\common\src inc ARM common cache memory ARM720T ARM920T Intel Samsung S3C2410 inc interrupt power RTC startup timer MIPS, SHx, x86 common platform\ cesysgen files intltrns 0409 … src bootloader kernel OAL kern kernkitl kernkitlprof inc common debug drivers PCMCIA Common code directoryBSP code directory
15
BSP Configuration Files BSP configuration files are located in a single location (platform\ \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
16
Shared Design Chip/set Support Package (CSP) drivers will share include files that define hardware registers and layoutpublic\common\oak\csp\arm\samsung\s3c2410x\inc: 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 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
17
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
18
Creating An OAL Create directory for OAL code in the BSP –platform\ \kernel\oal –Add 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”
19
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
20
Required OAL Functions Startup Debug Serial OEMInit System Timer Interrupt Processing Kernel Input/Output Example: Custom Kernel IOCTL KITL
21
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) ARM example LEAF_ENTRY StartUp... ; Initialize CPU to a known state ; Set up OEMAddressTable for KernelStart... bl KernelStart... ; KernelStart should never return LEAF_ENTRY StartUp... ; Initialize CPU to a known state ; Set up OEMAddressTable for KernelStart... bl KernelStart... ; KernelStart should never return
22
CE 5.0 Boot Sequence Boot loader startup sequence Startup() EbootMain() BootloaderMain() OEMDebugInit() OEMPlatformInit() OEMPreDownload() Download Occurs OEMLaunch() Kernel startup sequence Startup() KernelStart() ARMInit() OEMInitDebugSerial() OEMInit() KernelInit() HeapInit() InitMemoryPool() ProcInit() SchedInit() FirstSchedule() SystemStartupFunc() IOCTL_HAL_POSTINIT
23
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
24
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
25
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; } Void OEMInit() { SetUpInterruptMap(); PCIInitBusInfo(); InitDebugEther(); OEMParallelPortInit() InitPICs(); InitClock(); if (MainMemoryEndAddress == CEPC_EXTRA_RAM_START) { MainMemoryEndAddress += IsDRAM(MainMemoryEndAddress, CEPC_EXTRA_RAM_SIZE); } pKDIoControl = OEMKDIoControl; }
26
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
27
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
28
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
29
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
30
Kernel Libraries LibraryDescription kern.exekernkitl.exekernkitlprof.exe basickernel kernel w/ dbg suppt kernel w/ profiling suppt Nk.libMicroprocessor-specific Kernel code that MS supplies XX Hal.libOAL that you implement for target HW XXX NkProf.libProfile version of the MS Kernel code X KITL.libKernel Independent Transport Layer (KITL) debugging services XX SMC9000Sample Ethernet debugging driver. Must have for KITL suppt XXX FullLibcMicrosoft C Run-Time Library XXX
31
Kernel Input/Output OEMIoControl is called by the kernel when a device driver or application program calls the KernelIoControl function Extend the Ethernet Debugging Interface BOOL OEMIoControl(...) { switch (dwIoControlCode) { case IOCTL_HAL_SET_DEVICE_INFO : case IOCTL_HAL_REBOOT:... default: return FALSE; } return TRUE; } BOOL OEMIoControl(...) { switch (dwIoControlCode) { case IOCTL_HAL_SET_DEVICE_INFO : case IOCTL_HAL_REBOOT:... default: return FALSE; } return TRUE; }
32
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,... ); #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,... );
33
KITL Kernel 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
34
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
35
Optional OAL Functions Real-time Clock and Timer OEMGetExtensionDRAM()
36
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
37
OEMGetExtensionDRAM() pNKEnumExtensionDRAM AND OEMEnumExtensionDRAM Example 2 Extended 4MB DRAM available at 0x81800000 Example 1 No extension DRAM available BOOL OEMGetExtensionDRAM(LPDWORD lpMemStart, LPDWORD lpMemLen) { return FALSE; // no extension DRAM } BOOL OEMGetExtensionDRAM(LPDWORD lpMemStart, LPDWORD lpMemLen) { *lpMemStart = 0x81800000; *lpMemLen = 0x00400000; // 4MB return TRUE; } BOOL OEMGetExtensionDRAM(LPDWORD lpMemStart, LPDWORD lpMemLen) { return FALSE; // no extension DRAM } BOOL OEMGetExtensionDRAM(LPDWORD lpMemStart, LPDWORD lpMemLen) { *lpMemStart = 0x81800000; *lpMemLen = 0x00400000; // 4MB return TRUE; }
38
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
39
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
40
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
41
OAL Power Management Functions –OEMIdle – Puts the CPU in reduced power mode –OEMPowerOff – Puts the CPU in suspend mode
42
Tools & Resources msdn.microsoft.com/ embedded microsoft.public. windowsxp.embedded windowsce.platbuilder windowsce.platbuilder windowsce.embedded.vc windowsce.embedded.vc blogs.msdn.com/ mikehall Windows CE 5.0 Eval Kit Windows XP Embedded Eval Kit msdn.microsoft.com/ mobility microsoft.public. pocketpc.developer smartphone.developer dotnet.framework.compactframework blogs.msdn.com/ windowsmobile vsdteam netcfteam Windows Mobile 5.0 Eval Kit Websites Newsgroups Blogs Tools Build Develop
43
请在课程结束后填写课程培训反馈表,参加抽奖。 请填写资料袋内的蓝色大会满意度反馈表,到大会接待台领取 《 Windows Mobile 手机应用开发》工具书。 您还可以: 参加 Windows Mobile 动手实验室; 参观微软及合作伙伴展区; 体验基于 Windows Mobile 平台开发的最新硬件产品及解决方案。 大会注意事项
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.