Nothing Special   »   [go: up one dir, main page]

Design and Implementation of An Embedded Web Server Based On ARM

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Design and Implementation of an Embedded Web Server Based on ARM

Mo Guan
School of Information Science & Engineering Shenyang University of Technology Shenyang , China 08guanmo@163.com

Minghai Gu
School of Information Science & Engineering Shenyang University of Technology Shenyang , China guminghai1@163.com

AbstractIn this paper, the embedded web server , which take Samsung corporation's ARM9-S3C2440AL processor as core, is designed, it's operating system is Linux, the system hardware architecture is presented. Then the process of the Linux operating system being transplated on ARM is introduced. The realization of Boa and dynamic interaction between browser and the embedded system by using CGI are especially analyzed. Finally the implemented embedded web server is tested to indicate that it responding rapidly and operates efficiently and steadily, which achieves the expectant designing purpose. Keywords- Embedded Linux; Web Server; Boa; CGI

I.

INTRODUCTION

The age of the PC equipments as a basic network node had been over, with the popularization of internet and the technology of embedded system. There are kinds of embedded equipments as network nodes, besides PC. Embedded equipments have infiltrated to the fields of traditional Ethernet. If user has a permission to access Web server, he can refer the correlative information. That takes a great convenience for administrator to manage and vindicate the equipments. Its a challenge that how to access action over IP[1]. This paper introduces a solution for embedded system access to Internet, through which we can remote access, monitor, maintain conveniently. The solution is based on Web and embedded technology. Its core is S3C2440AL processor on which there embedded Web server in ARM Linux platform. Its operating system is scissor-able, transplant-able Linux system. II. TECHNOLOGY OF EMBEDDED WEB SERVER Embedded web server[2] refers to import Web Server at the scene the monitor and control equipment, in the support of appropriate hardware platforms and software systems, transfer traditional monitor and control equipment into a internetbased , possessed with TCP/IP protocol as the underlying communication protocol and Web server technology as its core. The resource of embedded devices is limited, and do not able to handle multiple user requests, so the speci fically

designed for embedded Web server are needed instead of Apache used in Linux. In embedded Linux systems, the typical Web Server are Boa, httpd, thttpd and so on. Httpd is clearly inapp- ropriate to advanced applications which only supports static pages and does not support CGI, thttpd and Boa provide similar functions except thttpd requires resources much larger when running compared with Boa. Boa is a single task of HTTP server, It is different from traditional Web server, It is not calls subprocess to handle multiple connections produced simultaneously through the fork, but reprocesses all the ongoing HTTP connections that only fork calls CGI programs, automatic directory generation, and file compression implem- entation. This is vital important for embedded systems by saving the maximum extent possible system resources[3].

Figure 1. Architecture of Boa server

Based on the above exposition, Boa applied to the embedded platform has many advantages, therefore Boa is used as Web server in this paper. Its architecture[4] showed in Figure 1. III. DESIGN OF THE HARDWARE SYSTEM

S3C2440Al processor is used as core of the hardware platform in this paper. Figure 2 is the block diagram of hardware system. Include: serial port, Ethernet interface, JTAG port, storage systems and so on.

_____________________________________

978-1-4244-6055-7/10/$26.00 2010 IEEE

612

Figure 2. Block diagram of hardware system

