VxWorks / Tornado II FAQ




6. Extra information

6.1 Hard delay

6.2 Memory leaks

6.3 Corba

6.4 Web servers

6.5 NTP usage

6.6 Performance / Benchmarks

6.7 SNMP

6.8 Lint

6.9 Encryption

6.10 AI languages

Index


6. Extra information

6.1 Hard delay

Q: How do I create a hard delay in my task?

A: The following was written by Geoffrey Espin in the newsgroup:

Attached is a portable sub-clock tick "hard" (busy loop) delay library. I can't believe how many times I've seen code like (bletch!):

for (ix = 0; ix < 0x40000; ix++) ; /* spin wheels for 20 usecs (I hope) */
    

WRS does supply nanosleep() but is actually limited to system clock rate usually I think.

Attached are my delayLib.c and delayLib.h. If you have any suggestions or improvments let me know: espin@idiom.com


6.2 Memory leaks

Q: How do I find memory leaks?

A: The following message was written in de newsgroup by Richard Dickson dickson@jlab.org for a 68K architecture system:

I coded up some diagnostic code myself to help me find memory leaks caused by the use of malloc, calloc, and free. I have attached the two c source files (both pretty small) for this. They may not be great, but then again I think they generally work (and are free). Compile both source files and then enter:

 ld <findMalloc.o
 find_malloc
 ld <memTrack.o

in that order *before* loading any of your source code. This diagnostic replaces malloc, calloc, and free with versions that keep some statistics. You can then enter "memTrack" at the command line to get info on a per task basis about memory used.

Use at your own risk :)


I found this a couple of years ago. Check out http://www.snippets.org and more specifically http://www.snippets.org/snippets/portable/portable.php3

Here you will find Walter Bright's memory allocation debugging package. His stuff was not written for vxWorks, but I think it would be relatively easy (a couple of hours, max) to port.

(From: Don Small, dmsmall@sandia.gov)


6.3 Corba

Q: Where can I find a Corba engine that runs under VxWorks?

A: The following links were given in the newsgroup as being available for VxWorks:

The following page gives a more complete list of links to free implementations of CORBA (and also to commercial / not-free implementations):


6.4 Web servers

Q: What web servers are available?

A: The following web servers are available for free:


Q: I have written a simple Http Server but it "sleeps" for a period between 30 sec to 1 min after 12 requests, and it begins to response again after that.

