1. Configure and debug the hardware and software environment of WindowsCE. one high-performance development workstation and one target debugging device are required. PlatformBuilder4.2 runs on a high-performance development workstation of Windows2000 or later. PlatformBuilder provides an integrated development environment for creating and debugging WindowsCE NK ing NK. BIN, such
1. to configure and debug Windows CE software and hardware environment, one high-performance development workstation and one target debugging device are required. Platform Builder 4.2 runs on a high-performance development workstation of Windows 2000 or later. Platform Builder provides an integrated development environment for creating and debugging Windows ce nk ing NK. BIN, such
1. Configure
Windows CE hardware and software environment configuration and debugging requires one high-performance development workstation and one target debugging device. Platform Builder 4.2 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), etc, provides compilers, kernel debuggers, and various remote debugging tools for supported processors. 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: Ethernet connection, fast download speed, and slow download speed. The development workstation requires an Ethernet NIC, and the target platform requires NE2000-compatible debugging of Ethernet NIC serial ports, parallel port image files, and debugging tools. Both use Ethernet image files for parallel port download, debugging information of the target platform is transmitted through a serial port.
2. configuration file provided by Platform Builder 3.0
Configuration files include Binary Image Generation files. BIB, registry file. REG, directory and file configuration 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 the following table.
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 wce%fe. reg wce%fe. dat wce%fe. db
Config. bib Script 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 cmd(_flatreleasedircmd.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. 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 intermediate 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 streaming interface device driver is a user-level dynamic link library (DLL) used to drive installable peripheral components. 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.