NET+OS with GNU Tools Programmer's Guide
Total Page:16
File Type:pdf, Size:1020Kb
NET+OS with GNU Tools Programmer’s Guide NET+Works with GNU Tools Programmer’s Guide Operating system/version: 6.1 Part number/version: 90000577_B Release date: March 2006 www.digi.com ©2006 Digi International Inc. Printed in the United States of America. All rights reserved. Digi, Digi International, the Digi logo, the Making Device Networking Easy logo, NetSilicon, a Digi International Company, NET+, NET+OS and NET+Works are trademarks or registered trademarks of Digi International, Inc. in the United States and other countries worldwide. All other trademarks are the property of their respective owners. Information is this document is subject to change without notice and does not represent a committment on the part of Digi International. Digi provides this document “as is,” without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of, fitness or merchantability for a particular purpose. Digi may make improvements and/or changes in this manual or in the product(s) and/or the program(s) described in this manual at any time. This product could include technical inaccuracies or typographical errors. Changes are made periodically to the information herein; these changes may be incorporated in new editions of the publication. Contents Chapter 1: NET+Works Introduction ..................................................... 1 Board support package................................................................................................. 2 HTML-to-C compiler .................................................................................................... 2 Security............................................................................................................................ 3 Chapter 2: Using the HTML-to-C Compiler ...................................... 5 What is the HTML-to-C compiler ............................................................................... 6 Web content.......................................................................................................... 6 Static and dynamic content and forms processing......................................... 7 Preparing to use the HTML-to-C compiler...................................................... 9 How the HTML-to-C compiler works............................................................ 10 Using the HTML-to-C compiler ................................................................................ 12 Creating a new project...................................................................................... 14 Removing obsolete data ................................................................................... 14 Adding or removing source files .................................................................... 15 Specifying the location of files......................................................................... 15 Generating C source files ................................................................................. 15 Setting or changing a project’s home page.................................................... 16 Editing URL files ......................................................................................................... 16 Opening the url.c file ........................................................................................ 17 Adding and deleting URLs .............................................................................. 17 Editing a URL..................................................................................................... 18 Setting the user and password of a URL........................................................ 18 v Chapter 3: Using the MIBMAN Utility .................................................19 Overview ...................................................................................................................... 20 SNMP.................................................................................................................. 20 Scalar MIB objects ............................................................................................. 21 MIB tables........................................................................................................... 21 Traps ................................................................................................................... 22 Action routines .................................................................................................. 22 Implementing a MIB: an example .................................................................. 23 Converting an SNMP MIB into C code.................................................................... 23 Step 1: Using SMICng....................................................................................... 23 Step 2: Using MIBMAN.................................................................................... 24 Step 3: Final integration ................................................................................... 36 Writing action routines............................................................................................... 37 Action routines for scalar objects.................................................................... 37 Action routines for tables................................................................................. 42 SNMP OID and string index values............................................................... 51 Chapter 4: Using the Advanced Web Server PBuilder Utility .............................................................................53 Overview ...................................................................................................................... 54 The PBuilder utility........................................................................................... 54 About the Advanced Web Server Toolkit documentation ......................... 55 Running the PBuilder utility ..................................................................................... 55 Linking the application with the PBuilder output files......................................... 57 security.c file ...................................................................................................... 57 cgi.c and file.c files ............................................................................................ 57 Comment tags.............................................................................................................. 57 Creating Web pages.................................................................................................... 58 AWS custom variables ..................................................................................... 58 Data types........................................................................................................... 60 Displaying variables ......................................................................................... 60 vi Changing variables ........................................................................................... 61 Security ............................................................................................................... 64 Exceptional cases ............................................................................................... 64 Controlling the MAW module .................................................................................. 64 Setting the semaphore timeout........................................................................ 65 Array subscripts ................................................................................................ 66 Error handling.................................................................................................... 66 Building the application ................................................................................... 67 Phrase dictionaries and compression ............................................................. 67 Maintaining and modifying Web content................................................................ 68 Sample applications .................................................................................................... 69 Chapter 5: Troubleshooting .......................................................................... 71 Diagnosing errors ........................................................................................................ 72 Diagnosing a fatal error.................................................................................... 72 Diagnosing an unexpected exception............................................................. 72 Reserializing a development board .......................................................................... 73 Development boards and serial numbers...................................................... 73 Observing the LEDs .......................................................................................... 74 Preparing to reserialize..................................................................................... 74 Assigning a MAC address to the NET+Works board.................................. 74 Restoring the contents of flash ROM........................................................................ 76 Step 1: Configure the development board and the MAJIC ......................... 77 Step 2: Building the bootloader ....................................................................... 78 Step 3: Building the application image and starting naftpapp ..................