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





 

Issue 161 December 2003
Easing into eZ80Acclaim!



EZ DOES IT

A collection of configuration files is used to control the behavior of components within the ZTP. The ZTP configuration files are kept in the conf directory. Modifying parameters inside the numerous ZTP configuration files performs things like enabling or disabling DHCP and memory organization.

The structure containing default IP addresses in Listing 2 is a duplicate of the information contained in the bootinfo.c configuration file. The bootinfo.c file is part of the network configuration file group, which alters the behavior of the TCP/IP stack. These IP addresses are used as the default IP addresses and can be overridden with services performed by DHCP. You saw this override in action as the eZ80F91 module took on the DHCP-assigned IP address of 192.168.0.12 instead of the default addressing you see in Listing 2.

The extern Webpage website[]; statement actually points to the web site definitions and contents, which are kept in a separate project folder. All of the static and dynamic web pages and the graphics (i.e., JPEG, GIFs, etc.) that make up the web pages are defined in the web site’s code. You can also define CGIs and Java applets in the web site code. The ZTP web site code is easy to understand because you can relate the objects you would normally use to build an HTML page with the statements in Listing 3, which is a code snippet that is responsible for the modified eZ80Acclaim! web page. The
ttp_init(http_defmethods, httpdefheaders,website,80);

statement pulls in all of the default parameters needed by ZTP to effect a web server. I pulled off my tomfoolery by substituting one of the original JPEG files (Acclmheading.jpg) with my own little JPEG message: “THIS IS REALLY EZ!!!.”

Listing 3—Take a look at the web site I have been talking about. It’s easy to see the relationships between the web site contents and the declarations inside the web page code.

I modified everything else using a standard web page-authoring program. The web server in the demo uses default methods and headers built into the ZTP HTTP configuration. The website portion of the HTTP statement is the name of the web site project that will be loaded when the HTTP server starts up on port 80.

Modifying the web site code was easy. All I had to do was make my changes in the web page content and rebuild the web site project. The output of the web site build is a library module. To effect the visual changes in the web site, the library module that was produced by the web site build process is copied into the ZTP library folder. When the code in Listing 2 is rebuilt, the new web site library module is picked up.

The real fun started when I decided to mess around with the ZTP shell. The shell initialization process involves opening a serial port and passing the serial port’s ID to the ZTP’s shell initialization function. My first intrusion into the shell was done with the static char *fred_name="fred"; statement. I then added the mycmds.[2] statements and inserted a little function called x_fred.

To accommodate my changes to the shell menu, I had to increase the added command count from two to a three in the mycmds = (struct cmdent *) getmem( sizeof(struct cmdent) * 3); statement. It took a few “ERROR did not compile” messages for me to get the command count numbers and command names right. After I had gotten successful compiles and links, I had to up the numbers from two to three in the shell_add_commands(mycmds, 3); statement to make my added menu item appear in the shell’s function listing shown in Photo 4.

(Click here to enlarge)

Photo 4—I managed to add a shell command called fred that simply prints the message “Cool!.”

 EZ-ING OUT

The eZ80Acclaim! development kit is much like the strings I put on my guitar. You can get really heavy action by putting ZTP to work with the eZ80Acclaim! hardware, or you can keep it light and exploit only the eZ80Acclaim!’s built-in hardware without using shells, TCP/IP stacks, and multitasking kernels. No matter which set of “strings” you choose to use, the eZ80Acclaim! development kit is easy, and it’s embedded.