Porting of Java Virtual Machine Based on Digital TV Set Top Box

September 22, 2018

Abstract: In order to enhance the network interaction capability of digital TV set-top boxes, the embedded middleware Java virtual machine and its porting on the digital TV set-top box are introduced. This paper briefly describes the common DVB-C cable digital TV set-top box technology, introduces the concept, background and JavaVM hierarchy of embedded middleware. The process of porting JavaVM on the digital TV set-top box is highlighted. The results of the operation indicate that the JVM was successfully ported on the set-top box.

Keywords: digital TV set-top box embedded middleware Java virtual machine

Digital TV is a hot spot in the current IT industry. As an information service that will be launched nationwide, it integrates many technologies such as computers, multimedia, and communication networks. With the development of digital TV in recent years, interactive TV has received more and more attention. Interactive TV provides users with a wealth of interactive features, including electronic program guides, video on demand, stock information, interactive games and more. At present, digital TV set-top boxes are the main access platforms for receiving digital TV programs and digital information based on analog TVs transmitted by cable television networks. To realize the function of interactive TV, digital TV middleware technology is an indispensable condition, and it has become the core technology of interactive TV. China has established a digital TV middleware standard, and it is very important to use this standard to develop a middleware system with independent intellectual property rights.

Based on the current mature digital TV set-top box technology, this paper proposes a method to transplant the middleware JavaVM to the digital TV set-top box, and introduces the principle and implementation process of the whole scheme in detail.

1 Cable digital TV set-top box technology

The cable digital TV set-top box structure is shown in Figure 1.

Ordinary (civil) cable digital set-top boxes are digital bridges between traditional HFC networks and traditional analog TVs. At the front end of the HFC network, the digital multiplexer multiplexes the various encoded digital television program signals with the data broadcast signals, modulates them into DVB-C signal streams through framing, QAM modulation and carrier, and broadcasts them to the user through the HFC network. The user locks the TV program channel through the digital set-top box, and completes the program reception through QAM demodulation, demultiplexing, decompression, decryption and charging control. The core module of the set-top box (such as STi5512) is a digital TV decoder. It is an embedded system and generally has the following hardware modules: MIPS CPU, demodulator, demultiplexer, A/V decoder, analog A/V encoding. And so on.

In this solution, ST's Sti5516 chip is selected, and the CPU of the chip is ST20-C2.

2 Middleware technology

