Introduction to Embedded Software Development

40
Introduction to Embedded Introduction to Embedded Software Development Software Development School of software School of software Engineering Engineering 2005 2005 8. Board Support Package 8. Board Support Package Development Development

description

Introduction to Embedded Software Development. 8. Board Support Package Development. School of software Engineering 2005. Agenda. BSP Development Using the Standard CETK Tests. BSP Introduction. - PowerPoint PPT Presentation

Transcript of Introduction to Embedded Software Development

Page 1: Introduction to Embedded Software Development

Introduction to Embedded Software Introduction to Embedded Software DevelopmentDevelopment

School of software EngineeringSchool of software Engineering20052005

8. Board Support Package 8. Board Support Package DevelopmentDevelopment

Page 2: Introduction to Embedded Software Development

AgendaAgenda

BSP DevelopmentBSP Development

Using the Standard CETK Tests Using the Standard CETK Tests

Page 3: Introduction to Embedded Software Development

BSP IntroductionBSP IntroductionA board support package (BSP) is software that implements and supports an OS on a standard development board (SDB). With a BSP, you can rapidly bring up an OS on an SDB and evaluate the features of the OS. Using a BSP, OEMs and independent hardware vendors (IHVs) can reduce the time required to develop a Windows CE–based platform.

Page 4: Introduction to Embedded Software Development

BSP, CSP & OALBSP, CSP & OAL

CSP : CPU Support PackageCSP : CPU Support Package A package that consists of an OAL and A package that consists of an OAL and

device drivers to support a given CPU or device drivers to support a given CPU or CPU companion chipset regardless of CPU companion chipset regardless of what hardware board or hardware what hardware board or hardware platform they are on.platform they are on.

Usually Provided by OS Development Usually Provided by OS Development corporation. For Win CE, that’s corporation. For Win CE, that’s MicrosoftMicrosoft

Page 5: Introduction to Embedded Software Development

BSP, CSP & OAL (2)BSP, CSP & OAL (2) OAL : OEM abstraction layerOAL : OEM abstraction layer

The layer between the Windows CE kernel The layer between the Windows CE kernel and the hardware of your target device. and the hardware of your target device. This layer facilitates communication This layer facilitates communication between your operating system (OS) and between your operating system (OS) and your target device. After being called by your target device. After being called by the boot loader, the OAL routines the boot loader, the OAL routines implement platform initialization, interrupt implement platform initialization, interrupt service routines (ISRs), the real-time clock service routines (ISRs), the real-time clock (RTC), the interval timer, debugging, (RTC), the interval timer, debugging, interrupt enable/disable, and profiling.interrupt enable/disable, and profiling.

Provided by Hardware OEMsProvided by Hardware OEMs

Page 6: Introduction to Embedded Software Development

BSP contains…BSP contains…

Element Description

Boot loader During development, downloads the operating system (OS) images.

OEM adaptation layer (OAL) Links to the kernel image and supports hardware initialization and management.

Device drivers Support peripherals on-board or are attached at run time.

Configuration files Once created, a BSP can be reconfigured through environment variables and .bib and .reg file modifications.

Page 7: Introduction to Embedded Software Development

BSP ArchitectureBSP Architecture

OALDrivers

Configuration Files

Boot Loader

SDB

BSP

Page 8: Introduction to Embedded Software Development

Creating BSP, two waysCreating BSP, two ways

Writing a whole new BSP yourselfWriting a whole new BSP yourself Should write all OAL, Drivers, BootloaderShould write all OAL, Drivers, Bootloader Will cost approximate 20 man-monthWill cost approximate 20 man-month

Cloning an existing BSPCloning an existing BSP The easiest way for you to create a new The easiest way for you to create a new

BSP is to clone an existing BSP that is BSP is to clone an existing BSP that is designed for similar hardware.designed for similar hardware.

Page 9: Introduction to Embedded Software Development

BSP WizardBSP Wizard Guides you through the process of Guides you through the process of

creating a BSP based on Windows CE. creating a BSP based on Windows CE. Typically used to generate a .cec file Typically used to generate a .cec file for your BSP for your BSP

Platform -> BSP Wizard Platform -> BSP Wizard

Page 10: Introduction to Embedded Software Development

BSP Development processBSP Development process

Page 11: Introduction to Embedded Software Development

Bootloader is not required system Bootloader is not required system can boot directly into OS imagecan boot directly into OS image

Bootloader increasingly used in Bootloader increasingly used in shipping devices for upgrade shipping devices for upgrade capabilitycapability Also used to download tests during Also used to download tests during

manufacturingmanufacturing

Bootloader is essential during Bootloader is essential during development to download updated development to download updated OS Run-Time ImagesOS Run-Time Images

Bootloader (Optional)Bootloader (Optional)

Page 12: Introduction to Embedded Software Development

Role of bootloaderRole of bootloader

Initializes the target device Memory and interrupt controller Setting up the clocks and MMU

