Sunday 11 November 2012

How to make a web server

Any embedded device can be connected to the cloud and provide its own service,So after choosing you hardware such as a ARM kit or even a FPGA, The simplest method is to port an operating system on it.

Check link for porting linux on arm9
Check link for porting FreeRtos on arm7
check link for porting RT-Linux on powerpc (FPGA)


Once you have ported an OS , you got to enable ethernet facilities .

Then you can run a socket based program (check tutorial) , with this program running all you got to do is access your machine from any other PC connected to the ethernet by specifying the IP address.
That's it, by pinging the server it can execute any task as defined by your program,(Note socket just provides the means of connection,the program must also process data).

If i define port id as 80 and provide service of handling web pages or html contents , then i would have developed a HTTP server.

For a FTP server (check sourcecodes) you have to use a port id of 21.


Porting FreeRtos on ARM 7

Start by downloading a FreeRtos kernel in this case V5.3.0 , but feel free to use your favorite version from here which is completely free.And the ARM7 is KEIL MCB2100

We shall also be needing Flash Magic from here and Keil uVision Integrated Development Environment.

Start uVision IDE (I have used uVision 4).

Open project.
Select RTOS Demo from FreeRtos folder
Go to Project in uVision and select Device .
Then build the target
Here you may have to set the crystal frequency and other options (Check the data sheet for your ARM), in my case the frequency would be 12Mhz
In the output tab select create HEX file

Now Build Target in Project tab.This creates the hex file in your directory.
Start Flash Magic
     communication settings
        Select Device (mine would be LPC2129)
        COM port COM1(or others)
        Baud rate 115200(your choice)
        Interface none
        Oscillator 12 (Mhz)

Erase All Flash

Select Hex File

Set "Verify after programming"

Start it!

Thats it , FreeRtos is on ARM7 , you are greeted by blinking LED's
Now prior to generation of HEX file you can EDIT the FreeRtos source code , You can even define your own task in its main program; Thus you can execute just any application.