circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 139 February 2002
eZ Embedded Web


by Tom Cantrell

Cut the Fat

The Zilog demo page, taking full advantage of the spacious memory, shows off many of the advanced capabilities of the board and software: dynamic web pages, CGI, Java, HTML, GET, POST, and so on. The point is that this isn’t some emasculated hack of a stack. It will pretty much take anything a top-tier web page design program can throw at it. The only guidelines are to build your web site in a flat directory (all files in one directory) and perhaps use one of the widely available HTML optimizer packages to strip out comments and other unnecessary stuff from the resulting web files.

However, being somewhat of a ’Net newbie, I thought it would be helpful to come up with the simplest possible example. Time for a Hello World program, or in this case, web site (see Photo 3).

Photo 3—With high-level network API functions in hand, an embedded web page is only a few lines of C code away.

 

As you can see in the photo, the program (hellomain.c) is actually quite simple. A web site is simply defined as a collection of HTML pages and objects such as a .gif or .jpeg. When you add a web file (specifically, *.html, *.gif, *.jpeg, *.class, or *.wav) to your project, ZDS automatically converts it to a C equivalent and includes it with the rest of your source files.

When all was said and done, my Hello World application ended up consuming about 150 KB versus nearly 500 KB for the Zilog demo page. The difference was the Hello World web site was about 250 KB smaller than the demo page and I also managed to strip out another 100 KB of optional includes such as the operating system console shell.

Even my downsized version didn’t go all the way. If you really get into it, you can squeeze even more in the way of unneeded protocols and features out of the stack. You can, but the point is you don’t have to. If you want all the bells and whistles and have the memory to spare, feel free to go for the gusto.