Research and transplantation of MiniGUI in embedded Linux environment

  
 

In recent years, with the wide integration of embedded devices and market demand, the application of mobile phones, PDAs and other products put forward higher requirements for the simplicity and convenience of the visual operation interface, which requires a stable and reliable high-performance GUI system. To provide support. The popularity of Graphic User Interface (GUI) is one of the important achievements of today's computer technology. It greatly facilitates the use of non-professional users, and people can easily operate through windows and menus. The basic requirements of the embedded system for the GUI include light weight, low resource consumption, high performance, high reliability, and configurability. MiniGUI is one of the more commonly used GUI systems. Compared with other GUIs, the most prominent feature of MiniGUI is light weight and low resource consumption. In the past few years, MiniGUI has been very mature and stable. Many products and projects have been put into practical use.

1 MiniGUI Features and Architecture

1. 1 MiniGUI Features

MiniGUI is a lightweight graphics system developed by former Tsinghua University teacher Wei Yongming. A graphical user interface support system for embedded or real-time systems. It follows the GPL convention and is a multi-window GUI support system based on the SVGALib and LinuxThread libraries. Can span a variety of operating system
, mainly running on Linux and all POSIX compatible systems with POSIX thread support, including common embedded Linux, eCos, uC/OS-II, VxWorks and other systems, is the earliest in China One of free software.

The main features of MiniGUI are: (1) pure free software that complies with GPL terms; (2) provides a complete multi-window mechanism; (3) multi-character set and multi-font support, currently supports ISO8859-1 , GB2312 and Big5 and other character sets, and support a variety of raster fonts and TrueType, Type1 and other vector fonts; (4) full spell and five strokes and other Chinese characters input method support; (5) BMP, GIF, JPEG and PCX and other common image files Support; (6) Windows
resource file support, such as bitmaps, icons, cursors, caret, timers and accelerators; (7) good portability.

1.2 MiniGUI architecture

1.2.1 Multi-threaded layered design

From the overall structure, MiniGUI is layered design, the structure is shown in Figure 1. Show. At the bottom, GAL (graphic abstraction layer) and IAL (input abstraction layer) and mouse and keyboard driver; the middle layer is the core layer of MiniGUI, including the various modules necessary for the window system; the top layer is the API, that is, the programming interface . GAL and IAL provide the GUI interface and input interface of the underlying Linux console or X Window for MiniGUI, and Pthread is used to provide C function library supported by kernel level thread. With GAL and IAL, the portability of MiniGUI is greatly improved, and the development and debugging of the program is made easier.

MiniGUI itself runs in multi-threaded mode, and many of its modules run as separate threads. At the same time, MiniGUI also uses threads to support multiple windows. Essentially, each thread has a message queue, which is a key data structure that implements thread data exchange and synchronization. One thread sends a message to the message queue, and another thread gets the message from this message queue. The windows created in the same thread can share the same message queue. One thread sends a message to the message queue, and another thread gets the message from this message queue. The windows created in the same thread can share the same message queue. Using the synchronization mechanism between message queues and multithreading, the microclient/server mechanism described below can be implemented.


1.2.2 Micro-client/server architecture

In a multi-threaded environment, similar to the communication mechanism between multiple processes, there is also the need for interaction and synchronization between threads. . For example, the thread used to manage the window maintains a global window list, while other threads cannot directly modify these global data structures. Instead, they must process each thread's request in turn according to the principle of “first come first served”, which is General client/server model. MiniGUI uses the synchronization operation between threads to implement the micro-client/server mechanism between the client thread and the server thread.

2 Development Environment

The H2410EB development board was designed and developed by Beijing Hengyi Hi-Tech Co., Ltd. It is based on Samsung's S3C2410A20 embedded ARM processor. The S3C2410A20 embeds the ARM920T core with a full-performance MMU. It features high performance, low power consumption, low cost, and small size. It is suitable for handheld devices and automobiles.

In addition to large-capacity SDRAM and Flash, H2410EB also expands RS-232C serial interface, 10Mbps Ethernet interface, touch screen interface, audio input/output interface, USB Host, USB Slave, UART interface. , IIC interface, user-defined keyboard, LCD display, user-friendly and reference design. It supports the operation of the embedded Linux operating system, supports MP3/MPEG playback, GUI, Web services and other services, and can develop specific software and device drivers according to user needs.

The operating system adopts the reduced Linux, the Linux Kernel version is v2.4.18, and the cross compiler used by the system is arm-Linux-gcc. In addition, there are code modules such as driver source code and test program source code.

3 MiniGUI porting

The host system used in this article is Red Hat Linux 9.0, the porting target system is Linux 2.4.18, and the MiniGUI version is 1.6.9. Cross-compile the MiniGUI link library on the host, and then burn the library file compiled for the target machine to the RAM space of the target board together with the root file system, and then directly link the graphical user interface running on the target board to the library. Run off the host independently.

3.1 Linux cross-compilation environment construction

GUI compilation is usually performed on a PC, that is, the compiler itself can be executed on a PC, while compiling the source code generated Binary files must be executable on the target machine, and such compilers are often referred to as cross compilers. For the ARM platform, we installed cross-arm-binutils-2.10-1.i386.rpm, cross-arm-gcc-2.95.3-2.i386.rpm, cross-arm-glibc-2.1.3-2.i386 .rpm these three packages. These packages are available free of charge online. The arm-binutils package generally contains some binary tools for the ARM platform, such as arm-strip, arm-ar and other commands; arm-glibc package contains the ARM version of the standard C function library and the corresponding header files; Included in arm-gcc is the cross-compiler on x86 that generates ARM platform code. Run the rpm command to install these packages on the PC. If you are not in the system default search directory, you must add the installation directory to the system's PATH environment variable, so that the system can find the compiler every time you compile.

Log in to the Linux system as the root user. Install the cross-compiler tool with the rpm command on the host. Arm-linux-gcc will be installed under /usr/local/arm/2.95.3/. At this point, gcc is /usr/local/arm/2.95.3/bin/arm-linux-gcc, and its include is /usr/local/arm/2.95.3/arm-linux/include, the corresponding lib is /usr/local/arm/2.95.3

-/arm-linux/lib. Then, add environment variables to your bashrc. Execute vi .bashrc and add the last line to the :export PATH=$PATH:/usr/local/arm/2.95.3/bin path. After saving and exiting, execute source .bashrc.

In addition, it should be noted that the version of the function library used at compile time should be the same as the version of the function library used when running on the target version. After the above steps, a cross-compilation environment has been established, and the next step is to perform the option configuration and cross-compilation of MiniGUI.

3.2 MiniGUI configuration and cross-compilation

We can get the MiniGUI-1.6.9 resource file compression package from the Internet (http://www.minigui.com/download) for free, MiniGUI1 The source package for .6.9 includes the following three parts: libminigui-1.6.9.tar.gz-MiniGUI library source code; miniguires-1.6.9.tar.gz-MiniGUI resources used, including basic fonts, icons, Bitmap, input method, etc.; mde-1.6.9.tar.gz-MiniGUI integrated demo program.

Copyright © Windows knowledge All Rights Reserved