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
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
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)
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:
TAO is open source software that is compliant with most features and components in the latest CORBA 2.2 and 2.3 specifications. TAO can be downloaded from the Internet and freely used and redistributed without developer or run-time licensing costs. Commercial support, documentation, training, and consulting for TAO are available from OCI and Remedy IT (http://www.theaceorb.nl).
ROBIN is a freeware distributed object system based on CORBA 2.1, written by Jim Pangburn with a great start from Ryan Pierce. It has additional support for:
- Remote Procedure Calls defined in IDL
- Load-balancing
- Redundancy (virtual synchrony model),
The following page gives a more complete list of links to free implementations of CORBA (and also to commercial / not-free implementations):
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.
- In the following selection: network components -> basic network initialization components -> network buffer initialization :
Set the parameters to their new values to increase the number of network buffers in the TCP/IP stack:
Parameter Value NUM_NET_MBLKS 800 NUM_64 256 NUM_128 256 NUM_256 256 NUM_512 128 NUM_1024 100 NUM_2048 100 NUM_SYS_64 160 NUM_SYS_128 160 NUM_SYS_256 160 NUM_SYS_512 160
Ensure that NUM_SYS_CL_BLKS is set to (NUM_SYS_64 + NUM_SYS_128 + NUM_SYS_256 + NUM_SYS_512). This should be the default.- In the following selection: network components -> network protocols -> core TCP/IP components -> TCPv4 :
Set TCP_RCV_SIZE_DFLT to 16384 to increase the size of the receive buffer of a TCP connection.- In the following selections: operating system components -> IO system components -> IO system -> network components -> networking protocols -> core TCP/IP components -> BSD SOCKET :
Set NUM_FILES to at least 150 to increase the number of socket file descriptors.
See also 4.6-B
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:
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.
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.
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.
The first loadconfig statement in the file
loadconfig 'vxppc' ;my system
The SRCDIR setting:
equate SRCDIR 'yourdirectory to the SNMP dir' ;would be
$SNMP
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
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:
$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.
makmak
in the $SNMP directory specifying wind.cfg
make all
(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)
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)
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)
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!
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 |
|