User's Guide
PDF
Top

Embedded Systems
User's Guide
Version 5.8.2

Expand All
Contract All

Chapters

# 3 VxWorks

This chapter describes the OS specific parts of OTP which relate to VxWorks.

### 3.1 Introduction

The Erlang/OTP distribution for VxWorks is limited to what Switchboard requires (Switchboard is a general purpose switching hardware developed by Ericsson).

Please consult the README file, included at root level in the installation, for latest information on the distribution.

### 3.2 Memory Usage

Memory required is 32 Mbyte.

### 3.3 Disk Usage

The disk space required is 22 Mbyte, the documentation included.

### 3.4 Installation

OTP/VxWorks is supplied in a distribution file named <PREFIX>.tar.gz; i.e. a tar archive that is compressed with gzip. <PREFIX> represents the name of the release, e.g. otp_LXA12345_vxworks_cpu32_R42A. Assuming you are installing to a Solaris file system, the installation is performed by following these steps: <

- Change to the directory where you want to install OTP/VxWorks (<ROOTDIR>): cd <ROOTDIR>
- Make a directory to put OTP/VxWorks in: mkdir otp_vxworks_cpu32 (or whatever you want to call it)
- Change directory to the newly created one: cd otp_vxworks_cpu32
- Copy the distribution file there from where it is located (<RELDIR>): cp <RELDIR>/<PREFIX>.tar.gz .
- Unzip the distribution file: gunzip <PREFIX>.tar.gz
- Untar <PREFIX>.tar: tar xvf <PREFIX>.tar
- Create a bin directory: mkdir bin
- Copy the VxWorks Erlang/OTP start-up script to the bin directory: cp erts-Vsn/bin/erl bin/.
- Copy the example start scripts to the bin directory: cp releases/R42A/*.boot bin/.

If you use VxWorks nfs mounting facility to mount the Solaris file system, this installation may be directly used. An other possibility is to copy the installation to a local VxWorks DOS file system, from where it is used.

### 3.5 OS Specific Functionality/Information

There are a couple of files that are unique to the VxWorks distribution of Erlang/OTP, these files are described here.

- README - this files has some information on VxWorks specifics that you are advised to consult. This includes the latest information on what parts of OTP are included in the VxWorks distribution of Erlang/OTP. If you want us to include more parts, please contact us to discuss this.
- erts-Vsn/bin/resolv.conf - A resolver configuration EXAMPLE file. You have to edit this file.
- erts-Vsn/bin/erl - This is an EXAMPLE start script for VxWorks. You have to edit this file to suit your needs.
- erts-Vsn/bin/erl_io - One possible solution to the problem of competing Erlang and VxWorks shell. Contains the function 'start_erl' called by the erl script. Also contains the function 'to_erl' to be used when connecting to the Erlang shell from VxWorks' shell.
- erts-Vsn/bin/erl_exec - Rearranges command line arguments and starts Erlang.
- erts-Vsn/bin/vxcall - Allows spawning of standard VxWorks shell functions (which is just about any function in the system...) from open_port/2. E.g. open_port({spawn, 'vxcall func arg1 arg2'}, []) will cause the output that 'func arg1, arg2' would have given in the shell to be received from the port.
- erts-Vsn/bin/rdate - Set the time from a networked host, like the SunOS command. Nothing Erlang-specific, but nice if you want date/0 and time/0 to give meaningful values (you also need a TIMEZONE environment setting if GMT isn't acceptable). For example: putenv "TIMEZONE=CET::-60:033002:102603" sets central european time.
- erts-Vsn/src - Contains source for the above files, and additionally config.c, driver.h, preload.c and reclaim.h. Reclaim.h defines the interface to a simple mechanism for "resource reclamation" that is part of the Erlang runtime system - may be useful to "port program" writers (and possibly others). Take careful note of the caveats listed in the file!

### 3.6 Starting Erlang

Start (and restart) of the system depends on what file system is used. To be able to start the system from a nfs mounted file system you can use VxWorks start script facility to run a start script similar to the example below. Note that the Erlang/OTP start-up script is run at the end of this script.

    #  start.script v1.0 1997/09/08 patrik
    #
    #  File name:  start.script
    #  Purpose:    Starting the VxWorks/cpu32 erlang/OTP
    #  Author:     patrik@erix.ericsson.se
    #  Resides in: ~tornado/wind/target/config/ads360/

    #
    # Set shell prompt
    #
    shellPromptSet("sauron-> ")

    #
    # Set default gateway
    #
    hostAdd "router-20","150.236.20.251"
    routeAdd "0","router-20"

    #
    # Mount /home from gandalf
    #
    hostAdd "gandalf","150.236.20.16"
    usergroup=10
    nfsAuthUnixSet("gandalf", 452, 10, 1, &usergroup)
    nfsMount("gandalf", "/export/home", "/home")

    #
    # Load and run rdate.o to set correct date on the target
    #
    ld < /home/gandalf/tornado/wind/target/config/ads360/rdate.o
    rdate("gandalf")

    #
    # Setup timezone information (Central European time)
    #
    putenv "TIMEZONE=CET::-60:033002:102603"

    #
    # Run the Erlang/OTP start script
    #
    cd "/home/gandalf/tornado/wind/target/erlang_cpu32_R42A/bin"
    <erl