According to a specific target platform, this paper introduces how to build an embedded development platform based on Linux 2.6.16, introduces the main technology and the whole process of transplantation, and develops the wind power generation monitoring software under QT / embedded.

1 system architecture

The hardware platform of the system takes 32-bit high-performance embedded processor s3c2410a as the CPU of the system. Its maximum working frequency is 203 MHz and has strong processing capacity. In addition, it also has a variety of peripheral devices, such as 640 resolution × 480 260000 color TFT LCD, serial port, USB port, network port, 64MB flash, 64MB SDRAM, etc. It can fully meet the needs of wind power monitoring system development.

The software architecture of the hardware platform is mainly divided into the following parts: BSP layer, operating system layer and application layer. Figure 1 shows its software architecture. The hardware platform of the system is composed of embedded microprocessor and its peripheral devices. The hardware abstraction layer (BSP) is a hardware driver stored on the hardware platform ROM or flash, which is responsible for communicating with the underlying hardware. It is mainly responsible for initializing the system and transmitting the collected hardware information to the next operating system kernel. The operating system kernel manages the system hardware resources through BSP, and provides process scheduling, memory management, file system, device driver and other services for the upper software. The application layer is mainly responsible for communicating with users.

How to design and implement the embedded wind power monitoring system

After completing the architecture design of the system, we can build a specific hardware platform. Its work mainly includes the following parts: bootloader transplantation, kernel transplantation and the establishment of file system. Kernel transplantation includes the transplantation of network devices, LCD and USB drivers. This paper gives the transplantation of relevant programs for the design of this system.

2. Boot loader migration

Boot loader is the first code to run after the system is powered on. This applet is used to initialize hardware devices and establish a map of memory space, so as to bring the software and hardware environment of the system to an appropriate state, so as to prepare the correct environment for the final call to the operating system kernel.

At present, the popular bootloaders mainly include u-boot and vivi. This design mainly takes S3C2410 as the hardware platform of the controller, so vivi with network function can be selected as the boot loader of the system. As a boot program, vivi is generally divided into stage1 and stage2. Stage1 mainly carries out equipment initialization according to the CPU architecture, which is usually implemented in short and concise assembly language, while stage2 is usually implemented in C language, which can realize more complex functions, and the code will have better readability and portability. In order to make vivi more suitable for the hardware platform of the system, it needs to be partially modified during design.

(1) Modify compiler

First, point the compilation options of makefile in vivi to the cross compilation tool chain of version 3.4.1 installed, and point the Linux folder “unux-include-dir =” required for compilation to the folder “linux-include-dir = / usr / local / arm / 3.4.1 / include” where the cross compiler is located, Change the entry to “linux-cross – / cross – / cross – / cross – 3 / cross – / cross – / cross -“.

(2) Modify startup parameters

Then modify the flash blocking in vivi according to the actual situation of the hardware platform. The system divides flash into four parts: the first part is used to store vivi of the system; the second part is used to store the startup parameters of vivi and Linux operating system; The third part is used to store the embedded Linux operating system; The last part is used to store the file system. The specific address and block size allocation are listed in Table 1.

How to design and implement the embedded wind power monitoring system

After modifying the above two items, you can compile vivi, and then burn the generated binary code to the first part of flash through JTAG, that is, the migration of vivi is completed.

3 kernel migration

Kernel porting, like bootloader porting, should be carried out according to the designed hardware platform. According to the design of the embedded system hardware platform, it is necessary to modify the kernel makefile file, set the flash partition, configure and compile the kernel, and complete the transplantation of network devices, LCD, USB and other drivers. The following is a brief introduction to the relevant transplantation of the hardware platform.

(1) Kernel compilation and transplantation

