Windows CE simulators and remote debugging tools

Source: Internet
Author: User

This article mainly describes how to use the remote debugging tool and uses the simulator of Pb (Microsoft platform builder) for testing.

 I. Simulator

Emulator is a part of Pb. It is used to debug the kernel and Applications created under Pb. The simulator can simulate a Windows CE physical platform in a PC. But in fact it is just a user program running at the CPU Ring Level 3. Therefore, its running speed is slower than that of a normal physical platform. The simulator only supports the X86 platform. It can only debug the "emulator: x86"-Based Kernel and all programs compiled using the x86 instruction set. The simulator has many limitations that allow it to run only simple applications. But one thing is good. Most of the operating system's APIs are the same for any CPU. In consideration of simple programs that are not affected by the CPU type, debugging can still be performed on the simulator. In actual development, I only use the simulator to debug the software interface. If you want to learn Pb and use it to create the kernel without debugging the actual physical platform, the simulator is very suitable. But there are many limitations on the simulator, so even if you have debugged all the kernel features (feature or components) that can be debugged under the simulator, what you have mastered is just the tip of the iceberg. By the way, petabytes of knowledge and the amount of Windows CE knowledge are like a vast ocean, which is much more knowledgeable than EVC software development. So if you only use EVC to develop a few software programs, you are still a first-year Windows CE professional student.


Figure 1 Simulator

Hardware restrictions on simulators: (from Windows CE help)

 

  1. Remote Call profiler)
    The Remote Call evaluation program contains evaluation and analysis tools. Use graphical images to show the efficiency or resource usage of algorithms in your code. The Remote Call evaluation program contains a series of interface functions. Call these interface functions in the code you want to evaluate and then run your program. By remotely calling the evaluation program, you can receive and record the data of your program. Finally, the image is displayed. Obviously, this tool is not often used. Especially the development of non-real-time kernels and software, coupled with the current embedded microprocessor processing speed has become very fast, the demand for a software performance evaluation will fade. Of course, if you want to, you can also study its interface functions if necessary, and then test it. I don't have the time. Microsoft provides the example program "hello ". If you install Windows CE on drive C, the path is:
    "C:/program files/common files/Microsoft shared/Windows CE tools/platman/SDK/wce410/samples/hello ".
    I compiled this program and tested it. Figure 2 shown in the Remote Call evaluation program.

    Figure 2 Evaluation Image
     

  2. Remote File Viewer)
    Remote File browsing is one of the most common and easy-to-use tools. It is used to import or export files to the actual platform. Assume that I am debugging a program for displaying bitmap. Bitmap allows you to select the bitmap. To debug the file in the simulator, you must first import the bitmap file to the simulator.
    After the simulator is opened, run the remote file browser program. A dialog box is displayed, indicating which platform you want to access. 3.

    Figure 3 platform selection dialog box

    Select "default device. The main window is displayed. 4. The number of directories on the left lists all the directories of the kernel running on the simulator. The right side is the file under the specified directory. The Import and Export buttons are on the rightmost side of the toolbar. The Import and Export here are relative to the development platform. In the following example, a bitmap file is uploaded to the simulator. Click the export button (up arrow) and select a bitmap file in the pop-up dialog box. After confirmation, the file appears in the file window on the right of the remote file browser program. The import process is also simple. Select a file, click the import button, select the path, and save the file.


    Figure 4 Remote File Browser

 

3. Remote Heap Walker)

