Home > Articles > Operating Systems, Server

Running Windows CE on a CEPC

Running Windows CE is not as straightforward as creating a new platform and project. This task requires two separate operations. The final build of Windows CE, also referred to as the image, must be uploaded to the target platform first. Next, the kernel debugger built into the Platform Builder IDE must connect with the debug kernel on the target. There are several ways to upload an image and debug it. For starters, we will focus on uploading via the parallel port and debugging over the serial port. These methods are supported on all versions of Windows CE, including those that use the early version of Platform Builder called the Embedded Development Kit (EDK).

How does one upload the image to that target platform? You'll need a bidirectional enhanced parallel port (EPP) on both sides of the equation: the workstation and the platform. It is a good idea to make sure that the parallel port is in EPP mode by checking the settings in the system BIOS. The parallel port cable itself must be tweaked a bit. First you'll need a male DB25 connector at both ends. Next, the cable itself must be wired as shown in Table 3.3. You can order such a cable from a variety of vendors, but it's not difficult to make one yourself. Start with a regular parallel port cable and add an expansion box with the appropriate pins soldered to meet the requirements in Table 3.3. If you don't have an EPP-compatible port on the workstation or the CEPC target, you can buy a plug-in ISA card that supports an EPP-compatible port. The EPP-compatible port is jumper configurable on these cards. Be sure to avoid conflicts with your regular parallel port in the workstation or CEPC.

Table 3.3  CESH Parallel Port Cable Pin Connections

Pin

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

Pin

10

2

3

4

5

6

7

8

9

1

14

16

17

11

12

13

18

19

20

21

22

23

24

25


The serial connection used to debug the kernel is fortunately quite straightforward, simply requiring a serial cable. Once both connections have been set up, you are ready to upload.

An upload is carried out via the Windows CE Debug Shell Tool (CESH). CESH is capable of uploading images to the target via several transports, including serial and Ethernet. For the exercise we are conducting, we have already decided to use CESH's parallel port capabilities.

To use CESH to upload the image, we must first start a command prompt. Platform Builder provides a convenient way to create a command prompt and change directory to the release directory for the platform under development with a few simple mouse clicks. From the Build menu, select Open Build Release Directory. This selection will launch a command prompt in the release directory of the platform. The release directory of a platform refers to the repository for the final phase, \WINCE212\PUBLIC\ADAM\RELDIR\X86_DEBUG. This directory contains the final Windows CE image to be uploaded to the target. The image is called nk.bin and must be sent to the target in its entirety. This is accomplished by the following command:

Cesh -p CEPC Nk.bin

The -p option of CESH indicates the profile that CESH must use. In this case, the profile is called CEPC. Profiles for CESH are set up in the registry by the Platform Builder installation procedure. The CEPC profile urges CESH to use the parallel port with some predefined settings that configure the parallel port protocol. When using this profile, CESH starts passing nk.bin, chunk by chunk, to the parallel port. The parallel port base address and interrupt level are assumed to be the default values for LPT1 (base address 0x378 and IRQ 7). Should this change on your workstation, you must edit the CEPC profile directly to reflect the changed parallel port settings. To change these settings, you must change the registry values shown in Listing 3.1.

Listing 3.1  CESH registry settings

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ppsh\CEPC:
InterruptLevel = REG_DWORD 7
InterruptMode  = REG_DWORD 1
InterruptVector = REG_DWORD 7
PortAddress   = REG_DWORD 0x378

On a CEPC, at the other end, a tool called Loadcepc communicates with CESH to receive pieces of the operating system image and then loads and boots the operating system. You must start by creating a bootable floppy, preferably with MS-DOS 6.22, and put loadcepc.exe on it. This floppy disk should be used to boot the CEPC. Loadcepc is available in Platform Builder, and its source code is in the CEPC platform directory. Once the two utilities start to communicate, a progress bar indicates the portion of the image that has been transferred successfully between the workstation and the CEPC (Figure 3.11). After the entire image has been uploaded, Windows CE will boot on the CEPC.

