Design of a Ship Navigation System Based on Embedded S3C2440
2026-04-06 06:23:26··#1
Abstract: This paper describes the development of a ship navigation system using the Linux operating system on a hardware platform based on the ARMS3C2440 core. The system's hardware design, software design, cross-compilation environment setup, bootloader porting, kernel porting, driver programming, and root file system setup were completed, realizing the system's functionality. Keywords: Embedded systems; S3C2440; Linux; Ship; Navigation 1. Introduction Embedded technology, integrating computer technology, communication technology, microelectronics technology, and other technologies, has entered a stage of rapid development. Embedded systems have been widely applied in various fields such as aviation, consumer electronics, information appliances, and network communication. The ARMS3C2440 ARM embedded processor is a chip with excellent cost-performance ratio and has broad application prospects in various fields. Ship navigation technology should also continuously develop towards high performance and stability with the changing scientific and technological background. Embedded technology provides high-quality development resources for this. Embedded systems require a highly concise, easy-to-develop, multi-tasking, and inexpensive operating system. The open-source Linux meets these requirements. Furthermore, the standard Linux operating system is quite large. Therefore, it is necessary to re-port, tailor, and configure the standard Linux system according to actual applications to generate a specific operating system with compact code and small code size. 2. Hardware Design of the Navigation System The designed vehicle navigation system's hardware platform is based on the SAMSUNG 32-bit high-performance embedded microprocessor S3C2440A based on the ARM902T. It includes an LCD display module, memory modules (Flash, SDRAM), a GPS module, a serial interface, a USB interface, an IrDA infrared communication interface, a network interface, and other peripheral components. Its hardware configuration is shown in Figure 1. The S3C2440A embedded microprocessor uses a 16/32-bit reduced instruction set and features high cost-effectiveness, low power consumption, and high performance, providing a small microcontroller solution for handheld devices and general applications. To reduce overall system power consumption, the S3C2440A includes the following components: independent 16KB instruction cache and 16KB data cache, MMU, LCD controller (STN/TFT), NAND Flash boot loader, memory manager (chip select logic and SDRAM controller), 3-channel UART, 4-channel DMA, 4-channel pulse width modulation timer, I/O ports, RTC real-time clock, 8-channel 10-bit A/D controller and touchscreen interface, IIC interface, IIS interface, audio interface, USB host, USB device, SD host/multimedia card interface, 2-channel SPI, camera interface, PLL clock generator, and power management, etc. 3. Software Design of the Ship Navigation System 3.1 Software Functions and Composition The software of the ship navigation system consists of three parts: embedded operating system, GUI graphical user interface, and application program. The embedded operating system and GUI are key technologies; their quality determines the successful application of the system. The application program is built on top of the embedded operating system and GUI. The startup process after power-on is shown in Figure 2. In the software design, the operating system adopts the widely used open-source embedded Linux kernel, and the GUI uses Micro Windows, developed from source code. Figure 2 System Startup Process 3.2 Establishment of the Cross-Compilation Environment Based on the requirements of system stability, security, and reliability, the size of embedded products should be as small as possible, thus not providing sufficient resources for the compilation process. Therefore, a cross-compilation environment must be established, that is, compiling the program to be run on the target machine on a high-performance host machine to generate code format that can run on the target machine, and then downloading it to the target machine for execution. In the Linux environment, GNU tools are used to complete the compilation and linking processes, including the gcc compiler for the target system, the binutils binary tool for the target system, the glibc standard C library for the target system, and the Linux kernel header files for the target system. In the Linux root directory, the command `tar Ixvf cross-2.95.3.tar.bz2` is used to decompress the file. After execution, the `arm/2.95.3` directory is automatically generated in the `/usr/local/` directory. Entering the `2.95.3` directory, you can see various directories such as `arm-linux`, `bin`, `include`, and `lib`, indicating that the cross-compilation tools have been installed and the compilation environment has been established. 3.3 Bootloader Porting is constrained by embedded system resources. Unlike PC bootloaders, which consist of the BIOS and the bootloader located in the hard drive's MBR, embedded system bootloaders are primarily handled by the BootLoader. The BootLoader is the first code executed after a system reset, its main functions being to initialize hardware devices, establish memory space mapping, and bring the system's hardware and software environment to a suitable state, thus creating a good environment for the operating system and application calls. The system's software design uses the Vivi BootLoader developed by Mizi Corporation. In embedded systems, the BootLoader is highly hardware-dependent; creating a universal BootLoader is nearly impossible. Therefore, a specific BootLoader must be ported for each platform. The approach to porting the system's bootloader is to find a BootLoader most similar to the designed platform, and then modify the BootLoader according to the hardware requirements of the designed platform, thus completing the bootloader porting. First, modify the relevant parameters in the Vivi project management Makefile according to the actual situation, including the cross-compiler library and header file paths, cross-compilation switch option settings, and the library and header file paths in the Linux kernel code. Then, modify the corresponding configurations according to the hardware platform parameters, such as processor clock, memory initialization, and general I/O initialization. Then, configure and compile to generate executable code. 3.4 Kernel Porting Since embedded systems are application-specific and resources are limited, standard Linux cannot be applied to embedded systems. Therefore, Linux must be tailored and configured according to the actual situation to produce a suitable embedded Linux operating system. Linux kernel porting includes obtaining source code, modifying settings, trimming configurations, and compiling. 3.4.1 Obtaining Source Code Linux kernel source code is generally maintained by specialized organizations, and we can download it from their websites. Modifying Settings Embedded systems are highly application-specific, and the kernel downloaded from the site cannot contain code for all embedded systems. Therefore, the code needs to be modified to suit the target platform. This generally includes the following steps: ① Write processor-related code. This mainly includes clock settings, interrupt settings, memory allocation, and settings for other registers. This S3C2440 processor-related code is located in the `/arch/arm/mach-S3C2440` directory. ② Modify the Makefile project management file in the root directory, specifying the hardware platform being ported and the path to the cross-compiler. ③ Modify the Makefile project management file in the `/arch/arm` directory, specifying the virtual address where the kernel runs. Modify the `config.in` configuration file in this directory so that S3C2440-related information can be displayed when executing configuration commands. ④ Add the configured S3C2440 configuration file to the `/arch/arm/def-configs` directory. Add the processor initialization code `head-S3C2440.s` to the `/arch/arm/boot/compressed` directory. ⑤ Modify the Makefile project management file in the `/arch/arm/kernel` directory, determining the dependencies between file types. 3.4.2 Configuring and Compiling a Minimized Kernel Configuration After modifying the kernel settings, you can configure and compile the kernel to minimize its size. Remove redundant parts from the configuration to minimize the final kernel image file size. Execute the following commands: # make menuconfig Enter the configuration menu, select the processor type and support for various peripherals and protocols, including support for LCD, touchscreen, serial port, sound, EXT2, FAT, and JFFS2 file systems, as well as TCP/IP protocol. # make dep Search for dependencies between the Linux compilation output and the source code and generate dependency files. # make zImage Compile the Linux kernel and generate a compressed kernel image file, zImage, located in the /arch/arm/boot/ directory. 3.5 Driver Development Drivers are the interface between the operating system kernel and the underlying hardware. Drivers shield applications from hardware details, allowing applications to operate on hardware as easily as ordinary files. The main functions of drivers are initializing and releasing hardware devices, detecting and handling hardware problems, and transferring data between applications, the kernel, and the underlying hardware. Since embedded systems are application-specific, drivers for the corresponding devices should be written according to the specific platform to facilitate application access to the underlying hardware. Each system call corresponds to a member of the `file_operations` structure. Writing a driver mainly involves writing the various operation functions required by the underlying device and populating the `file_operations` structure, which is defined in the `/include/Linux/fs.h` file. The driver is associated with the specific hardware through the device name, major device number, and minor device number. Drivers can be loaded into the kernel dynamically or statically. During the debugging phase, drivers are generally loaded dynamically, while in the final product, they are added to the kernel and automatically loaded each time the kernel starts. 3.6 Root File System For the stable operation of an embedded product, in addition to the bootloader and kernel, there must be an area to provide support architecture and user application software, and to store the results of data read and write operations. This area is the root file system. The root file systems commonly used in embedded systems include Romfs, Cramfs, Ramfs, JFFS2, EXT2, etc. Furthermore, the root file system can be built on either a RAMDISK or Flash. Cramfs is built on a RAMDISK. 4. Conclusion In ship navigation systems, the use of fully open-source embedded Linux can completely replace commercial operating systems such as WinCE, thereby reducing system costs and increasing market competitiveness. Through the development of the system, the author has the following innovative points: (1) Adding some output statements to the program so that during debugging, some debugging information printed via the serial port can be displayed on the super terminal, allowing observation of the program's running status. (2) Due to the slow serial port download speed, the BootLoader should support the network as much as possible, downloading the kernel and file system via the network to accelerate the development process. References: [1] Tian Ze. Embedded System Development and Application Tutorial [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2005. [2] Han Junshu, Zeng Ruili, Li An. Application of PID Algorithm in Battery Charging Control System [J]. Automation Technology and Application, 2005, 24(9): 48-51. [3] Huang Jin. Analysis and Control Compensation Research of Servo System with Friction Link [D]. Doctoral Dissertation of Xi'an University of Electronic Science and Technology. Xi'an: Xi'an University of Electronic Science and Technology, 1998. [4] Li Zhuo, Xiao Deyun, et al. Fuzzy Adaptive PID Control Method Based on Neural Network. Control and Decision, 1996(3): 340-345. [5] Su Yixin, Wang Ziyi, Zhang Suwen. Study on Porting μClinux in Embedded Systems [J]. Microcomputer Information, 2006.11-2: 58-61. [6] Lu Jianxiang, Liu Chengan, Hu Hezhi, et al. Porting of CramFS Root File System Based on S3C2410 [J]. Microcomputer Information, 2006.11-2: 133-135.