From the perspective of hardware technology, CPU speed is getting higher and higher, and processing power is getting stronger and stronger. From the perspective of software technology, the scale of applications is expanding, especially the emergence of the Internet, making the application of computers more broad. Many applications need to run on heterogeneous flats in the network environment. All of this puts new demands on the development of next-generation software. In this distributed heterogeneous environment, there are usually multiple hardware system platforms (such as PCs, workstations, minicomputers, etc.), and various system softwares exist on these hardware platforms (such as different operating systems, databases, Language encoders, etc., as well as a variety of different user interfaces, these hardware system platforms may also use different network protocols and network architecture connections. How to integrate these systems and develop new applications is a very real and difficult problem.

To solve the distributed heterogeneity problem, the concept of middleware is proposed.

Middleware is an intermediate layer embedded between the application and the operating system and hardware platform. It is usually defined as a group of relatively complete, standard application interfaces. It mainly provides cross-operating system and cross-hardware platforms and hierarchical, modular and extensible interfaces for application software development. At the same time, it provides necessary coding tools according to the programming characteristics of embedded applications.

With middleware, applications can be made more open and portable, independent of the operating system and hardware platform. With middleware, applications can run not only on different hardware platforms, but also on different operating systems, so as to improve development efficiency and reduce development costs while keeping up with technology development and making application development even more Simple, it also provides a relatively stable high-level application environment for applications.

For digital TV set-top boxes, digital TV middleware refers to the software part between the real-time operating system and the application program inside the digital TV set-top box, which isolates the application from the underlying operating system and hardware details, so that the application does not depend on the specific hardware platform. . Its location in digital TV is shown in Figure 2.

3 Java and Java virtual machine

3.1 Introduction to Java

For most development languages, you need to compile or interpret. But the Java language is special compared to languages ​​that need to be compiled or interpreted. Through the compiler, the program is first translated into an intermediate language called Java bytecode, a platform-independent code that is interpreted by the interpreter on the Java platform. The interpreter interprets all Java bytecode instructions on the computer. Once the compilation is complete, an interpretation process occurs each time the program is executed. Figure 3 illustrates the process.

image 3

Each Java interpreter, whether it's a development tool or a web browser that runs an applet applet, is an implementation of the Java virtual machine. Java bytecodes make it possible to have a fashionable view of "write once, run anywhere". Bytecodes can run on any Java virtual machine form, which means that the same Java program can run on a Windows 2000 system, a Solaris workstation, or a Mac system as long as the Java virtual machine is installed on the computer.

3.2 Java platform

A platform is a hardware or software environment in which a program runs. I have already provided some popular ones, such as Windows 2000, Linux, Solaris and Mac OS. Most platforms can be thought of as a combination of hardware and operating systems. Java is different from other platforms because it is just a software platform that runs on top of other hardware platforms. The Java platform has two components: JavaVM and JavaAPI. Figure 4 is a block diagram of the Java platform.

3.3 J2ME platform

Java has been promoted to various platforms so far, and four versions of the Java runtime environment have been developed for different application platforms. Among them, various consumer electronic products such as PDA and STB with low hardware computing power and limited storage are specially proposed. The J2ME version.

J2ME defines a Java runtime environment and development environment, which includes Java virtual machines installed in various consumer electronic devices and core class libraries especially for various consumer electronic devices. The main applications of J2ME can be divided into two categories: personal mobile devices and shared fixed devices. The former uses CLDC in the Configuration layer, and the terminal devices used include mobile phones, etc., which are relatively streamlined on the human-machine interface and have relatively low memory requirements. small. The latter uses CDC at the Configuration level, such as automotive out-of-air, entertainment equipment, digital TV set-top boxes, and so on. Figure 5 shows the J2ME platform structure.

4 transplantation and implementation process

The author's job is to port the JavaVM CDC&Foundation to the digital TV set-top box described in the previous block diagram, see Figure 6.

4.1 Scheme

China's digital TV middleware standard clearly states that the middleware system should use the Java virtual machine, provide a standard interface for Java applications, and write interactive applications using the Java language. According to the standard, combined with the hardware environment and operating system of cable set-top box, the implementation scheme of digital TV middleware based on cable set-top box is proposed.

4.2 Implementation of the program

The code was implemented using the free Java virtual machine software announced by Sun on its homepage, and was transplanted to the existing digital TV set-top box after various modifications.

4.2.1 Environment Construction

(1) By modifying the relevant make files in the build directory of the source code, the operating environment of the virtual machine source code can be correctly built on the set-top box, laying the foundation for the next step of code debugging. Mainly in the compiler name and path, file suffix name and JDK toolkit path. In order to reduce the difficulty of the initial porting work, some options for generating Java virtual machine executable code have been simplified accordingly.

(2) According to the specific hardware configuration of the existing digital TV set-top box, the corresponding hardware configuration file is modified mainly according to the size of the flash.

4.2.2 Code debugging

After the build and tuning environment is properly built, debug the code. There are mainly the following changes and code rewriting:

(1) Operating system related modifications. The digital TV set-top box uses the embedded real-time operating system OS20 provided by ST, and the source code is based on the Linux operating system. Modify the definition and use of the task structure. In addition, the definition of supporting variable parameters in the OS20 operating system kernel code is also different from that in Linux, and should be modified accordingly.

(2) Modifications related to the CPU. The main assembly file CVMjniInvokeNative.S written in X86 assembly instructions in the source code is implemented with C2 assembly instructions designed by ourselves. Since the ST20-C2 provides fewer registers, local variables are used in the implementation to store and transfer data.

(3) Simplified modifications in debugging. Multi-threading is shielded, which brings great convenience to debugging. Remove the dynamic loading feature so that the classes you need to use are precompiled and localized to romjava.c.

4.2.3 Test and operation results

JavaVM is actually a process of the system. The system will allocate the necessary resources, such as the priority of the process and the memory space required by the system, just like ordinary processes. As a process of the system, JavaVM will participate in the process scheduling of the system according to its own priority. The JavaVM system, along with other processes, shares system resources, including processor resources. To do this, the author creates a task in the main() function to start the Javavm task.

The entire modified source code is compiled and connected into executable code in the new coding environment, and downloaded to the machine box target board through the JPAG port.

The "input" of the Java virtual machine is "hello.java", which is compiled by Java to generate the class file "hello.class". If the code is successfully debugged, the word "hello world" should be typed on the display terminal. This is the result of the Java virtual machine interpreting the bytecode. Explain that the Java virtual machine is successfully transplanted based on the CDC&Foundation configuration.

The scheme proposed in this paper to realize digital TV middleware in the environment of cable digital TV set-top box adopts Java technology as the core, fully embodies the advantages of Java technology, and makes the application development of interactive TV more simple and convenient. This solution implements the basic functions of the Java Platform (CDC) and provides a software platform for further research and implementation of Java application standard interfaces.

Of course, there are still some problems with the current CDC implementation, and further improvements are needed to improve its stability. On this basis, personal profiles and Java TV APIs can be added to provide a complete environment for the development of Java applications.

The basic concept and abstract model of embedded middleware JavaVM are introduced above, and its transplantation and implementation in digital TV set-top box is given. The rapid migration of application code between different platforms is possible through the embedded middleware JavaVM. Embedded middleware can be applied to different software and hardware platforms; it can be transplanted to different operating systems and different microprocessor architectures independently of the platform and processor, so that the upper application is more portable. We believe that the widespread use of embedded middleware will enable embedded applications to be developed in the same environment as the Java language, in a variety of machine and operating platform environments - "compile once, run everywhere."


[1]. STi5512 datasheet http://

0 times
Window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": " 0", "bdSize": "24" }, "share": {}, "image": { "viewList": ["qzone", "tsina", "tqq", "renren", "weixin"], "viewText": "Share to:", "viewSize": "16" }, "selectShare": { "bdContainerClass": null, "bdSelectMiniList": ["qzone", "tsina", "tqq", "renren" , "weixin"] } }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share. Baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];