Figure 3.11 Uploading an image using CESH

Kernel Debugging

The Platform Builder IDE has a built-in kernel debugger. You can launch this debugger by selecting the Build | Start Debug | Go menu item or by hitting the F5 key. The kernel debugger displays its output in the IDE output window under the Debug tab. You can view the output window by selecting the View | Output menu item. Then select the Debug tab.

Like downloading, debugging can occur over an Ethernet connection. It can also occur over the serial port. We'll choose the latter because it is easy to set up and use. A simple serial cable (not null modem) will do the trick. You can improve the debugger throughput by increasing the speed at which the debugger and target platform communicate over the serial port. On the workstation, select Build | Debugger | Remote Connection to view the Remote Connection dialog box. In the Connection list box, you must select Kernel Debugger Port and then click on Settings... (see Figure 3.12).

Figure 3.12 Setting the kernel debugger port's speed

At the other end, the change in the default speed of the serial connection must be passed on Loadcepc. This is accomplished with the /B:115200 option. In addition, if you are using the S3 display drivers that are bundled with the CEPC, you must instruct Loadcepc to initialize the display adapter in 640_480 mode. This is done via the /D:2 option. Finally, Loadcepc must be told to expect the image to come down the parallel port, with the /P option.

Loadcepc /B:115200 /D:2 /P

You can request Loadcepc to use the serial port to download the binary image, provided that you set up CESH to do the same on the workstation. In this case, you specify the /Q option. The COM port to be used by Loadcepc is identified with an additional option, /C:{1 | 2}.

After you initiate the kernel debugger, the first messages in the debug window announce the handshaking between the debugger and the target:

Kernel debugger waiting to connect on com1 at 115200 baud
Host and target systems resynchronizing...

When the debugger is started, you may get the erroneous error message shown in Figure 3.13. You can safely ignore this message. The IDE is simply trying to find an updated copy of welcome.exe in the wrong release directory, a throwback from the days of the Embedded Development Kit (EDK).

Figure 3.13 Error message when the debugger is started

Let's review what we've done so far:

  1. Created a new platform, Adam, based on the MAXALL configuration

  2. Created a simple new application for Adam called welcome.exe that displays a "Hello World!" message in a dialog box

  3. Connected the workstation and CEPC for downloading over the parallel port and debugging over the serial port

  4. Downloaded the operating system image to CEPC and watched it boot on the CEPC

After the last step is completed, you should see a Handheld PC–like shell pop up, complete with a Windows CE task bar. Let's take our configuration for a spin. Select the Start button and then click on Run.... In the Run dialog box, type in "welcome.exe" and then click on OK. The shell will attempt to execute welcome.exe, a request that will be translated in the inner layers of the kernel into a request from CESH to load welcome.exe from the release directory on the workstation:

KernelLoader: Using PPFS to load file welcome.exe

PPFS stands for Portable Parallel File System, which supports loading on demand. On the target platform, you should see welcome.exe running and greeting the world in a dialog box. You can close welcome.exe by right-clicking on its icon in the task bar and selecting Close.

You can try out our rapid development technique by stopping the debugger, making a change to the string displayed by Welcome, and then building the project, restarting the debugger and executing welcome.exe from the Run dialog box on the target.

Debugging Capabilities of CESH

CESH is more than just a downloading utility. It is called the Windows CE Debug Shell Tool for a reason. After the download is over, CESH gives you a command prompt. You can type in a variety of commands at the prompt to get useful information from the kernel running on the target platform. Typing "?" retrieves a list of all the commands supported by CESH (see Table 3.4).

Table 3.4  Commands Supported by CESH

Command

Options

Function

break

 

Stops the kernel at the current line of execution. This command can be used to halt the kernel and set a new breakpoint.

dd

addr [<size>]

