Detailed description of the platform builder configuration file

Source: Internet
Author: User
Tags msmq

Windows CE operating system is a powerful tool for embedded system development. Windows CE platform Builder provides all development and debugging tools for creating, cropping, and configuring Windows CE. Profound Understanding and flexible use of the platform builder configuration file. Reg,. bib,. dat,. DB is the key to customizing the Windows CE operating system suitable for the target platform. This document analyzes the configuration file of platform builder in detail and takes adding the rtl8139 NIC Driver to Windows CE as an example to describe how to add the device driver of the target platform by modifying the configuration file.

Keywords: Embedded System Platform builder Windows CE driver

 

Introduction

An embedded system refers to the integration of the operating system and functional software into the computer hardware system. Simply put, it refers to the integration of the system application software and the system hardware, which is similar to the BIOS working method. It features low software code, high automation, and fast response speed. Windows CE is a powerful and open 32-bit real-time embedded operating system. It is suitable for quickly building a new generation of smart devices with less memory and smaller size, such as industrial controllers, handheld devices, smart phones, set-top boxes, and retail device. Moreover, Windows CE provides a new embedded system platform for the development of smart mobile devices. Windows CE supports a variety of processor products, including x86, XScale, arm, MIPS, and SH series, So it allows developers to choose the most ideal hardware. Microsoft Windows CE platform builder is used to create, crop, and customize Windows CE operating systems. Platform Builder provides many configuration files and Development debugging tools for creating Windows CE. Because Windows CE is suitable for multi-task systems that require real-time and specific purposes, it is usually necessary to develop device drivers for dedicated hardware devices for the target platform. The peripheral device can work normally only after an appropriate device driver is added to winodws ce. The following uses the rtl8139 NIC driver as an example to describe how to add a device driver for Windows CE by modifying the configuration file.

1. Create a software and hardware environment for Windows CE Configuration

To configure and debug Windows CE, one high-performance development workstation and one target debugging device are required. Platform builder runs on a high-performance development workstation of Windows 2000 or later. Platform builder allows you to create and debug Windows ce nk ing NK. bin integrated development environment, such as Wizard and toolbar, supports the activity Template Library (ATL), Microsoft basic class library (MFC) and Visual Basic, provides compilers, kernel debuggers, and various remote debugging tools for supported processor families. The target debugging platform can be a general PC after proper configuration, or an embedded microprocessor module. The development workstation connects to the target platform through Ethernet or serial or parallel ports, and downloads the Windows CE operating system image file NK. bin to the target platform. After the download is complete, Windows CE starts on the target platform. On the Development workstation, you can use the debugging tool provided by platform builder to view the running status of Windows CE. The differences between Ethernet and serial and parallel ports are shown in table 1.

Table 1 differences between Ethernet and serial/parallel port connections

Ethernet connection String and parallel port connections
Fast download speed Slow download speed
The development workstation requires an Ethernet NIC, and the target platform requires a ne2000 compatible debugging Ethernet NIC Serial Port and parallel port
Both image files and debugging tools use Ethernet. Image files are downloaded through parallel ports, and debugging information on the target platform is transmitted through serial ports.

2. configuration file provided by platform Builder

The configuration file includes four file types: Binary Image Generation file. bib, registry file. Reg, directory and File Allocation Table file. dat, and database file. DB. By modifying these configuration files, you can crop and optimize Windows CE. You can create your own configuration files as needed. The main configuration files provided by Pb are listed in table 2.

Table 2 configuration file list

. Bib File . Reg file . Dat file . DB File
Common. bib Common. Reg Common. dat Common. DB
DCOM. bib DCOM. Reg Servers. dat  
MSMQ. bib MSMQ. Reg    
Platform. bib Platform. Reg Platform. dat Platform. DB
Project. bib Project. Reg Project. dat  
Wceshellfe. bib Wceshellfe. Reg Wceshellfe. dat Wceshellfe. DB
Wceappsfe. bib Wceappsfe. Reg Wceappsfe. dat Wceappsfe. DB
Config. bib Reg    

2.1 Binary Image Generation file. bib

The. bib file is a text file that identifies the target modules, components, and files contained in the Windows CE image. A. bib file contains four parts: files, modules, memory, and config.

(1) files Section