Obviously, "Walker" cannot be translated into "View ". If you are willing to translate, just translate it. Here I am calling it for viewing, which is easy to understand. It can be seen from the name that it is used to view the heap used by each process in the operating system. I don't need to say anything about heap! Everyone knows about heap, but CE's knowledge about heap is worth mentioning. In the future, I will have an article devoted to process, thread, and memory management under CE, which will be very detailed at that time. You can use the remote heap viewing program to view the following information:

  • Name, ID, and Id of all the heap processes running in the kernel. 1.
  • The first address, end address, and flag (fixed, free) in a heap of the process)
  • Actual content of each block in the heap

  • Figure 1 Process List

    It is easy to view and use this tool. But the premise is that you know something about the heap. Next I will talk about the heap knowledge related to this tool. When each process starts under CE, the system will automatically allocate a local heap of KB to this process. If it is not enough, you can call the heap management function to reallocate the custom heap size. The heap allocated by yourself, including the heap allocated by the system, are identified by IDs. Heap ID shown in. Process ID and process name are not required. The following "flag" has only one value "hf32_default", indicating the heap allocated by the system by default. The device.exe "in the figure is the same for all four. However, we can see from the process ID that this is a process, rather than the four instances of an application. The reason is that the four heaps are allocated to the device.exe group, and the four are displayed.
    Double-click any item in the list to display the list of blocks contained in the heap. Lists the first address, size, and flag of a block. If we allocate a heap, we can allocate arrays and structures in the heap. This block refers to each allocated element. "Fixed" indicates that the memory occupied by this block cannot be released. On the contrary, "free" means that the memory occupied by this block can be released. If you see this, you may have a question: Who did you see it? Who released it? This involves memory management and kernel OOM components. I will give a detailed explanation in future articles.
    Click each block. The specific data of the block is displayed in the pop-up list (in ASCII format ).

    4. Remote Kernel Tracker)

    The remote kernel tracing program is used to track the running status of the kernel on the actual platform. Generally, it is used to track the startup status of the kernel, collect relevant data, and display the data in charts on the development platform. 2. This program can track all processes and all threads in the process. Tracing starts from running. the end time of tracing is determined by the size of the Data receiving buffer. The buffer size ranges from 1 MB to 100 MB. The trace content is the process running, not running, thread running, blocking, and sleep. There are also all synchronization events in the thread. On the right side of the program, there are icons corresponding to all events that can be tracked.
    To track the startup status of a kernel (this program can be used to track all processes and threads after startup), you must first make sure that the kernel you want to track has several features. In the Pb menu "Platform"-"Settings"-"build options", select "enable event tracking during boot" and "enable profiling ". Then re-compile the entire kernel. (Note that errors may occur when Pb is compiled. If this happens, re-build the kernel)
    After the compilation is successful, open the remote kernel tracing program and press "OK" in the pop-up platform selection dialog box (this figure is included in the previous article ", click Download/initialize in Pb to call up the simulator. After a while, the remote kernel tracing program will record all the situations that occurred during the startup and display them. The thread running, sleep, or congestion during which time, including which interrupt occurred, is recorded. The disadvantage is that the data volume is too large. This program provides the search and filter functions. The search function allows you to find the events you want, And the filter function allows this program to only record the events you want. You can also save the record data. Save it to a file with the extension ". CLG.
    I can only talk about this tool so much that it is rarely used at ordinary times.


    Figure 2 tracking

    5. Remote Performance Monitor)

    You must be familiar with the interface of this program. Similar to the Performance Monitor interface attached to other Windows operating systems. 3. The operation is almost the same.


    Figure 3 Performance Monitoring Program

    It can monitor remote access server (RAS), Internet Control Message Protocol (ICMP), TCP/IP, user datasync protocol (UDP), memory, battery, system, process, and thread.

    6. Remote Process Viewer)

    This program has three windows, showing all processes in the current kernel, threads in the process, and all loaded DLL in the process. In the displayed process window, the process name, process ID, basic priority level, total number of threads, base address, access key value, and main window name are displayed respectively. In the display thread window, the thread ID, current process ID, thread priority, and access key are displayed respectively. In the displayed DLL module window, the module name, module ID, current process usage count, global usage count, base address, size, module handle, and path are displayed respectively. The following describes the "current process ID" in the thread window ". It is strange that the current process ID is different! The thread window should display all the threads in the current specified process. How can I have different process IDs? Because ce has nothing to say in help, please let me imagine that the notebook is a subsystem of graphics, windows, and events. It is responsible for graphics, windows, and window messages. The worker er.exe thread calls "coredll. dll" in the display window and when sending and receiving messages (This dll will be described later). This dll calls the graphics, window, and event modules. These are the drivers (dll.pdf, which are loaded and managed by gwes.exe. The current progress is as follows: gwes.exe ". This can only be explained at present.


    Figure 4 Process Browser

    7. Remote Registry Editor)

    This program is very similar to the Registry Editor in other Windows operating systems. However, it can display and compile the Registry on the development platform and the Registry on the actual platform. 5. I will not talk about the specific operations. The restrictions on the registry under CE are also mentioned.


    Figure 5 Registry Editor

    8. Remote message Monitoring Program (Remote spy)

    This program is very similar to the tool spy that comes with VC. Lists windows and window messages on all platforms. I don't think I need to talk about this program. Familiar with the tool under VC, you can operate this tool. Interface 6.


    Figure 6 Message monitoring page

    9. Remote System Information)

    This tool can view the system information of the actual platform, including hardware and software information.

    Figure 7 system information

    10. remote zoom-in)

    This tool captures the actual screen image of the platform. This tool is most suitable for writing instructions. If a product is to be pushed to the market, instructions or demos must be prepared. Put this program in the manual or demo program. Click "file"-"New bitmap ". I will not provide the interface for this program.

    Summary

    Ten remote tools provide us with great help in developing kernels and applications. Obviously, some tools are rarely used, and some tools are commonly used. For the Registry Editor, you can download the source code and programs on some embedded websites. Bringing the Registry Editor to the kernel is more effective and time-saving. Among the 10 tools, the most handsome is the kernel tracing program. Through the kernel tracing program, the entire kernel startup process is clearly visible. You can also use it to monitor your applications. I tried these 10 remote debugging tools on the simulator. To debug the actual platform, you must first connect the development platform to the actual platform through the serial port and nic. Set it in "target"-"configure remote connection. The actual device is better equipped with a nic, and the serial port speed is too slow. For more information, see the Help file.

     

  • Only network support can be provided by simulating the DEC 2114x NIC Driver. Other Nic drivers are not supported.
  • Only the flat display driver can be simulated. Other display drivers are not supported.
  • USB devices not supported
  • PC Card, hard disk, and CF card are not supported.
  • The format of fat, CDFs, and DVD files is not supported.
  • Ieee1394 devices are not supported.
  • Configurations of the Development Platform Using Simulators recommended by Microsoft:

  • 1 GHz CPU
  • 384 Mb system memory
  • 500 mb available hard disk space
  •  2. Create a kernel and download it to the simulator.

    To test the remote debugging tool, we must first use Pb v4.1 to create a kernel:

    1. Create a kernel using the new kernel Wizard: click "new platform" in Pb, and select "emulator: x86" in "available BSPs" in "Step 2 ", then select a pre-defined Kernel configuration in "available configurations" in "Step 3". These pre-defined kernel configurations are targeted. Select "Internet appliance ". Note: Some predefined kernel configurations come with Shell programs, while others do not. After selecting the project name, enter the project name (such as Internet) and Project SAVE path. The default "Step 4" option removes all check boxes in "Step 5. Because we only need the kernel and shell. Remove all check boxes in Step 6. Click "done.
    2. Compile the new kernel: In the menu "Platform"-"Settings"-"environment", click "new" and add the variable name "imgram64" and value "1" in the pop-up dialog box ". Click "build"-"build platform" to start compilation. The specific Compilation Time has a lot to do with your machine configuration.
    3. Configure the simulator: After compilation is successful, click "target"-"configure remote connection", find the "Download" drop-down box in the pop-up dialog box, and select "emulator ", click "Configure". In the displayed dialog box, set the resolution to 800x600 or 640x480. The system memory is set to 64 MB. Click "OK" and select "emulator" in the "kernel" drop-down box ". Click "OK ".
    4. Start the simulator: click "target"-"Download initialize ". Wait a moment, and the simulator will come out. You can see the interface of the standard shell, that is, the desktop.

    Compile an application in Pb and download it to the simulator:

    1. When you open the kernel Project (if you just open Pb, open a kernel project first ). Click "file"-"New project or file" in the Pb menu ". I don't need to talk about the remaining steps. Just like EVC, you can add a project name to encode it. Only does not support MFC or ATL. Select an SDK program that displays "Hello World. Click "build"-"build all" to compile the program. I generally do not develop software under Pb. Trouble!
    2. When the simulator is enabled, click "target"-"run programs", find your program name, and then click "run ". You can see your program on the simulator.
    3. Close Operation: first shut down the simulator. Click "target"-"Disconnect ".

     Iii. Remote debugging tools

    The remote debugging tool is used to perform debugging between the development platform and the actual platform. Remote debugging tools can be used to run on the development platform, obtain files on the actual platform, monitor the status of processes or threads on the actual platform, and test the performance of applications on the actual platform. Some remote debugging tools are often used in application development, while others are often used in kernel development. For remote debugging tools that are not commonly used, I will only give a brief introduction here.

    Related Article

    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.