Abstract: This paper describes the floating-point storage byte order problem encountered in the process of embedding embedded GIS software from X86 platform to ARM architecture platform, and analyzes the problem in detail, and finally determines the floating point number under ARM architecture. The Middle-Endian storage problem and provides a solution.
With the increasing performance of embedded microprocessor chips, embedded devices have also been widely used. With the expansion of applications, the development of embedded software also features features such as diversification of functions, diversification of platforms and diversification of architecture.
Due to the good portability, a considerable part of embedded software is developed in C/C++ language, and the data storage byte order in the program written in C/C++ language is related to the CPU used by the compiler platform, so the embedded software is transplanted. In the process, the data storage byte order is the place to focus on.
In the process of embedding embedded GIS software from X86 architecture to ARM architecture, the problem of floating-point data storage byte order is encountered. The problem is neither Big-Endian nor Little-Endian, but the Middle-Endian byte order. This paper first introduces the embedded GIS software development platform and operation platform, and then tracks and analyzes the problems encountered during the migration process. Find the root cause of the problem and finally give two solutions.
1 Embedded GIS software
Embedded GIS software is developed in C++ and runs on embedded software on PDA. The software system structure is shown in Figure 1.
Based on the embedded hardware device as the hardware platform, the embedded Linux operating system with the kernel version of 2.4.30 and the QT/Embedded graphical interface development package constitute the software platform of the embedded GIS software. The embedded GIS software provides read operations on vector electronic maps in various formats (such as Shapefile, mapinfo) through the third-party library GDAL/OGR.
The operating platform of the embedded GIS software is the SMDK development board of Samsung Corporation with ARM920T as the processor. The electronic map data comes from an officially published electronic map data.
After the embedded GIS software is debugged on the X86, the embedded GIS software and other components are compiled using the arm-linux-gcc compiler of version 2.95.3; the software is finally ported to the SMDK.
After being ported to the SMDK development board, the embedded GIS software can display the software framework normally; when reading the electronic file in the Shapefile format, it enters an infinite loop state. According to the debug information, the value of the four double types in the range of the Shapefile electronic map read by the embedded GIS software is inconsistent with the value read under X86. For example, the data in the Shapefile is -3.383 700, while the value on the ARM platform is 7.49530le+68. The error data read out under the ARM architecture will cause the embedded GIS software to run into logic errors and not correctly display the electronic map.
2 Middle-Endian
Data storage byte order is one of the issues that need to be addressed when porting embedded software to different architectures.
When it comes to data storage byte order, mention Big-Endian and Little-Endian. At the beginning of the design of various architecture processors, the differences between Big-Endian and Little-Endian have always existed. They represent different ways of storing each byte under different architectures. As shown in Figure 2, the value 0x1234ABCD has a different storage order in different byte order.
The difference in byte order often results in inconsistent reading of file data across platforms. In view of the data inconsistency that occurs during the migration process of embedded GIS software, the byte order of the ARM architecture is tested as follows:
Return(htonl(1)==1)?BIG:LITTLE;
Test results show that ARM is the same as X86. The Little-Endian byte order is used to store data, and there is no problem of improper conversion between Big-Endilan and Lit-tle-Endian.
Simulate Shapefiles under X86 using simple binary data files. In the X86 architecture, int, f1oat, and double type data are written in the binary file to obtain the data file under X86. Transfer the data file to the SMDK development board, read the values ​​in the data file and print.
The test results show that the binary files generated under the X86 architecture are read under the ARM architecture. The int and float type data are consistent with the X86 architecture, and only the double type data is inconsistent. After further verification, the double type data is printed in hexadecimal form, and the key to the problem can be found, as shown in Figure 3.
The same double type data 0x1234 ABCD, read out under the ARM architecture becomes 0xABCD1234. Therefore, the map data read under the ARM platform has changed, which causes the embedded GIS software logic to make errors and cannot run correctly.
The original ARM processor does not support the IEEE standard for floating-point double type storage, neither Litrlc-Endian byte order nor Big-Endian byte order. In the ARM platform, each double type is divided into two words, each word uses the Little Endian byte order, and the two words are organized in Big Endian byte order, that is, the MiddleEndian byte order.
At present, it is not possible to change the order of storage of double type data by ARM architecture through hardware or software. Therefore, for programs like embedded GIS software that need to read binary files generated under other architecture platforms, double type data is needed. The storage order is processed.
3 solutions
There are two solutions to the Middle-Endian problem of double type data storage under the ARM architecture.
(1) Modify cross-architecture data files
Change the double type data in the cross-architecture file to be stored in text format. The text format does not change its storage format in the transmission of the cross-architecture, thus ensuring that the read data is consistent. However, the data of the embedded GIS software is officially released data, and it is difficult to modify it, so this method is not applicable in this software.
(2) Add Middle-Endian processing to the application
Similar to the processing of Little-Endian and Big-Endian, in the underlying code, any data read/write operation involving double type must be exchanged in advance for double type data to ensure that the double type data storage is consistent across architectures. Sex.
The embedded GIS software is called by shpopen in GDAL/OGR. The function provided by the c file reads/writes the Shapefile. So add the function void EndianType(void) that evaluates the Middle-Endian byte order in the shpopen.c file. The code is as follows:
The byte order of the running platform is determined by comparing the hexadecimal value of the floating point number 1.982031 under the software running platform with its hexadecimal value under X86.
It has been verified that once the platform stores double type data in the Middle-Endian byte order, the function "void SwapWord(int length,dout)e*dValue);" can be used to exchange double type data to get the correct storage order. .
Modified sbpopen. The c file adds support for the Middle-Endian byte order in the ARM architecture, and finally solves the problem of Micidle-Endian, which can correctly display the electronic map data.
4 small knots
This paper describes the floating-point storage byte order problem encountered in the process of embedding embedded GIS software from X86 platform to ARM architecture platform, and analyzes the problem in detail, and finally determines the Middle of floating point number under ARM architecture. -Endian stores the problem and provides a solution. I hope that the development experience of this article can provide some useful help for embedded GIS software developers.
10-inch tablet devices have greatly surpassed netbooks in terms of entertainment, including reading, games, and audio-visual enjoyment. In other respects, the basic operation of the 10-inch tablet computer built on the touch screen ensures that the application of the tablet computer can be well realized, and its operation performance is closer to that of a smartphone.
1.In appearance, the 10-inches tablet computer looks like a large-screen mobile phone, or more like a separate LCD screen.
2.In terms of hardware configuration, the 10-inches tablet computer has all the hardware devices of a traditional computer, and has its own unique operating system, compatible with a variety of applications, and has a complete set of computer functions.
3.The 10-inches tablet computer is a miniaturized computer. Compared with traditional desktop computers, tablet computers are mobile and flexible. Compared with Laptops, tablets are smaller and more portable
4.The 10-inches tablet is a digital notebook with digital ink function. In daily use, you can use the tablet computer like an ordinary notebook, take notes anytime and anywhere, and leave your own notes in electronic texts and documents.
10 Inches Tablet Pc,Tablet Pc Android,10 Inch Quad Core Tablet,Tablet 10 Inch
Jingjiang Gisen Technology Co.,Ltd , https://www.gisentech.com