A: The sockets used by the web server (yours, WindRivers, GoAhead's) will stay 'alive' for up to three minutes after you have closed the connection waiting for tardy packets.

All part of the RFC. Recall, VxWorks is still supporting TCP/IP on 68000 machines with as little as 1 MB of RAM! But read the following WindRiver text on how to improve this.

Recommended VxWorks configuration

The default configuration for VxWorks board support packages is adequate for normal development work, but does not adequately support the network traffic required when running a network application such as a browser.

The following changes are recommended in your VxWorks configuration using the Tornado project facility.

See also 4.6-B


6.5 NTP usage

Q: How do I synchronise time using NTP?

A: Use the following code in your usrAppInit:

    /* initialize clock */
    {
       struct timespec tspec;
       STATUS sntpc_status;

       sntpc_status = sntpcTimeGet(NTP_SERVER_IP, WAIT_FOREVER, &tspec);
       if (sntpc_status ==  ERROR)
           printf("sntpcTimeGet returned ERROR.\n");
       else
           clock_settime(CLOCK_REALTIME, &tspec);
    }
    

(From: Jeremey Barrett, jeremey@terisa.com)

Two comments from Leonid Rosenboim (leonid@bitband.com) about this program:

  1. The infinite timeout is not such a good idea... can't allow a machine to fail boot if the time server called in sick...
  2. If your application needs a correct time and date, this just won't compensate for a rather significant drift of the interrupt-generated clock, you must re-sync the clock "every so often"...

Anothor solution is this program from cedilnik andrej (acedil1@irix1.gl.umbc.edu). It can be started using the command Sync("IP-address"), for example Sync ("18.72.0.3"). Here is the program: ntp.c.


6.6 Performance / Benchmarks

Q: What is the performance of VxWorks on my target?

A: There are a number of benchmark results published by Windriver. Ask your FAE for more information about this. These documents include details on context switching, interrupts etc.


6.7 SNMP

Q: How do I generate the Envoy SNMP server?

A: I've actually built the beast, including v3 support. You will have to build it outside of Tornado 2.0, and then refer to the library as an EXTRA_MODULE within Tornado.

Part 1

Ill assume that $SNMP is the installation directoy of the epilogue stuff. Some of what is listed below is identical to section 5.2 of the getting started guide.

  1. Copy the snark/vxworks/cfgs/wind.cfg to the $SNMP dir.
  2. Edit it to make the two key changes:

    The first loadconfig statement in the file

    loadconfig 'vxppc' ;my system

    The SRCDIR setting:

    equate SRCDIR 'yourdirectory to the SNMP dir' ;would be $SNMP

  3. Now, make sure you have copied $SNMP/snark/vxworks/h/snmpdLib.h to $WIND_BASE/target/h. Also, replace all contents of $WIND_BASE/target/h/snmp with $SNMP/snark/vxworks/h/snmp.
  4. Run makmak in the $SNMP directory specifying this cfg file.
  5. In the SNMP directory, type in "make all".

If you get compile errors, try defining the following environment variables. I set them for my NT box with Tornado under C:\Tornado:

WIND_BASE               C:\Tornado
WIND_BASE_TYPE          x86-win32
WIND_HOST_TYPE          x86-win32
    

Set these variables on an NT using the properties menu by right-mouse clicking over your 'my computer'. On this dialog use the environment tab.

Open up a new DOS shell and try the make all again.

Part 2

  1. Make sure you go to your BSP directory and edit config.h as per section 5.2 to add the defines BEFORE the configAll include.
  2. Fire up tornado
  3. Start a new vxWorks bootable image project based on this BSP.
  4. Open up the build properties and click on the MACROS tab and find the EXTRA_MODULES. In the value field, add the full path and name of the snmp library. For some reason, it has no extension.
  5. Rebuild all.

That should do the trick. Now, if you actually are able to add a MIB to the agent let me know. I can add a MIB, but for some reason, none of my get/set routines ever get called.

(From: Doug Dyer, doug_dyer@yahoo.com)


Q: How do I extend the Envoy SNMP agent?

A: The steps to the extension of the MIB agent should be as follows:

  1. Write your mib file say ex.mib
  2. Compile it using the mibcompiler
            $mibcomp -stub -start (name of the module identity in your mib file) \
            -o ex.c (list of mibs on which ex.mib depends) ex.mib
            

    Before doing this make sure that you set your MIBCOMP environment variable to point to the MIB search path where all your standard MIBs are located (i.e set MIBCOMP = -l MIB-search-path)

    Once the ex.c file is created copy it to the directory ...\snark\vxworks\agent and modify it as per your needs.

  3. Edit the file makefile.cfg under ..\snark\vxworks\agent
  4. Run makmak in the $SNMP directory specifying wind.cfg
  5. Type make all
  6. You can see if you are able to get/set variables by using utilities like getif/snmputil.

(From: pintu_12@my-deja.com)


Q: Where can I find some information about (free) SNMP managers?

A: There are a couple.

(From: David Oberbeck, oberbdg@stamps.stortek.com)

Lawrence T.Hoff worked on a SNMP implementation on VxWorks. See his remarks that he made to me:

I still have the source code at this site: http://pubweb.bnl.gov/people/hoff/snmp2.tar.Z. It is based on public domain software from Carnegie Mellon University. However, I have not done anything to support this code in 6 or 7 years. In the meanwhile, Wind River has released a fully supported SNMP agent.

(From: Andrew Cardoza, acardoza@nicon.co.za)


6.8 Lint

Q: I want to use PC-Lint, how do I configure it you be used with Tornado?

A: We are using PC-lint 7.5 to check our VxWorks projects for two years now, using a lint parameter file with the following contents:

-A                            /* ANSI-C checking                           */
+fdi                          /* begin include search at including file    */
+fcp                          /* use c++ not only for cpp and cxx ext.     */
+fcu                          /* character is unsigned                     */
+fva                          /* variable argument size                    */
+fwc                          /* wchar_t is built in type                  */
+ppw(option)                  /* add preprocessor word <option>            */
-si4                          /* Integers are 4 Byte long                  */
-sl4                          /* Longs are 4 Byte long                     */
-sp4                          /* Pointers are 4 Byte long                  */
-t2                           /* Tab size is 2                             */
-v                            /* turn off all verbosity messages           */

-width(0,3)                   /* Output format no breaking and indent 3    */
-hsb#3                        /* Error display format                      */
-"format=%f(%l): Error %n: %m"/* Error message format                      */



-elib(???)                    /* I can`t fix errors in library headers     */

-e537                         /* repeated include is controlled by #ifdev  */
-e716                         /* while(1) is ok!                           */
-e783                         /* file end without new line is ok           */
-e765                         /* external could be made static             */

/* NOT REFERENCED (see weak defines; check at end of project) */
-e714                         /* function not referenced                   */
-e749                         /* local enumeration constant not referenced */
-e750                         /* local macro not referenced                */
-e751                         /* local typedef not referenced              */
-e752                         /* local declarator not referenced           */
-e753                         /* local struct, union or enum tag not ref.  */
-e754                         /* local structure member not referenced     */
-e755                         /* global macro not referenced               */
-e756                         /* global typedef not referenced             */
-e757                         /* global declarator not referenced          */
-e758                         /* global struct, union or enum tag not ref. */
-e768                         /* global structure member not referenced    */
-e769                         /* global enumeration constant not ref.      */
-e1714                        /* member function not referenced            */
-e1715                        /* static member not referenced              */
-e1716                        /* virtual member function not referenced    */
-e1750                        /* local template not referenced             */
-e1755                        /* global template not referenced            */


-esym(1512, unary_function<*>)         /* from stl in file stl_function.h  */
-esym(1512, binary_function<*>)        /*            - "" -                */


-emacro(611,clearerr)         /* ignore errors in macro                    */
-emacro(666,clearerr)         /* ignore errors in macro                    */
-emacro(740,clearerr)         /* ignore errors in macro                    */

-emacro(534,putc)             /* ignore errors in macro                    */
-emacro(611,putc)             /* ignore errors in macro                    */
-emacro(666,putc)             /* ignore errors in macro                    */
-emacro(740,putc)             /* ignore errors in macro                    */

-emacro(534,putchar)          /* ignore errors in macro                    */
-emacro(611,putchar)          /* ignore errors in macro                    */
-emacro(666,putchar)          /* ignore errors in macro                    */
-emacro(734,putchar)          /* ignore errors in macro                    */
-emacro(740,putchar)          /* ignore errors in macro                    */

-emacro(534,getchar)          /* ignore errors in macro                    */
-emacro(611,getchar)          /* ignore errors in macro                    */
-emacro(666,getchar)          /* ignore errors in macro                    */
-emacro(740,getchar)          /* ignore errors in macro                    */

-emacro(611,feof)             /* ignore errors in macro                    */
-emacro(740,feof)             /* ignore errors in macro                    */

-emacro(611,ferror)           /* ignore errors in macro                    */
-emacro(740,ferror)           /* ignore errors in macro                    */

-emacro(611,fileno)           /* ignore errors in macro                    */
-emacro(613,fileno)           /* ignore errors in macro                    */
-emacro(666,fileno)           /* ignore errors in macro                    */
-emacro(740,fileno)           /* ignore errors in macro                    */

-emacro(611,__sfileno)        /* ignore errors in macro                    */
-emacro(613,__sfileno)        /* ignore errors in macro                    */
-emacro(666,__sfileno)        /* ignore errors in macro                    */
-emacro(740,__sfileno)        /* ignore errors in macro                    */

-emacro(  26,va_start)        /* ignore errors in macro                    */
-emacro( 522,va_start)        /* ignore errors in macro                    */
-emacro( 534,va_start)        /* ignore errors in macro                    */
-emacro( 746,va_start)        /* ignore errors in macro                    */
-emacro(1055,va_start)        /* ignore errors in macro                    */


/*
**  Ignore these constructs..
*/
-d__extension__()             /* for va_xxx macros                         */
-d__attribute__=;             /* from stl in file exception part one       */
-d((__noreturn__))=;          /*          - "" -            part two       */
-d_IH=
-d_SWI=
-d_TRAP()=
-d_SPL()=
-d_GPL()=

/*  The following functions exhibit variable return modes.
**  That is, they may equally-usefully be called for a value
**  as called just for their effects.  Accordingly we inhibit
**  Warning 534 for these functions.
**  Feel free to add to or subtract from this list.
*/
-esym(534,close,creat,fclose,fprintf,fputc)
-esym(534,fputs,fscanf,fseek,fwrite,lseek,memcpy,memmove,memset)
-esym(534,printf,puts,scanf,sprintf,sscanf,strcat,strcpy)
-esym(534,strncat,strncpy,unlink,write)
-esym(534,cprintf,CTerminalIO::cprintf,printErr,xfclose)
    

The important line is "-elib(???)" which instructs lint to ignore all errors in header files included with the <>brackets. If you include all the VxWorks headers with <> you will get rid of the error messages caused by the famous Wind River programmers.

Since macros are resolved within your source file, you also have to ignore errors related to the macro resolutions (-emacro()). Also important is the "Ignore these constructs.." section.

Using the STL with VxWorks, we found some very crucial problems, which were reported to gimpel support about one year ago, but still not fixed! It seems like the same people are (un)supporting Wind River Systems and gimpel products: help is promised, but never given ...

(From Matthias Guelck, Matthias.Guelck@de.heidelberg.com)


6.9 Encryption

Q: Is there an encryption library for VxWorks?

A: Versions of SSL have been ported to vxWorks. See http://www.openssl.com. Also http://www.rsasecurity.com/products/bsafe/sslc.html, http://www.icesoft.no/ and http://www.TeamF1.com/.

I have ported it myself. An older version was also used in the eNavigator product.

You can use Perl and the mingwin tools on NT to create the libssl.a and libcrypt.a file for NT. You can then create a makefile from all of the Makefile.ssl files. Here is the beginning of one of my Makefiles:

# Makefile for the Secure Sockets Layer (SSL) protocol components
#
# modification history
# --------------------

all: libcrypto.a

TGT_DIR =       $(WIND_BASE)/target
CPU     =       ARMARCH3
TOOL    =       gnu

include $(TGT_DIR)/h/make/defs.bsp
include $(TGT_DIR)/h/make/make.$(CPU)$(TOOL)
include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE)

