Transplantation and development of μc LINUX embedded system based on ADSP-BF533

Source: Internet
Author: User

Transplantation and development of μc LINUX embedded system based on ADSP-BF533
[Date: 2008-10-7] Source: China Power Grid Author: Wu Chuan, Wang Bin [Font:Large Medium Small]

 

The Blackfin Processor is the first 4th-generation DSP product based on the number architecture (MSA) jointly developed by the US simulator Corporation (ADI) and Intel Corporation, it is a big series of 16-digit products of Adi. This new product is a general DSP chip designed for communication and Internet applications and is suitable for processing a large number of images, sounds, text and data streams widely used in the Internet, it can also be used in automotive electronic visual systems, broadband wireless systems, consumer multimedia electronics, digital cameras, multi-channel VoIP, security and supervision, set-top boxes and video teleconference. The ADSP-BF533 used in this article is a typical representative of the Blackfin series processor.

1μclinux Introduction

μC Linux is derived from the Linux 2.0/2.4 kernel and follows most of the mainstream Linux features. It is dedicated to CPU without MMU and has made many small tasks for embedded systems. Applicable to processors without virtual memory or memory management units (MMU. Due to the appropriate cropping and Optimization on the basis of standard Linux, a highly optimized and compact embedded Linux is formed. Although its size is small, μClinux retains most of the advantages of Linux: stable, good portability, excellent network functions, complete support for various file systems, and a wide range of standard APIs.

The main features of μc Linux are as follows:

(1) Memory Management

This part is the biggest difference between μClinux and traditional Linux. For μClinux, it is designed for a processor without MMU, that is, μClinux cannot use the virtual memory management technology of the processor, and μClinux still uses paging Management of memory. When the system starts, the actual memory is paged. When the application is loaded, the program is paged. However, due to the absence of MMU management, μClinux uses a real-memory management policy. This affects many aspects of system work.

(2) kernel Loading Method of μClinux

The kernel of μClinux can be run in two optional ways: directly running on FLASH, or loading and running into memory. Because RAM has a higher access rate than FLASH, the latter can reduce memory needs and run faster.

(3) μClinux File System

μC Linux uses the romfs file system. This file system requires less space than the general ext2 file system. This is because the kernel supports the romfs file system and requires less code than the ext2 file system, And the romfs file system requires less storage space than the simple File System superblock.

(4) application library of μClinux

Another approach to miniaturization in μClinux is to rewrite the application library. Compared with the ever-growing library glibc μclibc, libc is simplified.

(5) Executable File Format

μClinux uses the flat executable file format. In addition, μClinux also provides general Linux APIs to support the complete TCP/IP protocol stack and a large number of other network protocols, including NFSext2ROMfs and other file systems.

2. Create a development environment for μC Linux

The biggest difference between embedded system development and general application development is that the former requires a special hardware environment, while the latter is generally based on a specific operating system or distributed platform. The latter platform has abstracted the hardware or network media, so that system developers do not need to do this. In the development of embedded systems, this is also done by developers.

The development environment of an embedded system is generally divided into two parts: HOST and TARGET. The host is a development platform used to run various tools in the development process (for example, the Linux operating system and the integrated development environment Visual DSP ++ provided by ADI). The target board is a running and testing platform, is the final resident environment of the embedded system. Communication between the host and the target board is required in some way, such as using the RS 232 serial port or network port. Communication aims to send control commands and transmit data while obtaining feedback. Figure 1 shows the hardware environment for system transplantation.

The hardware platform 1 of the target board is shown as follows:

The host PC uses the UART connection of COM1 and BF533 to complete necessary control functions on the Target Board through the serial port. The ADSP-BF533 target board designed in this paper is equipped with a SMSC LAN91C111 ethernet card chip and the host end to establish the original (raw) IP connection, using the link layer address to complete the transmission of mass data.

After the hardware environment is created, you need to create a software development environment. The software environment mainly refers to the Cross-compiling environment of the Blackfin architecture. To build a cross-compilation environment, you must first have a cross-development tool. A cross-compilation tool is a set of tools that run on one processor but can compile the commands executed on another processor. It consists of a set of components used to compile, compile, and link the kernel and applications. Through compilation, the μC Linux kernel and applications can run on the target device.

Compile μ Clinux generally uses GNU development kit as the cross compiler tool chain, which includes a series of development and debugging tools. On the official website http: javasblackfin. μ Clinux. org, a cross-compilation tool for the blackfin series processor kernel is provided. After downloading the tool, follow the instructions to decompress it to the corresponding folder of the Linux system, and set the system environment variables so that the directories of these cross-compilation tools are global environment variables. So far, the software development environment of μc Linux has been established.

3 Boot the kernel using U-Boot

U-Boot (Universal Boot Loader) is a popular open source project that complies with the GPL conditions. It is also a common Boot Loader in Embedded Linux systems. Its function is to initialize hardware devices, change the operating mode of the processor, reorganize the interrupt vector, and create a memory space ing diagram, in this way, the hardware and software of the system are taken to a suitable state or a specific State customized by the user, so as to prepare the correct environment for the final loading of the operating system kernel.

U-Boot has the characteristics of open source code, developers can cut according to their own needs; supports a variety of processors and embedded operating system kernels; has a variety of device driver source code: supports a Boot mode; this article uses U-Boot to guide the μClinux kernel because of its powerful, mature, and stable functions. U-Boot relies heavily on the underlying hardware. Different CPU or embedded board devices need different U-Boot devices. However, this article focuses on the transplantation of μClinux, so here we will not detail the specific implementation process of U-Boot.

After the system is powered on, U-Boot starts from the OxO address and re-configures the memory ing, as shown in 1, and runs the solidified kernel of μClinux.

U-Boot can be downloaded to the target board using the simulation software Visual DSP ++ of ADI through the simulator or JTAG port.

4μclinux kernel compilation and Transplantation

As the core of the operating system, the μC Linux kernel manages the processes, memory, device drivers, file systems, and network systems of the system, and determines the system performance. The μc Linux kernel adopts a modular organizational structure. The system functions are increased or decreased by adding or removing kernel modules.

4.1 Kernel configuration

Although most of the kernel code of μClinux is independent of the processor and its architecture, the underlying code is based on a specific system. Although there are similarities between systems, their Interrupt Processing context, memory ing maintenance, task context and initialization process are unique. These routines are stored in the arch/directory of the μClinux code tree. You need to configure the kernel code based on your hardware platform. The configuration process is as follows:

You can download the kernel source code of μClinux-list from the official website http: // blackfin. μ Clinux. org. Run the unzip command: After extracting tar-xvfμclinux-dist.tar.gz, the/μ Clinux-dist directory is generated. After adding the directory, compile the kernel in the following order:

(1) make menuconfig; enter the menu configuration command;

(2) Select the platform type and library used

In this paper, the target board selection: AnalogDevices/BF533-EZ-KIT and μc-libc library. In the configuration column, select Load an AlternateConfiguration File and click OK to exit the configuration column;

(3) make dep; search for dependencies;

(4) make clean; clear all target files, module files, and some temporary files generated when the kernel was previously constructed;

(5) make lib_only; Compile the library file;

(6) make user_only; Compile the user application file;

(7) make romfs; generate the romfs file system;

(8) make image; generate the image file and input it to the target board through the Jtag port;

(9) make; by using makefile files in each directory, a large number of target files are generated under each directory.

After the above steps are completed, the compilation of the source code of μClinux is completed. Finally, three kernel files are displayed in the/μ Clinux-dist/images Directory: linux. dxe, linux. bin, and zImage. bin. If the compilation fails, locate the Error Based on the prompts during the compilation process and re-compile it until the compilation is successful.

4.2 modify the configuration kernel code

Kernel image files generated directly by source code compilation won't be started successfully. You need to configure them based on your target board. You need to modify the system startup Initialization Files crt0_ram.s, sysinit. c, and ram. ld.

In crt0_ram.s, You need to modify the base address, memory size, and start address based on your target board. In sysinit. c, you need to modify the chip selection settings for FLASH and SDRAM respectively. Modify the kernel connection loading address in ram. ld. After completing the above changes, recompile and generate linux. dxe and other files.

Download and execute the 4.3 μClinux Kernel

The μc Linux kernel has two optional running modes: one is to run directly on FLASH, and the other is to load and run in memory, when the system starts, it reads the compressed kernel code from FLASH (memory space is limited, so kernel code needs to be compressed) to the memory for decompression, and then starts execution, this method is faster than the first one (RAM access is faster than FLASH ). Select the second method.

Compiled kernel files can be developed by Visual DSP ++ by using the network port or serial port. download dxe to the FLASH of the target board, and start the kernel from the set entry address (generally 0x1000.

Start μClinux and you will be able to see the welcome information and simple shell prompt of μClinux on the Super Terminal, as shown in Interface 3.

5. Add an application under μClinux

For convenience, the application code at the user-layer of μClinux is stored in the/μClinux-dist/user/directory. Otherwise, you need to redefine many macros by yourself, which are prone to errors. The specific implementation process is as follows:

(1) Create the user/app folder of the application under the user directory of the working directory and then write the application. The writing method is the same as that of a common application;

(2) Add the following sentence to the file/user/Makefile to add your application to the compilation list of the μClinux system;

Dir_MYM (CONFIG_USER_MYAPP) + = app

(3) Add the following statement to/config. in:

In this way, one configuration option is added during compilation. When this option is selected, the string "Config user MyApp" is defined as "Y". refer to the previous step, dir y + = app, the application will be compiled into the kernel

(4) To facilitate Kernel configuration, add help instructions on the application to/config. Help;

(5) return to the/μClinux-Dist directory and execute make to compile the kernel of the μClinux System and the application program.

6 knots

For embedded system developers, to apply the embedded operating system to the embedded system, the first task is to transplant the Operating System Based on Different hardware platforms. It is very important to master the porting method.

The porting method described in this article has been successfully applied to the development of multiple projects. Although the transplantation is aimed at the ADSP-BF533 of the Blackfin Processor chip, it focuses on the idea and method of transplantation. It also serves as a reference for porting μClinux to a hardware platform with Other Processors as the core.

In this paper, how to combine the Embedded Operating System μ Clinux with specific hardware, analysis of the process of porting μ Clinux to ADSP-BF533.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.