Analysis and design of startup process based on embedded uCLinux kernel

Publisher:科技徜徉Latest update time:2013-03-30 Source: dzsc Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  0 Introduction

  32-bit ARM embedded processors have the characteristics of high performance, low power consumption and high cost performance, and have been widely used in consumer electronics, wireless communications, control and network communications. uCLinux is an embedded operating system designed specifically for MMU-less processors and supports ARM, Motorola and other microprocessors. Currently, it is very common to use ARM + uCLinux as a development model for embedded systems.

  A complete embedded system based on uCLinux consists of three parts, namely the system bootloader, the uCLinux operating system kernel and the file system. The boot technology of embedded systems is a difficult point in embedded system development. The success of system boot determines whether the operating environment of the application can be correctly established. The successful system boot is the prerequisite for the correct operation of the application. The boot process of the uCLinux kernel is also an important part of it. Analyzing the boot process of uCLinux can speed up the system boot speed and correctly establish the application environment. This article will study the boot process of the uCLinux operating system kernel.

  1 System Introduction

  This system uses the S3C4510B processor with the Arm7TDMI core of SamSung, and mainly uses its powerful network function to communicate with the PC. The main function of this system is to use the serial port to monitor a smart meter, transmit the obtained data to the PC through the Internet, and the PC will further process it and present the final result to the user.

  The hardware platform includes a processor with ARM as the core, 2MB Flash and 16MB SDRAM as the memory, and an Ethernet interface in addition to the serial port for communication to support the network function of S3C4510B. The software platform consists of the following parts: system bootloader, embedded operating system kernel, and file system.

  Depending on whether the kernel is compressed and whether the kernel is executed locally, uCLinux usually has two startup methods: flash local execution and compressed kernel loading. This system uses the second startup method, that is, the kernel's compressed image is fixed to the flash, decompressed in the memory when the system starts, and then executed in the memory. This startup method runs faster than the first method.

  2 Implementation of uCLinux kernel startup process

  The boot process of the ARM + uCLinux system can be summarized into the following stages: (1) PC points to the reset address entry, that is, the Bootloader code at 0x0H. The Bootloader completes some basic initialization and brings the system's hardware and software environment to a suitable state; (2) After the Bootloader hands over control to the boot program of the operating system kernel, it starts loading the uCLinux kernel; (3) After the uCLinux kernel is loaded and booted, the init process is started, completing the system boot process.

  The boot program of this system uses the boot program that comes with uCLinux to load the kernel. During the kernel boot process, the following files are mainly called: head.S (in the \\linux-2.4.x\\arch\\armnommu\\boot\\compressed\\ directory), main.c (in the \\linux-2.4.x\\init\\init\\ directory), and simpleinit.c (in the \\user\\init\\ directory) [1]. In actual applications, the relevant files should be modified according to the hardware platform and system functions to correctly boot the system.

  When the Bootloader hands over control to the kernel's boot program, the first program executed is head.S, which completes most of the work of loading the kernel; misc.c provides the subroutines required to load the kernel, among which the subroutine for decompressing the kernel is an important program called by head.S. In addition, the kernel loading also requires the knowledge of the system's hardware information, which is defined in hardware.h and referenced by head.S. The kernel startup process in this system is shown in Figure 1.