The frequency Samsung S3C2440AL is 400MHz and can up to 533MHz in the maximum. According to it s mode of internal circuit. 12MHz chosen for the crystal. TAG Joint Test Action Group is an international test protocol standard, software simulation, single-step debug and u-boot download can be carried out through the JTAG port, it's a simple and efficient means of developing and debugging embedded systems. The SDRAM capacity in the system is 64MB, working voltage is 3.3V, data bus is 32bit,clock frequency up to Auto-Refresh and Self-Refresh are both supported. For supporting boot loader in the NAND Flash a buffer named Steppingstone is equipped in SDRAM.When the system starting,the first 4Kbyte content in NAND Flash is load to the Steppingstone and be executed.When Startup code, the contents of the NAND Flash are copied to the SDRAM in general. The datas in NAND Flash are checked when ECC is used. The main program will be executed on the SDRAM based on the completion of copy[5]. S3C2440AL UART provide three serial I/O port, each port can operation on interrupt or DMA mode. UART can support a maximum baud rate of 115.2Kbps when using the system clock. Each UART channel for the receiver and transmitter includes two 64-bit FIFO. The LCD interface of S3C2440Al is integrated 4-wire resistive touch screen interface which can be directly connected to four wire resistive touch screen. IV. DESIGN OF THE SOFTWARE SYSTEM

The Transplant of Linux Kernel Linux is used as operating system because Linux system is a hierarchical structure and completely open it s kernel source, the important feature of Linux is portability to support a wide range of hardware platforms, can run in most of the architecture. Contains a comprehensive set of editing, debugging and other development tools, graphical interface, a powerful network supporting and rich applications. In addition, the kernel can be reduced by configuring. Transplantation include the following sections[6]: 1) Kernel configure. Make menuconfig is used to configure Linux kernel. Support TCP/IP protocol in the Networking options, Add Network device support option in the Device Drivers, and select DM9000 support in Ethernet (10 or 100Mbit). 2) Modify the corresponding kernel cod 3) Connect script. 4) Mount the file system. 5) Driver transplantation (USB device driver migration, LCD driver transplantation, etc.). Linux development platform is build when above contents are compiled and wrote into system board flash. B. Set Up of Web Server 1) Download Boa source[7]. The boa-0.94.13 version is used in this paper. 2) Decompress and compile Boa source. Use ./configure generated Makefile files,modify Makefile, chang CC=gcc and CPP=gcc E for CC=arm-linux-gcc and CPP=arm-linuxg++ -E. 3) Compile and optimize. 4) Configure Boa. 5) Test Boa run. NFS is used for testing generally,first, copy Boa web server to the directory of file system sbin/, copy Boa configuration file "boa.conf" to the directory of file system etc/boa/.Next, add the application to file system. Establish a web directory which contents of the cgi-bin directory and index.html static HTML pages following the in the shared directory. Last, start target board using NFS guide. Set the target board's IP address is 10.16.12.149 Open the the browser in PC, input http://10.16.12.149, page will appear as shown in Figure 3.

A.

Software development process based OS includes: the establishment of cross-compiler, the transplant of Bootloader, the transplant of embedded Linux, the deve- lopment embedded Web server. To begin with, system cross-compiler environment using EABI-4.3.3 is estab- lished. what's more, uboot that developed by the German DEXN group is used as Bootloader. The func- tion of Bootloader is to initialize the hardware devices, establish memory mapping tables, thus establish appr- opriate hardware and software environment, prepare for the final call to the operating system kernel. Besides, yaffs file system is made.
Figure 3. Static page of index.html

613

C.

Implement of Dynamic Web Pages There are many different technologies to achieve dynamic Web page, commonly used with CGI, ASP, PHP, and JSP and so on. In Linux, CGI often used to achieve dynamic page. 1) Overview on CGI CGI provides a access to execute external program for Web server, this server technology can be made to interact between the browser and server. CGI programs can be written by any programming language, for examp- le Shell, Fortran, Pascal, Perl, C and so on But with CGI programs written in C language proved have a executionspeed, security, etc, So C language is used for CGI program design in this paper.

Figure 4. Work process of CGI