# Include
ADDED_CFLAGS += -DVXWORKS=1 -fno-volatile -DGETPID_IS_MEANINGLESS
EXTRA_INCLUDE += -Iinclude -Iinclude/openssl

# Base crypto sources.
C_SOURCE = crypto/cpt_err.c crypto/cryptlib.c crypto/cversion.c \
        crypto/ebcdic.c crypto/ex_data.c crypto/mem.c           \
        crypto/mem_dbg.c

# crypto sub-directories,
# asn1 bf bio bn buffer cast comp conf des dh dsa dso engine err
# evp hmac idea lhash md2 md4 md5 mdc2 objects pem perlasm pkcs12
# pkcs7 rand rc2 rc4 rc5 ripemd rsa sha stack threads txt_db x509 x509v3

C_SOURCE += crypto/asn1/a_object.c crypto/asn1/a_bitstr.c \
        crypto/asn1/a_utctm.c crypto/asn1/a_gentm.c crypto/asn1/a_time.c \

...
    

Configure without assembler and task/thread support, this should set the header files and other files up appropriately.

(From: Bill Pringlemeir, spam_account@sympatico.ca)

According to information in the newsgroup this Makefile is for version 0.9.6. Version 0.9.7 and higher support VxWorks. Please look at the dcumentations and the Makefile of OpenSSL for this.