[page]

  In this system, head.S first configures the system register SYSCFG of S3C4510B, initializes the system's Flash, SDRAM and bus control registers, and sets the address ranges of Flash and SDRAM to 0x0-0x1fffff and 0x1000000-0x1ffffff respectively; according to the functional characteristics of this system, the interrupt priority and I/O port configuration are redefined; in order to improve the running speed of the kernel, the 2M kernel image file is copied from Flash to SDRAM; by operating some system registers, the system's memory is remapped, and the address ranges of Flash and SDRAM are remapped to 0x1000000-0x11ff respectively fff and 0x0-0xffffff; then initialize the system stack; then call the function decompress_kernel in misc.c to decompress the kernel image file copied to SDRAM; finally jump to execute the kernel function call_kernel. Calling the call_kernel function actually executes the start_kernel function in main.c. The functions completed by this function include initialization of the processor structure, initialization of interrupts, initialization of timers, initialization of processes, and initialization of memory; finally, the kernel creates an init thread, calls the init process in this thread, and completes the system startup [1][2].

  It is worth noting again that during the kernel boot process, the hardware-related information defined in the file hardware.h is called. The boot of Linux-based embedded systems is heavily dependent on the hardware platform. Before the kernel boots, necessary files must be modified according to the hardware platform and system functions [2]. In this system, the flash and SDRAM control registers ROMCON0, DRAMCON0, and SYSCFG in hardware.h are modified.

  When uCLinux starts, it runs a program called init, which is a user-level process started by the operating system. It starts the following tasks, including multi-user environment and network. The behavior of the init process is defined in the function simpleinit.c, so the behavior of the init process can be customized according to the system's functions. For example, a serial port control program is added to this system, and the printk function can be used to print out necessary debugging information. When the init process starts, it reads a run control file rc and a configuration file inittab. In embedded applications, it is generally necessary to run user-specific programs immediately after the operating system is running. For this purpose, these two files can be modified. In this system, the inittab file and rc file are appropriately modified so that some specific processes can be run immediately after the system starts. The inittab file is modified in the program inittab.c, and then the SIGHUP signal is sent to the init process, that is, kill(1,SIGHUP), so that the init process re-reads the configuration file inittab[3].

  Some of the code in the inittab.c file is as follows:

  FILE *pFile;

  if((pFile=fopen("/etc/inittab","w"))!=NULL){

  fprintf(pFile,"pollmeter:unknown:/bin/pollmeter ");

  fprintf(pFile,"netcomm:unknown:/bin/netcomm ");

  …

  }

  ......

  kill(1,SIGHUP); //The ID of the init process is equal to 1

  …

  There is also an important link script file in the startup process, which specifies the entry address of the kernel.

  In short, the startup process of uCLinux is also relatively complicated, and many files need to be called. In order to correctly start the uCLinux operating system, the relevant source code files must be modified according to the hardware platform and system functions.

  3 Conclusion

  This paper analyzes the kernel boot process, modifies the boot code and necessary related files according to the characteristics of the application system, and completes the correct boot of the uCLinux kernel. Practical application shows that the boot design of this system is correct and reliable. The analysis and design method of this paper has great reference value for the development of embedded Linux. I believe that the application of Linux in embedded systems will become more and more extensive.

References:

[1]. Arm7TDMI datasheet http://www.dzsc.com/datasheet/Arm7TDMI_139812.html.
[2]. S3C4510B datasheet http://www.dzsc.com/datasheet/S3C4510B_589.html.

Reference address:Analysis and design of startup process based on embedded uCLinux kernel

Previous article:Debugging and diagnosis method based on embedded system
Next article:Design and Analysis of Embedded Ethernet Based on S3C44B0X+μcLinux

Recommended ReadingLatest update time:2024-11-16 14:42

Panasonic Automotive Electronics Systems and Arm Join Forces to Promote Standardization of Software-Defined Vehicles
Panasonic Automotive Systems Co., Ltd. (PAS) and Arm recently announced a strategic collaboration to jointly promote the standardization of software-defined vehicle (SDV) architecture. Based on a common vision, the two parties are committed to co-creating a flexible software stack that can meet current and fut
[Automotive Electronics]
Steps for QEMU to emulate ARM on PC
1. First, compile the qemu code: git clone git://git.qemu.org/qemu.git cd qemu/ 。/configure --target-list=arm-softmmu,mipsel-softmmu --enable-debug --enable-sdl make sudo make install If an error occurs during configuration: ERROR: User requested feature sdl configure was not able to find it. Install SDL devel impleme
[Microcontroller]
Steps for QEMU to emulate ARM on PC
Macro definition in arm
 The syntax format is as follows:               MACRO             macroname{ $ parameter1, $ parameter, ...       }             Other instructions                  MEND                  The MACRO pseudo-operation marks the beginning of the macro definition, and MEND marks the end of the macro definition. Use MACR
[Microcontroller]
SoftBank wants to reform, and ARM becomes a victim? It spent $32 billion to acquire it 4 years ago!
According to foreign media reports, people familiar with the matter revealed that Japan's SoftBank Group is studying the sale of all or part of the shares of British chip design company ARM, or choosing to list ARM. Four years ago, SoftBank spent $32 billion to acquire ARM. This is SoftBank's largest acquisition ever,
[Embedded]
SoftBank wants to reform, and ARM becomes a victim? It spent $32 billion to acquire it 4 years ago!
ARM Embedded Development System and CAN Bus
With the widespread application of integrated circuits and embedded computers in automobiles, the number of electronic controllers in modern automobiles is increasing. Common ones include electronic fuel injection devices of engines, anti-lock brake devices (ABS), airbag devices, electric door and window devices, ac
[Microcontroller]
Design of wireless home gateway based on ARM-μClinux
Introduction With the rapid development of network technology and information appliances, more and more families are demanding to establish home networks. The home gateway is the core of the entire home network. It mainly realizes Internet access, remote control, and the functions of connecting heterogeneous s
[Microcontroller]
Design of wireless home gateway based on ARM-μClinux
ARM interrupt vectors
[Microcontroller]
ARM interrupt vectors
Summary and analysis of problems in ARM embedded system applications
introduction Due to the emergence of various new microprocessors and the continuous deepening of their applications, embedded systems have achieved unprecedented development in the post-PC era. With the passage of time and the advancement of technology, user experience has become one of the key factors for product s
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号