Before cross compiling the kernel, you need to configure the compilation options. Execute the “make menuconfig” command, enter the syetem type option, select the support for S3C2410 system board, then configure file system and block device, then use the “make dep” command to set dependencies, and then use the “make zimage” command to compile. The cross compilation time of compiling kernel is relatively long. Finally, a file zimage will be generated, which is the arm linux kernel file after successful compilation. Writing the compiled kernel image file to flash completes the kernel migration.

(2) Network device migration

In the system, CS8900A is used as the network chip, which supports a maximum transmission rate of 10 Mb / s. It uses ngcs3 of S3C2410 as the chip selection line and IRQ_ Eint9 acts as an external interrupt signal line. The driving migration method is as follows:

1) Add the driver files cs8900. H and cs8900. C of the chip in the directory of Linux / driver / net / arm:

2) In smdk2410_ Complete the corresponding register setting in init function; At cs8900_ Set the network control register of S3C2410 in the probe() function: add_ raw_ writel(0x221ldll0,S3C2410_ BWSCON); And_ raw_ writel(0x1f7c,S3C2410_ BANKCON3); Two statements;

3) Map the physical address (0x19000000) of the network card to vsmdk2410_ ETH_ The virtual address that IO points to, that is, smdk2410 in the / arch / arm / mach-s3c2410 / mach-smdk2410. C file_ Add the following content to the iodesc [] structure array: {vsmdk2410_ ETH_ IO,0x19000000,SZ_ 1M,MTl_ DEVICE};

4) Configure makefile and kconfig files of network device driver, and modify the header file partially.

(3) LCD transplantation

The S3C2410 LCD driver has been included in the 2.6.16 kernel. Therefore, the main work of transplantation is to initialize the driver and LCD screen according to the actual situation. S3C2410 is equipped with five LCD controllers. Each controller has different functions. It is necessary to set the parameters of each controller to start LCD smoothly. These parameters include: LCD screen type (TFT screen or CSTN screen), color digit, verticality, levelness, polarity of control signal line, resolution of LCD screen, etc.

The system adopts sharp 8.0-inch TFT LCD. Refer to the LCD manual and set the parameters of each register according to the actual situation, as listed in Table 2.

How to design and implement the embedded wind power monitoring system

After setting the LCD parameters, initialize the function smdk2410 on the platform_ devices[]_ Start the LCD in initdata. Finally, modify the kconfig in the drivers / video directory and the makefile file in the drivers / video directory.

4 file system establishment

Each operating system has its own file system. For example, windows generally adopts FAT32 or NTFS file system format, Linux adopts ext2 or ext3 file system format, and the embedded Linux operating system is based on a file system for embedded Linux called yaffs2 (improved version of yaff file system). Therefore, the Linux kernel can be designed according to the hardware platform of the system. Build yafts2 file system, and the steps are as follows:

(1) Create the yaffs2 directory FS / yaffs2 in the kernel, and copy the downloaded yaffs2 code (the source code of open source yaffs2 can be downloaded from the Internet) to the directory below;

(2) Modify kconfig and makefile to configure yaffs2;

(3) Generate makefile and kconfig files in yaffs2 directory;

(4) Modify the NAND partition in the kernel according to table 1;

(5) When configuring the kernel, MTD support and yaffs2 support should be selected;

(6) Compile the kernel and download it to the flash of the development board;

(7) Make the root file system and download it to the specified address of flash (the address is shown in Table 1).

So far, the software and hardware platform required for the development of wind power monitoring system has been built. Figure 2 shows a screenshot of the wind power generation monitoring system based on the built platform and developed using QT / embedded.

5 Conclusion

Mastering these transplantation and development technologies is very important for the development of embedded Linux application system. At the same time, it also has a certain reference significance for the development of other types of embedded systems. An embedded system development platform based on Linux 2.6.16 kernel is constructed for the embedded platform based on S3C2410 (which expands a variety of peripheral devices, including LCD, a / D, network chip, etc.) to meet the needs of the development of wind power monitoring system.

Source: China Electronics Network

Leave a Reply

Your email address will not be published. Required fields are marked *