VxWorks Simulator "Hello World" tutorial



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/02/vxworks-simulator-hello-world-tutorial/

You should be redirected in 2 seconds.



These are my notes on setting up a Hello World application in Tornado. For a more complete tutorial, see Chapter 3 "Tornado Tutorial" in the Tornado Getting Started Guide.

Setup the project:

  1. From the "Start" menu, "All Programs">"Tornado 2.2">"Tornado"
  2. If the "Create Project in New/Existing Workspace" dialog is up, click on "New". If not, from the "File" menu select "New Project..."
  3. Click "Create downloadable application modules for VxWorks", click "OK"
  4. Enter the following parameters:
    • "Name:", "helloworld"
    • "Location:", "C:\Tornado2.2\target\proj\helloworld"
    • "Add to a New or Existing Workspace", "C:\Tornado2.2\target\proj\Workspace0.wsp"
  5. Click "Next"
  6. Select the "A toolchain" option. Select "SIMNTgnu" to use the simulator. Otherwise, select the appropriate toolchain. Click "Next"
  7. Click "Finish"

Add a file and enter the program:

  1. From the "File" menu, select "New..."
  2. Select the following parameters:
    • From the left box, "C/C++ Source File"
    • "Add to project:", "helloworld.wpj"
    • "File name:", "helloworld.c"
    • "Location:", "C:\Tornado2.2\target\proj\helloworld"
  3. Click "OK"
  4. Enter the following into helloworld.c:
    #include <vxworks.h>
    
    void helloworld()
    {
     printf("hello world\n");
    }
  5. Press CTRL+S to save

Build the project:

  1. From the "Build" menu, select "Build"
  2. Click "OK" to generate dependencies (i.e. include files).
  3. You should get the following output in the "Build Ouput" window:
    ccsimpc -g -mpentium -ansi -fno-builtin -fno-defer-pop -I. -IC:\Tornado2.2\target\h\ -DCPU 
    =SIMNT -DTOOL_FAMILY=gnu -DTOOL=gnu -c ..\helloworld.c
    vxrm ..\prjObjs.lst
    Generating ..\prjObjs.lst... 
    ccsimpc -r -nostdlib -Wl,@..\prjObjs.lst  -o partialImage.o 
    nmsimpc -g partialImage.o @..\prjObjs.lst | wtxtcl C:\Tornado2.2\host\src\hutils\munch.tcl 
     -c simpc > ctdt.c
    ccsimpc -c -fdollars-in-identifiers -g -mpentium -fno-builtin -fno-defer-pop -I. -IC:\Torn 
    ado2.2\target\h\ -DCPU=SIMNT -DTOOL_FAMILY=gnu -DTOOL=gnu ctdt.c -o ctdt.o
    ccsimpc -r -nostdlib -Wl,--force-stabs-reloc partialImage.o ctdt.o -o helloworld.out
    
    Done.

Start the simulator, download and run your program

  1. From the "Tools" menu, select "Simulator..." (Or click the "Launch Simulator" button)
  2. Click "OK" to run the standard simulator
  3. If you get a 'A Target Server named "vxsim@XXXXXXX" is required and will be started.' dialog, click "OK". (Note: If you've been messing around with the full simulator, click "Details >>" and ensure the "Integrated simulator" option is selected.)
  4. A "VxSim0" window should appear and the red target server icon should appear in your system tray.
  5. Right-click on "hellowworld Files" and select "Download helloworld.out".
  6. From the "Tools" menu, select "Shell..."; click "OK". (Or click the "Launch Shell" button).
  7. In the shell window, type "i" and hit ENTER to see the list of running tasks. You should get something like:
    -> i
      NAME        ENTRY       TID    PRI   STATUS      PC       SP     ERRNO  DELAY
    ---------- ------------ -------- --- ---------- -------- -------- ------- -----
    tExcTask   _excTask       dd8de0   0 PEND         40984c   dd8ce4       0     0
    tLogTask   _logTask       dd32b0   0 PEND         40984c   dd31b4       0     0
    tWdbTask   _wdbTask       dce668   3 READY        40984c   dce51c       0     0
    value = 0 = 0x0
    -> 
  8. Type "helloworld" and hit ENTER. You should get the following output:
    -> helloworld
    hello world
    value = 12 = 0xc = __major_os_version__ + 0x8
    -> 
  9. You're finished.
See also my downloadable project tutorial
See also my bootable project tutorial

Technorati tags:

1 comment:

Anonymous said...

Good one to get geared up in Vx works Arena ..

About

This is my *OLD* blog. I've copied all of my posts and comments over to my NEW blog at:

http://www.saltycrane.com/blog/.

Please go there for my updated posts. I will leave this blog up for a short time, but eventually plan to delete it. Thanks for reading.