Controls the boot process Directly boot an existing flash RAM image Clear RAM before downloading Memory read/write test

Downloads the Windows CE image to RAM or flash RAM using: Parallel port Ethernet port

Page 13: Introduction to Embedded Software Development

Bootloader communicationBootloader communication

Page 14: Introduction to Embedded Software Development

Boot menuBoot menu

Page 15: Introduction to Embedded Software Development

Bootloader DevelopmentBootloader Development

Implements some OEM APIs.Implements some OEM APIs.

Link with Microsoft libsLink with Microsoft libs

Page 16: Introduction to Embedded Software Development

Bootloader TasksBootloader Tasks

Function calls in bold text denote functions that OEMs need to implement.

Page 17: Introduction to Embedded Software Development

Control flowControl flow

C:\WINCE420\PUBLIC\COMMON\OAK\DRIVERS\ETHDBG\BLCOMMON

Page 18: Introduction to Embedded Software Development

Bootloader -- StartupBootloader -- Startup The first code that is run on the device after The first code that is run on the device after

a hardware reset or run-time reseta hardware reset or run-time reset Sets the device to supervisor mode Sets the device to supervisor mode Performs the necessary initialization for the Performs the necessary initialization for the

following hardware: following hardware: CPU CPU Memory controller Memory controller System clocks System clocks Serial Serial Caches Caches Translation look-aside buffers (TLBs) Translation look-aside buffers (TLBs)

Modify the Startup.s file, depending on the Modify the Startup.s file, depending on the CPU you are usingCPU you are using

Page 19: Introduction to Embedded Software Development

Bootloader -- EbootMainBootloader -- EbootMain

EbootMain is typically the entry point EbootMain is typically the entry point for the C code to be runfor the C code to be run

End with a call to the BLCOMMON End with a call to the BLCOMMON library entry point library entry point

The BLCOMMON library source file is The BLCOMMON library source file is located in the Blcommon.c file in the located in the Blcommon.c file in the %_WINCEROOT%\Public\Common\%_WINCEROOT%\Public\Common\Oak\Drivers\Ethdbg directoryOak\Drivers\Ethdbg directory

Page 20: Introduction to Embedded Software Development

Bootloader -- OEMDebugInitBootloader -- OEMDebugInit

Used to initialize serial UART Used to initialize serial UART debugging output.debugging output.

After OEMDebugInit completes, the After OEMDebugInit completes, the Windows CE banner appears indicating Windows CE banner appears indicating that this interface is available. that this interface is available.

Page 21: Introduction to Embedded Software Development

Bootloader -- OEMPlatformInitBootloader -- OEMPlatformInit

OEM hardware platform initialization OEM hardware platform initialization function for the clock, PCI interface, or function for the clock, PCI interface, or NIC interface. NIC interface.

The NIC interface for downloading the The NIC interface for downloading the image is assumed for the following image is assumed for the following download functions.download functions.

Page 22: Introduction to Embedded Software Development

Bootloader -- OEMPreDownloadBootloader -- OEMPreDownload

Called from BLCOMMON before Called from BLCOMMON before actually downloading a run-time image.actually downloading a run-time image.

retrieves the IP address for the device retrieves the IP address for the device and connects to the development and connects to the development workstation.workstation.

Return -1 for Error Return -1 for Error

Page 23: Introduction to Embedded Software Development

Bootloader -- Bootloader -- OEMLaunchOEMLaunch

OEMLaunch is the last boot loader OEMLaunch is the last boot loader function called out of BLCOMMONfunction called out of BLCOMMON

Responsible for jumping to and Responsible for jumping to and launching the run-time image. launching the run-time image.

Jumps to the first instruction specified Jumps to the first instruction specified by the dwLaunchAddr parameter, by the dwLaunchAddr parameter, which is the location of the run-time which is the location of the run-time image Startup function.image Startup function.

Page 24: Introduction to Embedded Software Development

Kernel DevelopmentKernel Development

The scenario is almost the same as The scenario is almost the same as Bootloader developmentBootloader development

Can reuse the code of bootloaderCan reuse the code of bootloader

Page 25: Introduction to Embedded Software Development

OAL architectureOAL architecture

Page 26: Introduction to Embedded Software Development

Kernel DevelopmentKernel Development

Function calls in bold text denote functions that OEMs need to implement.

Page 27: Introduction to Embedded Software Development

Kernel workflowKernel workflow

Page 28: Introduction to Embedded Software Development

KITLKITL Designed to provide an

easy way for you to support any debug service

Separates the protocol of the communication service from the layer that communicates directly with the communication hardware

reducing your involvement in creating a hardware transport layer

Including the KITL support in the operating system image

Page 29: Introduction to Embedded Software Development

1.1. CPU Power on Reset VectorCPU Power on Reset Vector

2.2. [Optional] Startup() in Boot Loader[Optional] Startup() in Boot Loader

3.3. Startup() in OALStartup() in OAL

4.4. KernelStart() [ KernelInitialize() For x86 ]KernelStart() [ KernelInitialize() For x86 ]

