Design and implementation of embedded web server based on arm and linux
Upcoming SlideShare
Loading in...5

Design and implementation of embedded web server based on arm and linux



for more projects visit @

for more projects visit @



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Design and implementation of embedded web server based on arm and linux Document Transcript

  • 1. 2010 2nd International Conference on Industrial Mechatronics and AutomationDesign and Implementation of Embedded Web Server Based on ARM and LinuxYakun Liu Xiaodong ChengCollege of Electronic Information EngineeringInner Mongolia UniversityHohhot, P.R. paper achieves the design of an embeddedWeb server, which takes ARM920T-S3c241Os chip as its coreand Linux as its operating system. This is because Linux canbe reduced and transplanted. The method used to transplantWeb server Boa on the embedded Linux platform is alsodiscussed in detail, and through CGI technology functions ofdynamic Web page is successfully realized. Relevantexperiments show that after the Web server is embeddedinto the network video monitoring system, dynamic pageinteraction can be achieved between the Web server and theembedded system via the browser in the Windowsenvironment.Keywords-embedded systems; linux; embedded Web server;Boa; CGlI. INTRODUCTIONWith the rapid development of Internet informationtechnology, those fieldbus and Industrial Ethernet whichare of high-specialization and high cost and are used incontrol areas are gradually being replaced by Ethernet [1].Embedded systems and Internet technology are combinedto form a new technology - the Embedded InternetTechnology, which developed with the popularization ofcomputer network technology in recent years [2]. Withoutrestrictions from devices and systems, this technologycould function in the hardware and software as long asthey are connected. Only by using web browser throughthe Ethernet and TCPIIP protocol can users get access tovarious information [3]. It brings great convenience toremote video monitoring and equipment management. Themain advantages of using embedded Web server mainlyinclude: (1) the client can be freely set and the browser canbe used directly without installing additional clientsoftware; (2) for the harmonization of Web standards, it ispossible to develop cross-platform transplantation; (3) theoperating system Linux, which can be reduced andtransplanted, provides a convenient, fast and simplemethod for embedded systems and Internet access [4].II. OVERVIEW OF EXPERIMENTAL PLATFORM FORTHE EMBEDDED WEB SERVERThe design in this paper applies S3C241Os32-bit ARMmicroprocessor which takes ARM920T as its core. Thismicroprocessor has rich resources, including Clock, USB,SDRAM, UART, Nand Flash, LCD, RS232 Interface,Ethernet Interface, JTAG, Power, etc. These modules canhelp achieve Internet services. The logical structure of thehardware is shown in Fig. l.978-1-4244-7656-51101$26.00 ©2010 UARTSDRAM LCDNand Flash RS232USB EthernetPower ClockFigure 1. The structure of system hardwareIII. EMBEDDED WEB SERVERA. The system diagrame ofEmbedded Web serverThe system structure of embedded Web server isshown in Fig. 2. The entire system uses BIS mode. Theclient PC is connected to the Internet through a browserand then gets access to the embedded Web server. Throughthis way, remote login and operation are realized [5].Compared with the traditional CIS mode, this mode issimple to use, convenient to maintain, and easy to extend.i·················�:���·�·��··�:�··��·�:;····lFigure 2. The system diagram of Embedded Web serverB. The choice ofEmbedded Web serverGenerally speaking, the embedded devices havelimited resources and dont need to handle the requests ofmany users simultaneously. Therefore they do not need touse the most commonly used Linux server Apache. Webserver which is specifically designed for embedded devicesare applied in such case [6]. This kind of Web serverrequires relatively small storage space and less memory torun, which makes it quite suitable for embeddedapplications.The typical embedded Web server has three kinds,namely httpd, Boa and thttpd [7]. As the simplest Webserver, httpd has the weakest functions among the three. Itdoes not support authentication and CGI technology whileICIMA2010316
  • 2. Boa and thttpd support these functions [8]. If Web serveronly provides some static web pages such as simple on­line help and system introduction, then a static server canbe adopted; if you need to improve system security orinteract with users such as real-time status query andlanding, then you have to use dynamic Web technologies.In such situation, either Boa or thttpd can achieve thesegoals. In the present research, we adopt Boa, the Webserver suitable for embedded system, because thttpd hasless function and needs far more resources to run.e. The principle ofEmbedded Web server BoaBoa is a single task Web server. The differencebetween Boa and traditional Web server is that when aconnection request arrives, Boa does not create a separateprocess for each connection, nor handle multipleconnections by copying itself. Instead, Boa handlesmultiple connections by establishing a list of HTTPrequests, but it only forks new process for CGr program. Inthis way, the system resources are saved to the largestextent [9].Like a common Web sever, an embedded web servercan accomplish tasks such as receiving requests from theclient, analyzing requests, responding to those requests,and finally returning results to the client. The following isits work process.• Complete the initialization of the Web server, suchas creating an environment variable, creatingsocket, binding a port, listening to a port, enteringthe loop, and waiting for connection requests forma client.• When there is a connection request from a client,Web server is responsible for receiving the requestand saving related information.• After receiving the connection request, Boaanalyzes the request, calls analysis module, andworks out solutions, URL target, and informationof the list. At the same time, it processes therequest accordingly.• After the corresponding treatment is finished, theWeb server sends responses to the client browserand then closes the TCP connection with theclient. For different request methods, theembedded Web server Boa makes differentresponses. If the request method is HEAD, theresponse header will be sent to the browser; If therequest method is GET, in addition to sending theresponse header, it will also read out from theserver the URL target file of the client request andsend it to the client browser; If the request methodis POST, the information of the list will be sent tocorresponding CGI program, and then take theinformation as a CGI parameter to execute CGIprogram. Finally, the results will be sent to clientbrowser. Boas flowchart is shown in Fig. 3.specifieddata toWebbrowsersend theresponseheader toWebFigure 3. Embedded Web server flowchartD. The creation ofan embedded Web serverIn the embedded Linux system, the creation of a Webserver Boa has the following steps:1) Download the source code ofBoa. The source codecan be downloadfrom http://www. [10].2) Transplant the procedure of Boa. Decompress thedownloaded source code and lead it to enter "scr"subdirectory ofthe source directory [11]:#tar xzvf boa.tar.gz#cd boa/srcCreat "Makefile" file:#/configureModify "Makefile" file. Mainly modify the cross­compiler, find CC=gcc, change it into CC=armv41-unknown-linux-gcc, save these changes and quit"Makefile" file.Specify the root directory path of Web server:enter"boa/scr/" directory, and specify the absolute path ofroot directory of the Web server by modifying thestatements which are in "defines.h" file.#define SERVER_ROOT"/mnt/yaffs/share/www/boa/http"Then run "make" to compile, it will creat a file named"boa" in the directory of "boa/src". This file shall be theexecutable file of Web server Boa.3) Configure Boa so that it can support theimplementation ofCGI programs.Boa requires to establish a boa directory in the root filesystem"/mnt/yaffs/share/www". A configurationfile"boa.conf will be loaded when the boa boots. This filemust be edited before the boa program is running. There isalready a sample boa.conf in the Boa source directory. It317
  • 3. can also be modified on its basis. The foIlowingconfigurations need to be changed:Port 80 //set the port of WebOroup 0 //opening up the restrictions on the usergroupErrorLog/mntlyaffs/share/www/boa/log/boa/error_log//set the actual path of the error logDocumentRoot/mnt/yaffs/share/www/html //set thehome directory of the HTML fileScriptAlias/cgi-bini /mntlyaffs/share/www/cgi-bin//specify the actual path of the virtual path of the COlscriptScriptAlias/index.htmIl/mnt/yaffs/share/www/htmI/index.html //specify the actual path of the virtual path of theservers default page4) Test whether Boa can work normally, and whetherthe static HTML pages can be visited normally. In thispaper, NFS approach is used to test.According to the configuration of boa.conf, we copythe tested home page index.html into"/mnt/yaffs/share/www" directory. The IP address of theboard is set to be Weenter"/mntlyaffs/share/www/boa/src" through minicom,and then run "./boa", and visit the foIIowing website: on PC browser. Then we could seethe pages of "/mnt/yaffs/share/www/index.html". Thatmeans Boa works normaIly in the embedded targetsystems.IV. THE IMPLEMENTATION OF DYNAMIC WEB PAGESUNDER LINUXThere are many kinds of technologies such as COl,ASP, PHP JSP and so on, which are used to achievedynamic Web pages. If the dynamic pages are to berealized under Linux operating system, COl is preferred.COl [12](Common Oateway Interface) is a commoninterface standard which is applied to interact between theapplication of external expansion application and WebServer. COl provides the Web server with a channel toimplement external program. This service technologymakes browser and server interactive. COl is the programconsistent with this common interface standards andrunning on the Web server. COl programs can be producedin any programming language, for example, SheIl scriptinglanguage, PerI, Fortran, Pascal and C language and so on.The C language is chosen to write COl programs in thepresent paper.The flow chart is shown in Fig. 4, where the clientinteracts with the on-site I/O module through COlprogram.user requests forward requests Impart informationreturn processing return result Message responseresulesFigure 4. Interaction between the client and the on-site VO moduleAfter the daemon of Web server receives clientrequests, a child process wiII be created. Then this childprocess wiII set relevant data requested by COl asenvironment variables and meanwhile build two datachannels between external COl program and the server(standard input/output). Then the COl program assignedby URL is started and keeps pace with the child process inorder to monitor the implementation state of COI program.The result of disposition is passed to the daemon of Webserver through the standard output stream by the childprocess. Then the processing results are reported back tothe client by daemon as a response message.A COl program is usuaIly divided into two parts. (1)Receive data from submission form according to POSTmethod or OET method. (2) Oenerate the HTML sourcecode by means of printfO function and then correctlyreturn the decoded data to the browser.V. EXPERIMENT RESULTSWe load each driver and start the Web server on analready established experimental platform-S3c24 lOs. Inclient browser, we input the corresponding IP addresshttp://, and then the Web page is openedwhich is as shown in Fig. S.. , ."iA: _·�ltt.�11. ...,.11I!l _Z-)• lUI.". �� IHthne,o�J;ltIlllillUll;• .,...,r 6:!OUtIfl/lfle". .-:- -- ��-�.=� ---� ..� "s,: $f# "· ..a ,Figure 5. The page when the client Web browser accesses to the WebserverVI. CONCLUSIONThis embedded Web server is a separate module whichcan provide a standard interface. With slight modificationsit can be applied easily to embedded fields such as on-siteAC servo system, industrial control, and inteIIigentappliances. Therefore, it has a wide range of applicationprospects and great promotion value.The embedded Web server designed in this paper isbased on the ARM-Linux operating system. It succeeds innetwork video monitoring. The whole system has low-cost,good openness and portability, and is easy to maintain andupgrade. The Web server Boa selected in the presentresearch requires smaIl storage space and occupies lessmemory when its running. It also has more functions andsupports COL Communication between external expansionapplications and Web server can be achieved through COltechnology. This method can not only improve systemsecurity, but also make it possible to interact with usersand create dynamic Web pages.REFERENCES318
  • 4. [I] Wang Xianchun, Guo Jierong, Hu Weiwen, and Fan Xiping,"Design and Implementation of Embedded Web Server Based onARM and Linux," Micro Computer Information,vol. 23(5-2),2007,pp. 164-165.[2] Jacek W, "Embedded Internet technology in process controldevices," IEEE Internet Computing,Vol. 34,2000.[3] 1. Douglas, "Engineering Web Technologies for EmbeddedApplications," IEEE Internet Computing,May/June 1998.[4] Wang Tianmiao, Publication: Embedded System Design and CaseDevelopment. Beijing: Tsinghua University Press,2002.[5] Liu Yingshui, Xiao Zhengyu, and Sun Wei, "Embedded WebServer Based on ARM and Linux," Microcontrollers & EmbeddedSystems,june 2007,pp. 14-21.[6] Mi-Joung Choi,Hong-Taek lu,Hyun-Jun Cha,Sook-Hyang Kim,and 1. Won-Ki Hong, "An Efficient Embedded Web Server forWeb-based Network Element Management," International lourmalof Network Management,Vol. 10,May 2000.[7] Zhang Wenya., "Design and Implementation of Network VidioMonitoring System Based on Embedded Linux," SouthwestJiaotong University Master Degree Thesis,May 2009,pp. 32-33.[8] Li Weixuan,Zhao ling,Peng Zhicheng,and Xu Zhihao, "Researchof Remote Monitoring System Based on Embedded Web Server,"AECC Symposium,vol. 20,2007,pp. 147-148.[9] Liu Minying, "Design and Realization of a Remote MonitoringSystem Based on Web ", Dalian Maritime University MasterDegree Thesis,May 2008. pp. 40-49.[10] Zhao Huijuan, "The building of embedded Linux developmentplatform based on ARM9 and realization of Boa," SouthwestJiaotong University Master Degree Thesis,Match 2008,pp. 57-59.[11] R. Stones, and N. Matthew. Publication: Beginning LinuxProgramming(2nd Edition). Endland: Wrox Press,2003.[12] 1. Dwight, M. Erwin, R. Niles, cm Development Handbook.Machinery Industry Press.319