CGI's working process shown in Figure 4, concrete steps are as follows [8]: a) Users in the client browser make a request to the Web server. b) Web server will make a judgement on the request. Web server will transfer file directly to the client browser if the request is a static file, else Web server will activate the CGI program. c) Daemon of Web server create a subprocess which sets environment variables establishs two standards I/O data channels between the server and the external CGI process d) Web server startup the CGI program that URL specified. CGI program reading and processing client's input data through environment variables and standard input Stdin and calling the appropriate external program in accordance with the request. e) CGI will pass the result through the standard output Stdout to the server daemon after processing, and then daemon transfer results back to the client browser in HTML format. 2) Standard of CGI interface CGI interface standard including standard inputs, environment variables, standard output. Client submitted requests mostly by FORM. GET method and POST method are two methods of FORM submit, by which method depends on the setting in FORM METHOD. When use GET method, CGI program obtain data from the environment variable called QUERY_STRING, GET method is usually used to get the data do not want to change from the server. However, if the string is too long, POST method is often used, when POST method, WEB server

transmit data by Stdin, but EOF character is not used to mark in the end of data, so environment variable CONTENT_LENGTH shoud be used to read data length. The standard Stdout used to output the result that handled by CGI programs, Outputs include MIME head- ers, actually display of the browser and HTML source code. 3) Invoke of CGI program CGI program calls generally have the following two ways: 1 Directly. 2 Combined with FORM. When user submits an HTML FORM, first,Web browser encodes the datas form FORM, the format is as follows:name1=value1&name2=value2&name3=value3&valu e4= value4&...This format shall be URL encoded, procedures need to be analyzed and decoded. Then change some special characters into the corresponding ASCII characters. These special characters are: +: convert + to the space character; %xx: according to the value of xx to convert into the corresponding ASCII characters. Last, CGI will process the final results back to the client[9]. 4) Testing of dynamic Web page Dynamic Web page can be tested after the realization of the CGI. Firstly a simple helloweb.c file is written, then compile it: #arm-linux-gcc o helloweb.cgi helloweb.c #cp helloweb.cgi/opt/EmbedSky/root_nfs/web/cgi- bin Finally, http://10.16.12.149/cgi-bin/helloweb.cgi is entered on the browser in the PC and then the testing page (helloweb.cgi) will be opened, it shows as Figure 5.

Figure 5. Dynamic page of helloweb.cgi

V.

CONCLUSION

In this paper, ARM and embedded Linux OS are used as hardware and software platform, Boa is used as a Web server, Its unique approach and direct calls to connect the operating system's file read mode, which greatly improved the performance of the system. Compared to the Apache Web server working on Linux, Boa Web occupies less system resources, higher operating efficiency and responding more rapidly, Boa can stably run on the target board, easy to use and maintain. In addition, the solution based on "embedded Web server" is also easy to expand, conform to small client-

614

side requirements , low cost and convenience, etc. It can be widely used in many fields, for example: automation control, information appliances, intelligent instruments and so on. And has a high application value. REFERENCES
[1] Bin Liao, Weiqiong Ye. The design of long-distance control based on ARM chip by SMTP protocol, Microcomputer Information, April, 2007, pp. 19-21 Rongxin Li, Guoping Yu. Research of Embedded Web Server Based on ARM. Microcomputer Information, August, 2007, pp. 145-146. Kai Song, Liping Yan, GanLan. Design and implementation of embedded web server, Computer Engineering and Design, February, 2009, pp. 808-810. Xianfeng Che, Kaiyuan Meng, Cao Qingnian. Embedded web server research and realization based on ARM. Microcomputer Information, September, 2008, pp. 86-88. Samsung S3C2440 manual. EMBEDSKY, Linux System porting step_by_step manual. http:// www.embedsky.net Larry D,Jon N. Boa Websever[EB/OL].(2005-02-23).[2009-03-17] http://www.boa.org Chengyi Cui, Xiangjun Jiang. Study and Design of Embedded Web Server Based on ARM9. Electronic science and technology, September, 2007, pp. 64-67. Yang Song, Biao Ma, Xiaoli Qin. Investigation of key technology based on the embedded system of boa, Journal of dalian nationalities university, May, 2007, pp. 34-36.

[2] [3]

[4]

[5] [6] [7] [8]

[9]

615

You might also like