Files allocates some memory space to static data files. This part mainly includes font files (. TTF), text files (. txt), bitmap files (. BMP), and audio files (. wav. For example:

; Name path memory type

;-------------------------------------------------------------

Tahoma. TTF $ (_ flatreleasedir). ttf nk Shu

Name: file name in Windows CE.

Path: the location of the file in the Development workstation.

Memory: Memory zone of the file.

Type: defines file attributes. Files in Windows CE have the following file attributes: S is the system file, H is the implicit file, U is not the compressed file, r is the compressed resource file, and C is the compressed file. One file can have several attributes at the same time.

The preceding example shows that the NK memory zone contains the $ (_ flatreleasedir). TTF file of the Development workstation. In Windows CE, the file attribute of tahoma. TTF is a non-compressed file hidden by the system.

(2) Modules

Lists the target modules and components loaded in the memory, including all executable files. EXE and dynamic link library. dll. For example:

;Name Path Memory Type
;------- --------------------------------------- --------- ------
device.exe $(_FLATRELEASEDIR).exe NK SH

The device module is loaded into the memory area. In Windows CEOs, device.exe has system and implicit attributes.

(3) memeory part

The physical memory is divided into two parts: Data Storage zone and program storage zone. For example

;Name Start address size(bytes) Type
;------- -------------- ------------ --------------
NK 80200000 00600000 RAMIMAGE
RAM 80800000 00800000 RAM

In Windows CE, memory is divided into three types: Ram, ramimg, and reserved. Ram specifies the memory size; ramimg specifies the ROM space; reserved indicates the reserved memory space, which cannot be used by the kernel, but can be accessed by applications. The preceding example shows that the starting address of NK is 80200000, which occupies 6 MB of memory space and is used as the ROM in the data storage area. Ram occupies 8 MB of memory at the beginning of 80800000 and is used in the program storage area.

(4) config Section

This part is not mandatory. In this section, perform some attribute settings, such as whether to compress and Rom size.

2.2 registry file. Reg

Registry file to create the registry entry for the operating system image. The registry stores a large amount of configuration information, including application information, device driver configuration, system configuration information, user parameters, and other related data. When the target platform is cold-started, makeimg.exe uses the. reg file to create the default registry. Platform. Reg configures registry information related to the platform, such as the device driver entry. Project. Reg sets the project-related registration form. Registry File Format:

[HKEY_LOCAL_MACHINE]
“Launch10” = "shell.exe"
"Launch20" = "device.exe"
"Launch30" = "gwes.exe"
"Depend30" = "hex:14,00"

The preceding registration table entry rules define that the kernel automatically runs the shell.exeand device.exe modules at startup. The GWES. EXE module can only run after device. EXE is started normally.

2.3 database file. DB

Windows CE provides a built-in lightweight database management system. The Windows CE attribute database consists of a table containing records. Each record contains many different attributes. Each attribute has three types of information: ID number, type, and value of the Flag attribute. For example:

.Record:
Field:402001f:“{000214A0-0000-0000-C000-000000000046}”
Field:42020003:15
Field:42030003:2
End

Attribute Database is a flat structure and cannot define the relationship between attribute databases. Using Microsoft ActiveX Data Object for Windows CE (adoce) technology, you can access the Attribute Database in capacity, or even use SQL statements to query information.

2.4 directory Allocation Table file. dat

The. dat file defines the Directory and file structure of the Windows CE image NK. Nib blacklist. Note that winodws ce does not support drive letters like Windows 9x/2000 and does not have the concept of the current directory. For example:

root:-Directory("Program Files")
Directory("Program Files"):Directory("MY Work")
root:-Directory("My Documents")
Directory("My Documents"):-File("MyFile.doc")

Generate two root directories: program files and mydocuments. Program Files has one subdirectory: my work. The myfile. DOC file is located in the my document directory. Note that myfile. doc must appear in A. bib file. In this way, myfile. Doc will appear in the image file.

3. Set environment variables and generate the image file NK. Bin

3.1 set Environment Variables

All configuration files contain the condition statement if enviroment value ...... End if. When the condition is set, the information between If and end if is included in the NK. bin of the image file. If the condition is not set, the related modules and files are not included. You can add or delete modules and components in NK. bin by setting environment variables. Take the. bib file as an example:

;Name Path Memory Type
;-------- ------------------------------------ ---------- ------
IFIMGUSB
IF CEPC_UHCI
uhci.dll $(_FLATRELEASEDIR).dll NK SH
ENDIF
IF CEPC_OHCI
ohci.dll $(_FLATRELEASEDIR).dll NK SH
ENDIF
usbd.dll $(_FLATRELEASEDIR).dll NK SH
usbhid.dll $(_FLATRELEASEDIR).dll NK SH
ENDIF

Here imgusb, cepc_uhci, and cepc_ohci are logical environment variables. In Pb, you can set environment variables in two ways. Method 1: Click setting… in the platform menu ..., In the Platform Settings dialog box, enter variable and value to set the environment variables. Method 2: Click Open build release directory in the build menu to open the Command Prompt window and set the environment variable in the Command Prompt window. Enter setimgusb = 1 in the command line. The dynamic link library usbd. dll and usbhid. dll are included in the image file NK. Bin. Whether uhci. dll and OHCI. dll are included in NK. Bin depends on the environment variables cepc_uhci and cepc_ohci. If set imgusb = 0, kN. Bin does not contain the above four dynamic link libraries.

3.2 makeimg.exe Tool

Generating the image file NK. Bin is the last step in the platform creation process and the final goal of Windows CE configuration. Makeimg.exe combines the target module and file into a unique Windows CE image file NK. Bin using all the configuration files. Figure 1 shows the process of NK. Bin generation.

  

Steps for makeimg to generate NK. Bin:

① Complete and configuration files: All. bib files are merged into Ce. bib. CE. bib contains the image NK. all files in Bin; All. merge the reg file into reginit. int; All. when you merge DAT files to modify the configuration file, you must pay attention to CE. bib, reginit. INI, initobj. dat, initdb. INI is an inter-file. You cannot configure Windows CE to modify these files.

② Compress the reginit. ini file into a binary file default. FDF.

③ Replace the resources in the module according to the environment variable country, so that the Windows CE image meets the needs of specific languages, and finally generate the binary image file NK. Bin.

4. modify the configuration file and add the rtl8139 NIC Driver.

Because Windows CE has a completely different kernel from other Windows operating systems, device drivers running on other operating systems cannot run directly on Windows CE. The driver code of the original device must be modified or overwritten to run on Windows CE. Windows CE supports two types of device drivers: local device drivers and stream interface device drivers. The driver of the local device is usually closely connected to the Target Platform Based on Windows CE, and the driver of each local device has precise and special targets, these drivers are generally provided by the original device manufacturer (OEM. The stream interface device driver is a user-level dynamic link library (DLL) used to drive the executable peripheral mayor. The rtl8139 NIC driver is a stream interface device driver. Use platform builder or embedded Visual C ++ 3.0 to generate rtl8139 NIC Driver rtl8139.dll. In (_ flatreleasedir), modify platform. bib and platform. Reg respectively.

① Add the following statements to the platform. bib file:

MEMORY
RTL8139 8090000 00010000 RESERVED
MODULES
Rtl8139.dll $(_FLARTELEASEDIR).dll NK SH

② Add the following statements to platform. Reg:

[HKEY_LOCAL_MACHINE]
"Displayname" = "RealTek rtl8139 Based Fast
Ethernet driver"
"Group" = "NDIS"
"ImagePath" = "rtl8139.dll"
[HKEY_LOCAL_MACHINE]
"Route" = "rmulti_sz: tl81391"
[HKEY_LOCAL_MACHINE]
"Displayname" = "RealTek rtl8139 Based Fast Ethernet driver"
"Group" = "NDIS"
"ImagePath" = "rtl8139.dll"
[HKEY_LOCAL_MACHINE]
"Busnumber" = DWORD: 0
"Bustype" = DWORD: 5
"Scanmethod" = DWORD: 0
"Sharedinterrupt" = DWORD: 1
"Physicaladdressbase" = DWORD: 001a0000
[HKEY_LOCAL_MACHINE]
"Enabledhcp" = DWORD: 0
; Multi_sz type
"DefaultGateway" = ""
; 0 indicates the broadcast address (or broadcast bandwidth 255.255)
"Usezerbroadcast" = DWORD: 0
; Nulti_sz type, IP address
"IPaddress" = "202.2.4.77.16"
; Multi_sz type, the subnet mask of the above IP Address
"Subnetmask" = "255.255255.0"
[HKEY_LOCAL_MACHINE]
"Bind" = multi_sz: "rtl81391"
③ Makeimg generates NK. Bin

In the Command Prompt window, enter the makeimg command to generate a new Windows CE image NK. Bin. Download NK. bin to the target platform and connect the network card of the Development workstation to the rtl8139 network card of the target platform through the ethernet cable. The IP address of the frtl8139 Nic must be in the same subnet as the IP address of the Development workstation. In this way, a response is returned when the workstation starts to run the ping command.

5. Summary

The integrated development environment of Microsoft Windows CE platform builder contains a series of development tools, context menus, toolbar and shortcut keys. Platform builder creates, tests, and crops Windows CE platforms and components. Skilled in using the configuration files and Development debugging tools provided by platform builder, you can quickly customize the Windows CE operating system suitable for the target platform and shorten the platform development cycle. Modify and set the configuration files. bib,. Reg,. dat, And. dB of platform builder to crop and add related components, and correctly configure various device drivers. Windows CE is generally used in a specific embedded system. In many cases, you need to add external devices and device drivers to the target platform. This article adds the rtl8139 NIC Driver to Windows CE by modifying the platform. bib and platform. Reg configuration files. After the software and hardware environment of Windows CE is developed, the workstation is inserted into the PCI slot of the target platform, and the workstation starts to download the image file NK by inserting the ne2000 compatible Nic In the target platform. bin to the target platform. After Windows CE is started, the network cable is changed to the rtl8139 Nic. The development workstation and the Target Platform communicate normally using the PPP protocol.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.