Design Document For
Total Page:16
File Type:pdf, Size:1020Kb
Author: LiXizhi All work copyright © Shenzhen Tech-Innovation International Design Document for: - MicroWindows Extension: A cross-platform GUI library for Win32 and Linux - Using MicroWindows as device-independent high-level windows-drawing API - Porting a device-independent GUI library from Linux edition (MicroWindows) to Win32 - MicroWindows embedded-hardware device simulator: for ease of software development and debugging on embedded systems. Document No.1 “For the Wearable DVD project at HIT” CONFIDENTIAL All work Copyright ©2004 by LiXizhi, HIT Written by LiXizhi Email: [email protected] Version # 1.00 Wednesday, August 11, 2004 Version history: 2004-7-5 Author is involved in the project 2004-7-8 Project release 1.0 finished 2004-7-9 Documentation reviewed and finished Author: LiXizhi All work copyright © Shenzhen Tech-Innovation International Summary Software debuggers are not only essential for successful Soc architecture exploration and benchmarking, but also the key to late user application development on Soc systems. For the former part of software debugging, both hardware and software are involved to perform a certain debugging technique such as probing brought out by I/O pins and various scan technologies with software support on a host computer. However, when it comes to user application development based on a specific Soc design, there are usually no standard software debugging principles to follow. Usually, no further tools are created for this purpose, and one of the former hardware-software debugging techniques is used. However, user application focuses more on functionality and Graphic User Interface (GUI) development than on probing into the internal states of Soc circuit. Moreover, on-chip debugging is both expensive and time-consuming; a shorter edit- run-debug cycle is preferred. Sometimes, a cross-compiler is developed, so that user application developers can at least compile their code in a standard familiar host environment. Even so, real-time software debugging is not possible if without developing high-level software simulation kits dedicated to a certain Soc design. This article provides the details of a simulation kits design with video output and remote controller (keyboard) input. Any user applications based on this specific Soc can be developed, run and full-debugged all through software environment and in a familiar host IDE such as Visual Studio and Linux KDE. It may provide a useful guide for Soc software developers who are developing GUI applications based on a non-standard Soc system. Content 1 INTRODUCTION ________________________________________________________________ 3 1.1 BACKGROUND ________________________________________________________________ 3 1.2 SHORT OVERVIEW _____________________________________________________________ 3 2 MICROWINDOWS EXTENSION __________________________________________________ 4 2.1 IDENTIFYING THE EM85XX ARCHITECTURE. _________________________________________ 5 2.2 PORTING MICROWINDOWS: A DEVICE-INDEPENDENT GUI LIBRARY _______________________ 5 2.3 USER-DEFINED SCREEN DEVICE DRIVER INTERFACE ___________________________________ 9 2.4 USER-DEFINED KEYBOARD DEVICE DRIVER INTERFACE________________________________ 10 2.5 MAKING THE KEYBOARD DRIVER ________________________________________________ 11 3 MICROWINDOWS EMBEDDED-HARDWARE DEVICE SIMULATOR ________________ 11 3.1 INTRODUCTION ______________________________________________________________ 11 3.2 MWINSIMULATOR ARCHITECTURE _______________________________________________ 12 3.3 USER INTERFACE DESIGN_______________________________________________________ 13 3.4 MULTI-THREADING ___________________________________________________________ 13 3.5 SCREEN DRIVER ______________________________________________________________ 13 3.6 KEYBOARD DRIVER ___________________________________________________________ 13 3.7 FIP REMOTE CONTROL SIMULATION FOR EM85XX ____________________________________ 14 3.8 GSSELECT() EVENT SELECT FUNCTION ____________________________ 错误!未定义书签。 4 SAMPLE APPLICATIONS _______________________________________________________ 14 4.1 SAMPLE APPLICATIONS FROM MICROWINDOWS DEMOS _______________________________ 15 4.1.1 MyProgram.cpp ___________________________________________________________ 15 4.1.2 NTetris.c _________________________________________________________________ 15 4.2 DVD PLAYER _______________________________________________________________ 15 5 SUMMARIZING AND STREAMLINING___________________________________________ 15 5.1 STREAMLINING SOFTWARE-BASED SIMULATIONS ____________________________________ 16 APPENDIX A: ______________________________________________________________________ 16 Confidential Page 8/11/20044 Author: LiXizhi All work copyright © Shenzhen Tech-Innovation International 1 Introduction 1.1 Background In July 2004, I took up the project of Wearable DVD during my visit to Shenzhen. The original development kid of Wearable DVD is em85xx [1] , which in turn uses (1) another third party development kits called MicroWindows[2] for its GUI and (2) UcLinux[3] for its kernel protocols. Before I was involved, the whole hardware development system with a flash simulator was established and the Linux software packages can be compiled. However, there was no software support for application development on em85xx, i.e. no software simulator was present. Each time, new source code needs to be compiled on a Linux computer, cross-compiled to em85xx ucLinux core, downloaded to a flash hardware, and tested with the actual hardware. This development cycle was immediately recognized by me as unviable. A new software development environment should be developed on the first place before any custom applications could be built next. It is under this motivation, I embarked on this project. A second motivation for me to carry on such a project is the observation of its potential to be used in the ParaEngine [4] . MicroWindows is a great tool for writing device independent graphic engine. It is written almost in clean C. I am planning to write my own graphic driver and use it in the 3D ParaEngine. A few months ago, Mitnick and I were designing 2D engine API that is similar to Windows Drawing API. The interface was designed by Mitnick; but due to other tasks, he did not get enough time to implement it. I therefore had to think of other ways to write a simple 2d engine. Currently the 2D engine in the ParaEngine has Bitmap and text only. There is no support for other drawing functions. However, it is critical to allow programmers to draw on a D3Dsurface, such as used in the map display of RPG games. Now that, I met with MicroWindows whose design goals match exactly that of a 2D engine. 1.2 Short Overview The whole project can be divided into the following intensely intertwined sub-domains. A. MicroWindows Extension: A cross-platform GUI library for Win32 and Linux a) Identifying the em85xx architecture. b) Porting a device-independent GUI library from Linux edition (MicroWindows) to Win32. c) Developing software interface for user-defined screen device driver. d) Developing software interface for user-defined keyboard device driver. e) Making the keyboard driver, somewhat compatible with the em85xx FIP driver module B. MicroWindows embedded-hardware device simulator: integrated with the Microsoft Visual C++.Net IDE and Debugging environment. a) User interface design to accommodate a monitor and a key board simulator. b) Using another thread to run the simulated application program for em85xx. Multi-threading and data synchronization needs to be considered. c) Writing the Screen driver implementation code for the MicroWindows Extension. d) Writing the Keyboard driver implementation code for the MicroWindows Extension. e) Writing FIP remote control simulation code for em85xx. f) Rewriting GsSelect() event polling function for software simulator. It’s a combo of the UNIX and DOS version. A simulated timeout is implemented in the polling mechanism. C. Porting MicroWindows Sample applications and DVD Player program to the Simulator. a) Porting sample applications from MicroWindows demos. The following samples are ported. i. MyProgram.cpp: A very simple C++ application that shows a gif picture with MicroWindows APIs. IO operation and image display are illustrated. ii. NTetris.c: A slightly more complex C application that implements the famous Tetris game. Win GUI and Message handling (for keyboards) are demonstrated in the sample. b) DVD player: The original code of this application is provided by em85xx. Its event handling is based on its old polling mechanism with fip module; while its display interface is built upon a Confidential Page 8/11/20044 Author: LiXizhi All work copyright © Shenzhen Tech-Innovation International thin-wrapper (OsdWindow) of MicroWindows API. This mixture of coding style makes it extremely inefficient to be ported to the simulator. D. Testing and documentation a) Software-based tests performed on the software simulator (Windows NT edition) b) Documentation edited and reviewed. c) TODO: Performing tests with real hardware system: Integration into the hardware development cycle. d) TODO: User application development: HTML browser, E-BOOK viewer. Please see Figure 1. for a comparison of the development cycle before and after the software simulator was introduced. Display Linux Server A long time to … Win client Before download Compile & … Cross-compile Source code CPU and … editor MPEC cores Flash simulator After FIP 100% Software-simulated environment simulated code (perfect)