6.10 AI languages

Information from Colin Smith (colin@colin-smith.net) about his port of Scheme to VxWorks:

I've ported a Scheme implementation I work on as a hobby to VxWorks (specifically VxSim under Tornado 2.2).

It integrates with the VxWorks symbol table (allowing Scheme to transparently invoke VxWorks functions and inspect variables from within the Scheme interpreter). Conditionals, looping and I/O are all supported, and the interpreter passes some strong test cases.

The system is designed with compactness in mind and the module consumes less than 64Kb (code+data) on the VxSim target. (That is, if you don't count the C++ runtime support...but the interpreter is written in a strict subset of C++ to avoid bloat: no templates, RTTI, STL, etc.)

If the idea of running an AI language on VxWorks interests you, pay a visit to http://colin-smith.net/vx-scheme/

It comes with a Tornado workspace that will build the interpreter as well as a VxSim image configured to host it. (The interpreter can also compile for UNIX systems). I'm curious as to how large the set of people who care about Scheme and VxWorks actually is. If you're one of them, let me know!


Index

6.1 A How do I create a hard delay in my task?
6.2 A How do I find memory leaks?
6.3 A Where can I find a Corba engine that runs under VxWorks?
6.4 A What web servers are available?
B My Http Server "sleeps" for a period between 30 sec to 1 min after 12 requests, and it begins to response again after that.
6.5 A How do I synchronise time using NTP?
6.6 A What is the performance of VxWorks on my target?
6.7 A How do I generate the Envoy SNMP server?
B How do I extend the Envoy SNMP agent?
C Where can I find some information about (free) SNMP managers?
6.8 A I want to use PC-Lint, how do I configure it you be used with Tornado?
6.9 A Is there an encryption library for VxWorks?
6.10 A Information about Scheme for Vxworks

The commercial department
Giganews Newsgroups



VxWorks Homepage
© J.A. Borkhuis, 2000 - 2005
Send me an e-mail if this page was helpfull