5.5. Kernel Calls OEMInit() in OALKernel Calls OEMInit() in OAL

6.6. Kernel Completes InitializationKernel Completes Initialization

7.7. Kernel Loads Filesys.exeKernel Loads Filesys.exe

8.8. FileSys initializes the registryFileSys initializes the registry

9.9. Kernel loads applications listed in Kernel loads applications listed in HKEY_LOCAL_MACHINE\InitHKEY_LOCAL_MACHINE\Init

Boot Process Big PictureBoot Process Big Picture

Page 30: Introduction to Embedded Software Development

Driver DevlopmentDriver Devlopment

See the previous courses.See the previous courses.

Can be added to BSP using BSP Can be added to BSP using BSP WizardWizard

Page 31: Introduction to Embedded Software Development

Demo :Demo :Analyze the Motorola Analyze the Motorola

DragonBall BSPDragonBall BSP

Page 32: Introduction to Embedded Software Development

Where are we?Where are we?

We have finally completed We have finally completed the Windows CE the Windows CE

development flow.development flow.

Page 33: Introduction to Embedded Software Development

Get hardware & BSP from OEMs

Need Hardware Design?

Design & develop your hardware

Develop BSP for your hardware

Need platform customization

?

Get platform & SDK from OEMs

Customize your Win CE platform

Export your SDK

Coding & Testing

Release to Manufacture

Page 34: Introduction to Embedded Software Development

Windows CE Test Kit (CETK)Windows CE Test Kit (CETK)Tux “server”Tux “server”Kato Logging EngineKato Logging EngineDevice Driver Loader and Tux Device Driver Loader and Tux

Extender (DDLX)Extender (DDLX)Custom TUX TestsCustom TUX Tests

OverviewOverview

Page 35: Introduction to Embedded Software Development

CETK ArchitectureCETK Architecture

ClientSide.exe

Tux Test DLLTux Test DLLTux Test

DLLsKato.dll

CETEST.EXE

Desktop Windows CE Device

TUX.EXE

Device.EXE

TUX Test DLL

DDLX

Page 36: Introduction to Embedded Software Development

Microsoft provided automated test architectureMicrosoft provided automated test architecture Client/Server Architecture supports remote testingClient/Server Architecture supports remote testing

Automated test loading via “Tux”Automated test loading via “Tux” Actual tests implemented as DLLs loaded by TUXActual tests implemented as DLLs loaded by TUX

Common logging Engine “Kato”Common logging Engine “Kato” DLL exposes C and C++ API for logging to the serverDLL exposes C and C++ API for logging to the server

CETK ServerCETK Server Starts specific test using TUXStarts specific test using TUX Stores logs and generates reportsStores logs and generates reports Runs on desktop system for remote testingRuns on desktop system for remote testing

Windows CE Test Kit (CETK)Windows CE Test Kit (CETK)

Page 37: Introduction to Embedded Software Development

TUX ServerTUX Server

TUX.EXETUX.EXEProcess that hosts TUX test DLLsProcess that hosts TUX test DLLs

Actual Tests implemented in DLLsActual Tests implemented in DLLsTest DLLs loaded by TUX.EXETest DLLs loaded by TUX.EXE

Launched by remote UI applicationLaunched by remote UI applicationCETEST.EXE on the desktopCETEST.EXE on the desktop

Can run Standalone on the device as Can run Standalone on the device as wellwell

Page 38: Introduction to Embedded Software Development

KATO Logging EngineKATO Logging EngineDLL That provides APIs for logging DLL That provides APIs for logging

test resultstest results C++ Class LibraryC++ Class Library C FunctionsC Functions

Abstracts logging mechanisms Abstracts logging mechanisms from TUX Testsfrom TUX Tests Local fileLocal file Remote connectionRemote connection

Page 39: Introduction to Embedded Software Development

Device Driver Loader and TUX Device Driver Loader and TUX Extender (DDLX)Extender (DDLX)Allows TUX test DLLs to load into the Allows TUX test DLLs to load into the

Device Manager Process spaceDevice Manager Process spaceAllows testing of APIs and Allows testing of APIs and

functionality only available within functionality only available within Device ManagerDevice Manager Device Manager exposes APIs directly Device Manager exposes APIs directly

to driversto drivers Drivers can expose functionality directly Drivers can expose functionality directly

to other driversto other drivers

Page 40: Introduction to Embedded Software Development

Custom TUX TestsCustom TUX TestsTUXSKEL TUXSKEL

Microsoft provided TUX test skeleton Microsoft provided TUX test skeleton frameworkframework

Use as a starting “template” for creating Use as a starting “template” for creating custom TUX testscustom TUX tests

IDE New Project Wizard generates a IDE New Project Wizard generates a custom TUX test based on TUXSKEL custom TUX test based on TUXSKEL structurestructure Simpler than copying and modifying Simpler than copying and modifying

TUXSKEL manuallyTUXSKEL manually