1. Preface
Embedded technology integrating computer technology, communication technology, micro-electronics technology and other technologies has entered a rapid development stage, embedded systems have been widely used in aviation, consumer electronics, information appliances, network communication and other fields. As an embedded processor, arms3c2440arm is a cost-effective chip and has broad application prospects in various fields.
As the background of science and technology changes, the ship navigation technology should constantly develop towards the high-performance and stability aspect and provide it with high-quality development resources.
Embedded systems require a highly concise, easy to develop, multi-task, and low-cost operating system. Open source Linux meets these requirements. In addition, the standard Linux operating system is relatively large. Therefore, you need to re-port, crop, and configure the standard Linux according to the actual application to generate a specific operating system with compact code and a small amount of code.
2. Hardware Design of the navigation system
The hardware platform of the designed on-board navigation system is based on the 32-Bit High Performance of Samsung Based on arm902t.
Embedded Microprocessor s3c2440a as the core, including LCD display module, memory module (flash, SDRAM), GPS module, serial interface, USB interface, IrDA infrared communication interface, network interface and other peripheral parts, its hardware composition 1 is shown.
The s3c2440a embedded microprocessor uses a 16/32-bit simplified instruction set, which features high cost performance, low power consumption, and high performance. It provides a small microcontroller solution for handheld devices and general applications. To reduce overall system consumption, s3c2440a includes the following parts: Independent 16 KB Instruction Cache and 16 KB data cache, MMU, LCD controller (STN/TFT), and NAND FLASH Boot Loader, storage Manager (chip selection logic and SDRAM Controller), 3-channel UART, 4-channel DMA, 4-Channel Pulse Width Modulation timer, I/O port, RTC real-time clock, 8-Channel 10-bit A/D controller and touch screen interface, IIC interface, IIS interface, audio interface, USB host, USB device, SD host/multi-media card interface, 2-channel SPI, camera interface, PLL clock generator and power supply | Voltage Regulator management, etc.
3. Software Design of the Marine Navigation System
3.1 software functions and composition
The software of the marine navigation system includes three parts: Embedded Operating System, Gui GUI, and application program. the embedded operating system and GUI are the key technologies, their quality determines whether the system can be successfully applied. The application is built on the embedded operating system and GUI, as shown in step 2 after power-on. In software design, the operating system uses embedded Linux, which is widely used in kernel source code, and the GUI adopts micro windows, which is developed by source code.
3.2 Create a cross-compilation environment
Based on the stability, security, and reliability of the system, the size of embedded products should be as small as possible, so as not to provide sufficient resources for the compilation process. Therefore, A cross-compiling environment must be established, that is, the program to be run on the target machine must be compiled on a high-performance host machine to generate a code format that can be run on the target machine, then download it to the target machine and run it. Use GNU hardware in a Linux environment | tool for compilation and linking, including GCC for the target system, binutils for the binary tool for the target system, glibc for the Standard C library for the target system, and Linux kernel header files for the target system.
In the root directory of Linux, extract by the command tar ixvf cross-2.95.3.tar.bz2, after the execution is completed, automatically generate the ARM/2.95.3 directory under the/usr/local/directory, go to the 2.93.3 directory and you can see various directories such as arm-Linux, bin, include, and Lib. This indicates that the cross-compilation tool has been installed and the compiling environment has been established.
3.3 boot program porting
Due to the limitations of embedded system resources, the boot program of the embedded system is not composed of bios and boot program located in the hard disk MBR like the boot program on the PC, the boot loading task of the entire system is mainly completed by the bootloader boot program. Bootloader is the first code to be executed after the system is reset. It mainly serves to initialize hardware devices, establish memory space ing, and bring the system's hardware and software environment to a proper state, in this way, a good environment is established for the operating system and application calls.
The guiding program used in the system software design is bootloader ---- Vivi developed by mizi Korea. In an embedded system, bootloader is highly dependent on hardware. It is almost impossible to establish a general bootloader in an embedded system. Therefore, for each specific platform, to port a bootloader.
The idea of porting the System Pilot Program is to find the bootloader of the platform most similar to the designed platform, and then modify the bootloader according to the hardware parameters of the designed platform, to port the bootloader. First, modify the relevant parameters in the MAKEFILE file of the VIVI project management file according to the actual situation, including the path of the Cross Compiler library and header file, the cross compilation switch option settings, and the path of the library and header file in the Linux kernel code. Then, modify the corresponding configurations based on the parameters of the hardware platform, such as the processor clock, memory initialization, and general I/O initialization. Then configure and compile the executable code.
3.4 kernel porting
Because embedded systems are specific to specific applications and have limited resources, standard Linux cannot be applied to embedded systems. Therefore, Linux must be cropped and configured based on actual conditions, to generate a suitable embedded Linux operating system. Linux kernel porting includes obtaining source code, modifying settings, cutting configuration, and compiling.
3.4.1 obtain source code
Linux kernel source code is usually maintained by a dedicated organization, which can be downloaded and used from the websites of these organizations. Modify settings
Embedded system applications are highly targeted. The kernel downloaded from the site cannot contain code for all embedded systems. Therefore, you need to modify and set the code to suit the target platform. It generally includes the following steps.
① Compile the processor-related code. Including clock settings, interrupt settings, memory allocation and other register settings and so on, these with S3C2440 processor-related code in the/ARCH/ARM/mach-S3C2440 directory.
② Modify the project management File makefile in the root directory and specify the path of the migrated hardware platform and cross compiler.
③ Modify the project management File makefile in the/ARCH/ARM directory, specify the virtual address for Kernel running, and modify the config file in the directory. in to display information about the S3C2440 when executing the configuration command.
④ Add the configured S3C2440 configuration file under the/ARCH/ARM/def-configs directory. Add the processor's initialization code head-S3C2440.s under the/ARCH/ARM/boot/compressed directory.
⑤ Modify the project management File makefile in the/ARCH/ARM/kernel directory to determine the dependency between file types.
3.4.2 configuration reduction and compilation
After modifying the kernel settings, you can cut down the configuration and compile the kernel. In the configuration, you can cut out the redundant part so that the final kernel image file code generated by compilation is as small as possible. Run the following command:
# Make menuconfig
Go to the configuration menu and select the processor type and various peripherals and protocols required, including LCD, touch screen, serial port, sound, ext2, fat and jffs2 file systems and TCPIP protocol support.
# Make Dep
Search for dependencies between Linux compilation output and source code, and generate dependency files.
# Make zimage
Compile the Linux kernel to generate the compressed kernel image file zimage. Stored in the/ARCH/ARM/boot/directory.
3.5 write the driver
The driver is the interface between the operating system kernel and the underlying hardware. The driver shields the hardware details for the application, applications can operate on hardware as conveniently as normal files. The main function of a driver is to initialize and release hardware devices, detect and handle problems with hardware devices, and transmit data between applications, kernels, and underlying hardware.
Because the embedded system is specific to specific applications, you should write drivers for the corresponding devices based on the specific platform to facilitate application access to the underlying hardware. Each system call corresponds to every member of the file_operations structure. The driver is mainly used to compile various operation functions required by the underlying device and fill in the file_operations structure. This structure is in/include/Linux/Fs. h file.
The driver is connected to the specific hardware by the device name, master device number, and slave device number. The driver can be loaded to the kernel in a dynamic or static manner. During the debugging phase, the driver is usually loaded in a dynamic way, and is added to the kernel when the final product is formed, it is automatically loaded every time the kernel is started.
3.6 file systems
For the stable operation of an embedded product, in addition to the boot program and kernel, there must also be a region to provide users with support architecture and application software, and store data read/write results, this region is the root file system. Typically, embedded systems use the following root file systems: romfs, cramfs, ramfs, jffs2, and ext2. In addition, the root file system can be created on ramdisk or flash, create the root file system cramfs on ramdisk.
4. Conclusion
Embedded Linux with fully open source code can replace commercial operating systems such as WinCE in the marine navigation system, reducing system costs and increasing market competitiveness. Through system development, the author has the following innovations:
(1) Add some output statements to the program to display debugging information printed through serial ports on the Super Terminal during debugging. You can observe the program running status.
(2) due to the slow download speed of the serial port, bootloader should support the network as much as possible and download the kernel and file system through the network to speed up development.
Referenced in "casual BBS" "2 beanet": www.2beanet.com/bbs http://www.2beanet.com/