Displays the contents of addr. The optional size argument tells the command how many bytes to display.

df

filename addr

Writes contents of addr to the file specified by filename.

 

[<size>]

The optional size argument tells the command how many bytes to display.

dis

 

Tells the virtual memory manager to mark all discardable memory as available.

gi

proc

Lists all the processes running on the target. Processes are created from executables by the operating system.

 

thrd

Lists all the threads running on the target. A process may have multiple threads.

 

mod

Lists all the modules loaded on the target. Modules are DLLs that are loaded by executables. Device drivers are DLLs loaded by device.exe (mostly); as such, they appear under the modules' listing.

 

all

Lists processes, threads, and modules. This is the default value for the gi command.

kp

pid

Kills the process with process ID pid.

mi

kernel

Displays detailed information on memory used by the kernel.

 

full

Displays memory maps used by all processes and modules in the system.

run

filename

Runs the file specified by filename in batch mode.

S

process

Starts a new process. This command is useful when you don't have a user interface on the target platform that can be used to start a process. The s command can also be used for rapid development because it supports load on demand via PPFS.

zo

 

Displays and modifies debug zones for a process or module. This command is discussed in more detail in Chapter 9.


After booting Adam successfully on a CEPC, you can run the gi command from the CESH command prompt and observe output similar to that shown in Listing 3.2. When executing welcome.exe, you will notice it listed as a process. The gi command prints out information that is used not just for debugging, but also for indexing other commands. For example, the process or module index, a number prefixed by either P or M, is passed to the zo command to identify the entity whose debug zone is being displayed or modified. Debug messages emitted by the kernel are prefixed with the address of the line that originated the message. You can map these addresses by looking at the pModule field of a module in the output of gi.

Listing 3.2 shows the processes running on the target platform. The file nk.exe is the Windows CE kernel process, filesys.exe manages the CE file system, the debug shell that communicates with CESH is shell.exe, device.exe loads and manages all the device drivers on the target platform, gwes.exe is responsible for creating and managing windows and messages, and finally, explorer.exe is the Handheld PC–like shell included in our image.

Listing 3.2  Running the gi command in CESH

