With the rapid development of Internet and network and their continuous expansion to the home field, the integration trend of consumer electronics , computers and communications (3C) has become increasingly obvious, and embedded systems have once again become a hot spot for research and application. Embedded real-time Linux operating system is being widely adopted due to its low price, powerful functions and easy portability, becoming an emerging force. Now, with the rapid popularization of WAP mobile phones, PDAs, set-top boxes, and DVD/VCD players, users have put forward higher requirements for the GUI of these handheld devices, hoping to see a gorgeous and beautiful GUI like PC. GUI has become a bridge for communication between people and machines. The demand for GUI in embedded systems is getting higher and higher, and all of this requires a lightweight, low-resource, high-performance, high-reliability, configurable and beautiful GUI support.
1 Java graphical interface tools
Java technology is a great technology for servers, personal computers and embedded systems. Due to its cross-platform features, Java has been very successful in servers and desktops. However, in terms of GUI, Java has only very limited features to build graphical user interfaces. The idea is to use a platform-independent Java application program interface packaged to different operating systems to develop native graphical user interfaces, called the Abstract Window Tool (AWT). Only common components such as file fields, text areas, selection boxes, radio buttons, list boxes and buttons are supported by AWT, and the graphics and image features are very limited, that is, enough to build simple applets. Recognizing the need for more advanced graphical user interface components and graphics capabilities, Sun developed Swing, Java 2D, Java 3D, image input/output, and Java Advanced Graphics (JAI). Swing is a standard API (application program interface) for building Java graphical interfaces, and some AWT classes are based on Swing. It has a complete set of components from buttons to file fields, tables, trees and document editors. These components do not rely on native components of the operating system, but are drawn using primitive graphics like lines, rectangles, and text. This kind of painting represents a look-and-feel plug-in, which can imitate the local look and feel. SWT is developed based on Java. Its design concept is to maximize the API of the operating system's graphical components. That is to say, as long as the operating system provides the corresponding graphical components, SWT simply uses JNI technology to call them. Only for those components that are not provided in the operating system, SWT will make a simulated implementation by itself. In addition, SWT also provides direct access to the local graphical user interface of the operating system. Therefore, Java applications based on SWT have local graphical user interfaces and can be integrated with other local applications and components. Using the SWT development kit, the advantages of the Java language itself, such as simplicity, cross-platform, and reliability, are gradually being integrated into the development of graphical interface applications. Another door to success for the Java language is gradually opening.
2 Architecture of SWT+GtkFB Graphics System
2.1 Architecture of the SWT+GtkFB Graphics System
2.1.1 SWT
SWT is at the top of the system structure. It is a high-level function library required for designing graphical interfaces, along with AWT and Swing in Java. SWT has also improved some issues of AWT and Swing, and has now developed into a set of graphics component function libraries that are independent of the operating system. Appropriate simulation is used in the generation of components. The original operating system is used for basic components, and simulation technology is used for more complex components. Java applications based on SWT have local graphical user interfaces and can be integrated with other local applications and components.
SWT is an advanced graphics component library developed based on Java language. As shown in Figure 2, SWT directly calls the native-side GtkFB through JNI (Java Native Inter RF ace) technology on the Java side to use the operating system resources. JNI technology allows SWT programs to cooperate with native-side codes written in other languages and integrate them together; on the other hand, it allows SWT code running in JVM (JAVA virtual machine) to call GtkFB library functions or other programs; in addition, using InvocatiON API, the Java virtual machine can be embedded in the native-side application. The JNI interface is bidirectional, equivalent to a bridge and a link, which connects the SWT code and the native-side GtkFB code.
2.1.2 Gtk Library
As shown in Figure 1, GTK uses several connection libraries, such as the Glib library for basic data types, which consists of five parts: basic classes, core application support classes, practical function classes, data classes, and object system classes.
Pango is a full-featured framework for the layout and display of internationalized text . Pango can handle text that is not arranged from left to right, and can easily manage complex languages, and even handle letters that take different forms depending on the usage environment. For example, it supports bidirectional text, and users can mix left-to-right text and right-to-left text; there are also plug-ins for determining the shape of various complex texts (such as Arabic and Tamil). Pango is not only internationalized, but the Pango library can also handle the display of anti-aliased fonts very well with the support of Xft and XRender.
Pango also supports various graphics formats such as libpng, libj peg , libtiff and FreeType for Framebuffer port. In fact, GTK provides three connection libraries: gdk-pixbuf, gdk and gtk. Gdk-pixbuf allows us to do related image work, gdk is the abstract layer of the window drawing system, most of the framebuffer related work is completed here, and gtk is a high-level application program interface.
ATK (Accessibility Toolkit) Accessibility Toolkit. GTK makes full use of ATK to make it possible for people with disabilities (such as low vision or limited mobility) to interact with GTK applications.
2.1.3 How GtkFB works
DirectFB accesses graphics hardware devices through the kernel interface provided by the operating system, namely the frame buffer device (FrameBuffer). FrameBuffer is actually a piece of hardware that serves as a bridge between the graphics card and the software. The Linux kernel opens it up so that the user's program can access the graphics card through block memory. For example, setting the display resolution and number of colors, accessing the display memory area, etc. Different Linux needs to provide drivers for different display hardware FrameBuffers . This means that DirectFB needs to run on FramBuffer, but the Linux kernel provides FrameBuffer drivers for common chips.
When an application connects to GtkFB, it calls gtk_init(), as shown in Figure 3. At this time, GtkFB starts Linux's Framebiffer, sets the resolution and number of colors, and then turns on peripherals such as the keyboard and mouse (PDA turns on the keys and touch screen). Then it reads the fonts from a specific directory, and finally initializes the window and event management. GtkFB can support 8, 16, 24, and 32bpp framebuffers.
To perform a specific graphics operation, the DirectFB chipset driver will access the graphics device's memory-mapped I/O ports and pass the command to the graphics card's acceleration engine. The actual hardware acceleration is done entirely in user space.
2.2 Advantages of SWT+GtkFB Graphics System
2.2.1 Small memory consumption, fast running speed, especially suitable for embedded products
Since GtkFB runs directly on FrameBufer and skips the X system, it saves some resources of X Server, which significantly improves memory consumption and running speed. In addition, the JNI technology used has greatly improved the program running speed and event response, which can meet the real-time application occasions with strict time requirements.
2.2.2 Good system stability
The key to the stability of SWT is its design concept. SWT maximizes the graphics component API of the operating system, that is, as long as the operating system provides the corresponding graphics components, SWT only uses JNI technology to call them. Only for those components that are not provided by the operating system, SWT will do a simulation implementation. It can be seen that the stability of SWT performance depends largely on the stability of the graphics components of the corresponding operating system.
2.2.3 Easy to port and share
The SWT API is exactly the same as the desktop version, so the code can be easily ported and shared between desktop and embedded devices.
2.2.4 Small and configurable
SWT uses the LGPL licensing method. Users are free and even encouraged to modify the source code to make it better meet their needs. It is easy to tailor specific SWT+GtkFB according to user needs. According to the LGPL license, users need to publish the modified source code, but users do not have to publish the source code of self-sufficient applications.
2.2.5 Easy to develop
SWT is developed based on Java language, and has the characteristics of Java language, such as platform independence, object-oriented, portability, security, etc. Users can easily develop widgets that meet their needs based on the widgets (components) provided by SWT, and easily use these widgets to build applications.
3 Implementation of SWT+GtkFB Graphics System
3.1 Preliminary preparation
To compile and install SWT+GtkFB in Linux, first go to http://www.gtk.org/download to download the following packages: pkg-config, glib2.x; atk, pango, DirectFB, gtk+2.x. Then go to http://www.eclipse.org/download to download swt.tgr.gz.
The next step is to create two directories, SWT and GTK, in the /home/XXX/ directory and set the environment variables as follows:
export SWT_HOME=/home/XXX/SWTexport SWT_HOME=/home/XXX/GTKexport PKG_CONFIG_PATH=$GTK_HOME /lib/pkgconfigexport LD_LIBRARY_PATH=$GTK_HOME/lib;$LD_LIBRARY_PATHIn addition, add "/home/XXX/GTK/bin" to the system environment variable PATH.
3.2 Compile and install Gtk+2.0
3.2.1 Compile and install pkg-config
tar zxvf glib-2.0.6.tar.gz -C $GTK_HOME/src
cd $GTK HOME/src/glib-2.0.6
. /configure --prefix=$GTK_HOME
make
make install
3.2.2 Compile and install atk
tar zxvf atk-1.0.1.tar.gz -C $GTK_HOME/src
cd $GTK_HOME/src/atk-1.0.1
. /configure --prefix=$GTK_HOME
make
make install
3.2.3 Compile and install pango, Direct FB, gtk+2.0, swt-forgtk2.2
The steps are similar to the installation of atk.
4 Application Prospects of Embedded Linux GUI
Embedded Linux GUI has many application areas, including home appliance market, commercial market, industrial and automation market, defense market, communication market, etc. For example, in the communication market, mobile phones, video phones, set-top boxes, etc. may become the operating platform of embedded Linux. A humanized user interface is the key factor to win consumers. Therefore, embedded Linux graphics system will play a more important role.
In the next few years, embedded Linux GUI will develop in the following directions: First, lightweight and low resource consumption. It is not desirable to build on a large and cumbersome operating system and GUI that consumes a lot of system resources. Second, high performance and high reliability. In particular, industrial real-time control systems have very high requirements for real-time performance, and have higher requirements for GUI than embedded systems. Third, configurability. We must clearly realize that embedded systems are customized devices, and their requirements for GUI vary. Some systems only require some graphics functions, while some systems require complete GUI support. Therefore, GUI must also be customizable.
Previous article:Low-cost compact fluorescent lamp ballast design
Next article:Design and implementation of indoor temperature control system based on ARM
Recommended ReadingLatest update time:2024-11-16 15:29
- Popular Resources
- Popular amplifiers
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- New version of MicroPython firmware for nRF52840
- EEWORLD University Hall ---- Introduction to Artificial Intelligence Zhejiang University of Technology
- Summary of performance indicators of integrated operational amplifiers
- EEWORLD University - Using the 75 W TAS6424-Q1 Class D Audio Amplifier for DC and AC Load Diagnostics
- EEWORLD University Hall----Live playback: High-performance i.MX RT processors help smart nodes achieve machine learning without Internet access
- Help, failed to create new IP core
- Setting the switching frequency of the switching power supply chip LTM4613
- Does the power layer of a four-layer board need to be made into a complete plane?
- [Register to enjoy gifts] element16 sincerely invites you to visit the 2019 Munich Shanghai Electronics Show
- EEWORLD University Hall----Live playback: AM57X platform features and typical applications