Windows CE>gi
PROC: Name      hProcess: CurAKY :dwVMBase:CurZone
THRD: State :hCurThrd:hCurProc: CurAKY :Cp:Bp:CPU Time
 P00: NK.EXE     00ffefe2 00000001 02000000 00000100
 T  Blockd 00ffdefe 00ffefe2 00000001 3 3 00:00:00.000
 T  Blockd 00ffe012 00ffefe2 00000001 7 7 00:00:00.082
 T  Blockd 00ffe31e 00ffefe2 ffffffff 2 2 00:00:00.005
 T  Blockd 00ffef1a 00ffefe2 00000001 1 1 00:00:00.063
 P01: filesys.exe   00ffdaf6 00000002 04000000 00000000
 T  Blockd 00ffdb16 00ffdaf6 00000003 3 3 00:00:01.491
 P02: shell.exe    00ffbd42 00000004 06000000 00000001
 T  Runing c0ffc942 00ffbd42 ffffffff 1 1 00:00:02.965
 P03: device.exe   00ffb70a 00000008 08000000 00000000
 T  Sl/Blk 00eb5366 00ffb70a 00000009 2 2 00:00:00.081
 T  Blockd 00ff517e 00ffb70a 00000009 3 3 00:00:00.001
 T  Blockd 00ff551a 00ffb70a 00000009 3 3 00:00:00.004
 T  Sl/Blk 00ff7d56 00ffb70a 00000009 2 2 00:00:00.001
 T  Sl/Blk 20ff98ce 00ffb70a 00000009 2 2 00:00:00.132
 T  Blockd 20ff98ee 00ffb70a 00000009 2 2 00:00:00.000
 T  Blockd 00ffb72a 00ffb70a 00000009 3 3 00:00:03.026
 P04: gwes.exe    00fd626e 00000010 0a000000 00000040
 T  Blockd 00f60e02 00fd626e 00000011 3 3 00:00:00.029
 T  Blockd 00f6200a 00fd626e 00000011 3 3 00:00:00.014
 T  Blockd 00f6230e 00fd626e 00000011 1 1 00:00:00.000
 T  Blockd 00f625f2 00fd626e 00000011 1 1 00:00:00.004
 T  Blockd 00f62a56 00fd626e 00000011 1 1 00:00:00.193
 T  Blockd 00f62b6a 00fd626e 00000011 1 1 00:00:00.046
 T  Sl/Blk a0f74386 00fd626e 00000011 1 1 00:00:00.291
 T  Sl/Blk 00fd628e 00fd626e 00000011 3 3 00:00:01.029
 P05: explorer.exe  00f60c5a 00000020 0c000000 00000000
 T  Blockd 40ea6c02 00fd626e 00000031 3 3 00:00:01.769
 T  Blockd 00eb572a 00fd626e 00000031 3 3 00:00:04.446
 T  Blockd 00f60c7a 00f60c5a 00000021 3 3 00:00:00.430
 MOD: Name      pModule :dwInUSE :dwVMBase:CurZone
 M00: unimodem.dll  80eb5584 00000008 01160000 0000c000
 M01: TAPI.DLL    80eb5ec0 00000008 01180000 0000c000
 M02: SHLWAPI.dll   80f4e640 00000020 01060000 00000000
 M03: IECEEXT.dll   80f4e810 00000020 01090000 00000000
 M04: WININET.dll   80f4ed40 00000020 00f70000 0000c000
 M05: imgdecmp.DLL  80f4ef44 00000020 00ed0000 00000000
 M06: webview.dll   80f493ec 00000020 00e20000 00000000
 M07: commctrl.dll  80f49c28 00000020 01520000 00000000
 M08: CEShell.DLL   80f49ef8 00000020 00ef0000 00000000
 M09: OLEAUT32.dll  80f60358 00000020 01390000 00000000
 M10: ASForm.dll   80f627c8 00000020 00f50000 00000000
 M11: kbdmouse.dll  80f62d78 00000010 00d20000 00000000
 M12: DDI.DLL     80fd6b80 00000010 00d30000 00000003
 M13: Redir.dll    80ff50c0 00000008 01110000 0000c001
 M14: irdastk.dll   80ff6b78 00000008 011a0000 00008000
 M15: netbios.dll   80ff76ec 00000008 010f0000 0000c000
 M16: dhcp.dll    80ff7840 00000008 01220000 0000ffff
 M17: arp.dll     80ff7a20 00000008 01290000 00000001
 M18: tcpstk.dll   80ff8250 00000008 011d0000 00000001
 M19: ppp.dll     80ff8800 00000008 01340000 00000000
 M20: CXPORT.dll   80ff89a0 00000008 01330000 0000c000
 M21: AFD.Dll     80ff8c88 00000008 012a0000 00000000
 M22: ole32.dll    80ff8f88 00000028 013d0000 00000000
 M23: softkb.DLL   80ff9320 00000008 01500000 00000000
 M24: WINSOCK.dll   80ff95a0 00000028 01310000 0000c000
 M25: IRCOMM.DLL   80ff971c 00000008 01320000 0000c003
 M26: irsir.dll    80ff9e74 00000008 00ce0000 0000c000
 M27: NDIS.Dll    80ffa6bc 00000008 01270000 00000000
 M28: msfilter.dll  80ffa810 00000008 00cb0000 00000000
 M29: CEDDK.dll    80ffaef0 00000018 00da0000 00000000
 M30: Serial.Dll   80ffb020 00000008 00cf0000 00000000
 M31: toolhelp.dll  80ffbf68 00000004 015a0000 00000000
 M32: coredll.dll   80ffe690 0000003f 015e0000 00000000
Windows CE>

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020