You are on page 1of 47

Chapter

2
Projects

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-1

Projects
2.1 Projects Overview Bootable Projects and VxWorks Conguration Integrated Simulator Downloadable Projects Build Specications

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-2

Creating a new project

Project terminology

Project GUI components

Project Files

Projects and Workspaces


Tornado uses projects and workspaces to manage user code, congure VxWorks, and specify build settings. A project is a collection of source and binary les and build specications. A workspace is a collection of projects which are grouped to simplify organization of multiple related projects. The project facility is started
q

[UNIX] by selecting the Project button from the Tornado launcher. [Windows] automatically when Tornado starts up, or later by selecting New Project... from the File menu.

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-3

The UNIX and Windows project facilities have nearly identical appearances and functionality.

(Windows host only) Tornado can be congured to display the Tornado 1.0.1 build menu items and perform builds in BSP-directories by checking the GUI item Tools -> Options... -> Project Tab -> Show Tornado 1.0.1 menu items.

Creating a New Project

The tabs on the selection window allow you to:


q q

(Recent) Open a recently visited workspace. (New) Create a new bootable or downloadable application. (Existing) Browse for and enter an existing workspace.
Copyright Wind River Systems Wind River Systems

Tornado Training Workshop

2-4

A new project can also be invoked using the menu item File -> New
Project ...

Bootable and downloadable projects will be discussed in detail later in this chapter.

Project Facility Terminology


Key project facility concepts: Bootable Project - A project used to congure and build VxWorks images for a particular BSP. Application code may be statically linked to such a VxWorks image, and the applications start-up code may be specied. Downloadable Project - A project used to manage and build application modules which can be downloaded and dynamically linked with a running VxWorks image. Allows "on the y" development. Component - A scalable VxWorks facility, often with an initialization routine. Example: hardware fpp support. Toolchain - A collection of development tools (compiler, linker, assembler, etc.) for a specic target CPU. Build specication - User-specied settings and rules which are used to build a project.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-5

A bootable project with application linked in is sometimes called a bootable application.

A downloadable project is used to build downloadable application modules.

All these terms will be elaborated upon in following sections of this chapter.

Workspace Window
Workspace tabs display:
Files -- Project source

and object les.


VxWorks -- Included and

excluded VxWorks components.


Builds -- Build specications.

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-6

Shown here is a bootable project. Files shown include:


q

Source les generated by the project facility (linkSyms.c, prjCong.c, usrAppInit.c), referenced from the underlying BSP (romInit.s, sysALib.s, sysLib.c), or shared by all bootable projects (romStart.c). Header les created by the project facility (prjComps.h and prjParams.h). Object les which may be created for this project (notice the bootable image vxWorks). The folder for object modules is labeled default -this is the name of the build specication used to compile these objects.

Context Menu

Actions related to selection (usrAppInit.c) Menu items vary with selection. Actions related to current project (networkServer) Properties of the selected item (usrAppInit.c).

Right-click with mouse to invoke context menu.

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-7

The menu items shown are:


Dependencies... -- calculate which les selected le is dependent upon Open lename... -- open selected le in editor Compile lename -- build lename.o Remove lename -- remove lename from project Checkout (in) lename... -- use conguration management tool [not

congured as shown] Build vxWorks -- build bootable VxWorks image Rebuild All -- remove all objects and do a clean build. Add Files ... -- add les to current project Add Files from project ... -- add les to project from another project Properties... -- properties of current selection including dependencies and build settings.

Project Files
In addition to the source, object, and header les that are displayed in the Files pane of the workspace window, the project facility creates other les: projectName.wpj -- The project master le. Species
q q

les included in the project and their dependencies build specications custom rules VxWorks conguration data (for bootable projects).

workspaceName.wsp -- Workspace master le. Lists the projects belonging to the workspace. Makele -- Generated before a new or modied project is built or saved.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-8

The projectName.wpj and workspaceName.wsp les are "precious" les; if they are deleted or corrupted, you will have to recreate them manually. You may want to maintain these les in your source management system. They must be checked out when using the project facility.

One may save the current workspace and all modied projects within it using the File => Save Workspace menu item. This also regenerates the Makeles for modied projects. Projects and workspaces may also be saved under alternate names using File => Save Project as... and File => Save Workspace as..., and whole workspaces (together with the source les the contained projects reference) may be backed up in a ZIP archive using Project => Backup Workspace.

Using Version Control with Projects


The project facility can make use of source management tools. The context menu for a selected source or header le will allow the le to be checked in or checked out. Tools -> Options... -> Version Control allows conguration of check-in and check-out routines:

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-9

Default check-in and check-out routines can be specied for Clearcase, Visual Source Safe, and PVCS.

Windows users can also specify an alternate code editor. MicroEdges Visual SlickEdit 4.0 (an optional partner product), a source editor for Windows or UNIX, includes Tornado support.

Projects
Projects Overview 2.2 Bootable Projects and VxWorks Conguration Integrated Simulator Downloadable Projects Build Specications

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-10

Bootable Projects and Applications


A bootable project congures and builds VxWorks images for a BSP. Application code may be statically linked with, or built as part of, a bootable project, to create a bootable application. Typical reasons to create a bootable project:
q

To create a production version of a product (discussed in the Reconguration chapter) To congure a custom VxWorks image

A bootable project is based on an installed BSP (or derived project), or an existing VxWorks project. Create a bootable project by selecting File -> New Project... and using the project wizard.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-11

Creating a Bootable Project (Part I)

Choose a project name, project directory, a comment string, and a workspace to add the project to. By convention, the project directory name should match the project name (not required, however).
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-12

It is strongly recommended that you create your project directory outside of your Tornado tree. If you subsequently upgrade or change your Tornado installation, projects outside of the tree will not be affected. (The Windows Uninstall Tornado program will not affect any les added to the Tornado tree after installation of the product. I.e., it will not touch any user-added projects.)

Creating a Bootable Project (Part II)

A bootable VxWorks image is based on:


q q

An existing project (possibly a projectized BSP), or An installed BSP (found in .../target/cong/bspName).


Copyright Wind River Systems Wind River Systems

Tornado Training Workshop

2-13

Generating a bootable project with an existing project is faster if you base it on an existing project. Tornado BSPs include project les, for example, .../target/proj/mv162_vx.wpj.

Basing a new project on an existing one means that the same source les are shared between the projects, but the project conguration les, build specications, and makeles are maintained separately.

Creating a Bootable Project (Part III)

The last wizard screen conrms your choices of workspace, project name, and basis BSP (or projectized BSP). Hit Finish button to create your project.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-14

Bootable Project Files


A bootable project is created with the following les: linkSyms.c and prjCong.c -- dynamically generated conguration les containing component initialization and scaling support. romInit.s, sysALib.s, and sysLib.c; romStart.c -- BSP or generic startup les (see Reconguration chapter). usrAppInit.c -- initializes statically linked user application (see Reconguration chapter). Created as a stub le, modied by user. prjComps.h and prjParams.h -- dynamically generated header les containing component choices and parameter values.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-15

A bootable project can build object les such as vxWorks or other VxWorks images such as vxWorks_rom. For details, see the Reconguration chapter. These derived les are built within a project build spec subdirectory.

Do not modify dynamically generated les!

VxWorks Components
VxWorks facilities are shown in a heirarchical display in the VxWorks pane. Included components are shown in bold, excluded in plain text, and unavailable ones in italics. Note that the context menu allows you to include or exclude components.

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-16

Throughout these course notes VxWorks components will be identied using a le-like notation. For example, the component highlighted above is /hardware/peripherals/clocks/high resolution timestamping.

Wind River documentation sometimes refers to components by a conguration constant. For example, the component above corresponds to the constant INCLUDE_TIMESTAMP. To nd a component or parameter from its constant, use Project -> Find Object...

The component and the folders containing it will be highlighted in the Workspace window after you press Find.

Including Components

When component is included, dialog box lists size of component as well as dependent components. Selecting OK button will include facility and dependent components.

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-17

Sizes given are not always exact; small source-code "conglettes" used in initializing VxWorks are not included in the estimate of total image size.

The Help button will pull up the HTML page for the selected component.

Selecting a component folder in the Workspace window will give you a checklist of components in that folder.

Component Selections

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-18

Component selections are used in cases where one or more versions of a facility are provided, and you may need to make a choice. In some cases the different component versions are mutually exclusive and exactly one must be selected; in other cases, at least one component version must be selected. The Workspace window displays both types of selections using the following icon:

Fixing Component Errors and Conicts

If the conguration you have generated contains errors or conicts, the path to the improper components is highlighted.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-19

The conguration shown above is incorrect: the mutually exclusive components SCSI 1 and SCSI 2 are both congured.

Double-clicking on any of the highlighted folders will give a dialog box describing the conguration problem.

Component Parameters

Some components require parameter values. Doubleclick on component to set these parameters.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-20

The help pages sometimes refer to components by name. To locate this parameter use the Project -> Find Object... menu item.

Most components parameters are given "reasonable" default values. How reasonable these are depends on how you are using the component!

Conguration Outside the Project Facility


Some VxWorks components require conguration outside of the project facility, usually because of their complexity. Examples:
q

DHCP server component -- DHCP lease table is congured in .../target/cong/comps/src/net/ usrNetDhcpsCfg.c. (For details, see Networking chapter.) SCSI peripheral conguration is congured in either .../target/cong/bspName/sysScsi.c (preferred) or .../ target/cong/comps/src/usrScsi.c. (Details in SCSI Conguration appendix.)

See help pages on component for conguration issues.


Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-21

Building boot ROMs is also done outside of the project facility, using the Tornado 1.0.1 mechanism. See the Reconguration chapter for details. (Windows users may, however, do Tornado 1.0.1 style BSP builds within the Tornado IDE if they select Show Tornado 1.0.1 menu items on the Tools => Options... => Project page).

Building VxWorks
Build project Rebuild All Compile selected source le Download object le or image Stop build Update dependencies

The build toolbar, shown above, allows you to build a downloadable object or boot image. The resulting image is saved in the directory projDir/ buildSpecName/. Change your boot parameters to reect this path. Output from the compilation goes to a build window. Windows users can go to any source line generating a build error or warning by double-clicking on the relevant output line.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-22

The Stop Build button is only available in the Windows version of Tornado. Unix users may type Ctrl-C in the build output window to stop the build.

Linker and compiler options, as well as build rules, can be set in the Builds pane of the Workspace window. Build specications are covered later in this chapter.

Dependencies can be regenerated using the Build -> Dependencies... menu item. More on dependencies in the section on downloadable projects.

Most of the build toolbar functionality is reproduced in the Build menu.

Projects
Projects Overview Bootable Projects and VxWorks Conguration 2.3 Integrated Simulator Downloadable Projects Build Specications

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-23

Tornado Integrated Simulator


Tornado includes an integrated target simulator. This facility allows application development prior to hardware availability. The simulator offers support for all VxWorks facilities except:
q q

Hardware-specic facilities Networking support

Tornado includes a version of WindView which works with the simulator. (See Windview chapter.) Only one simulator session can run at a time per host.

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-24

VxSim, an optional product, offers networking support and the ability to congure multiple simulator sessions per host. The integrated version of the simulator is sometimes called VxSim Lite.

Simulator Basics
Host

VxWorks
target server

tool

The integrated simulator is a "BSP" for the host OS. VxWorks runs as a process under the host OS. Hardware interrupts are simulated using signals (UNIX) or Windows messages (Windows).
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-25

Starting a Simulator Session


Create a simulator by:
q

Pressing the simulator button Pressing the VxSim button (UNIX hosts).

(Windows hosts) from the launcher

You are asked if you wish to launch: A standard simulator image (.../target/cong/ simBSPName/vxWorks[.exe]), or A custom-congured image from a project directory. Windows users will then be given a choice to create a default target server. UNIX users need to congure a target server. Tools can be attached to this target server.
q q

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-26

A simulated console window will appear. It is associated with the VxWorks process -- do not close this window during simulator use!

See Tornado Getting Started for an example of using the simulator.

Using the Tornado tools with the simulator or a target board will be discussed in the Shell and Browser, Crosswind Debugger, and WindView chapters.

Projects
Projects Overview Bootable Projects and VxWorks Conguration Integrated Simulator 2.4 Cross Development and Downloadable Projects Build Specications

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-27

Cross-Development Overview
Add application source les to project. Link modules with VxWorks image and load into target address space:
q

Static linking integrates application modules into the VxWorks image (a bootable project) when it is built. VxWorks is then loaded onto the target at boot time. Dynamic linking integrates a project object le (in a downloadable project) into the VxWorks image on the target when the le loads, after VxWorks is already running .

Static linking (bootable projects) is usually used for production code. Dynamic linking (downloadable projects) is usually used during development.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-28

Header les, or other les which do not correspond to built objects, may be added to the project for convenience; this will not affect standard builds.

Creating a Downloadable Project (Part I)

Choose a project name, project directory, a comment string, and a workspace to add the project to.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-29

It is strongly recommended that you create your project directory outside of your Tornado tree. If you subsequently upgrade or change your Tornado installation, projects outside of the tree will not be affected. (The Windows Uninstall Tornado program will not affect any les added to the Tornado tree after installation of the product. I.e., it will not touch any user-added projects.)

Creating a Downloadable Project (Part II)

A downloadable project is based on: A toolchain (CPU architecture dependent), or An existing project.
q q

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-30

Toolchains will be available for your target processor(s) and the integrated simulator.

Basing a new project on an existing one means that the same source les are shared between the projects, but the project conguration les, build specications, and makeles are maintained separately.

Creating a Downloadable Project (Part III)

The project wizard conrms your choice of project name, directory, and toolchain. Press Finish to create your project.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-31

The project facility will create projName.prj, workspaceName.wsp (if you specied a new rather than an existing workspace), and Makele as discussed on page 2-8.

Adding demo.c to Our Project


Add a le to a downloadable project by:
q q

Project -> Add/Include -> File menu item, or Add Files... item in context menu, When creating a new source le using File -> New...

The newly added le will be displayed in the Files pane of the workspace window. In addition, if the added le was a C/C++ source le, le.o will appear in the Object Modules folder.

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-32

demo.c

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-33

All VxWorks programs must include vxWorks.h before any other VxWorks header les.

Program entry point should not be called main( ).

UNIX/NT model:
q q

An executable le is specied. Execution starts in that les main( ) routine. An object module is downloaded. One or more tasks can begin execution at any routine in that module. There is no routine main( ).

VxWorks model:
q q

Building A Project
A downloadable application can be built using the build toolbar, the context menu, or the Build menu. The default target produced by the build is projName.out. This build compiles and links your project les, then munches the result. projName.out is not an executable; it is an object module which will be downloaded and dynamically linked to vxWorks. Make dependencies will be automatically generated the rst time a project is built. If dependencies change at a future time, select the Dependencies... item from the context menu to recalculate them.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-34

Munching refers to the process of adding to a C++ object module the data structures necessary for calling the constructors and destructors of statically allocated objects. For downloadable modules, the constructors may be called automatically at load time (default), or manually. The project makele takes care of the details of munching. When statically linking an application with VxWorks, one uses the unmunched version; the munching happens after linking. For more details, refer to the C++ appendix and the VxWorks Programmers Guide.

To link your downloadable project against other ojbect modules or libraries, list these other les in the PRJ_LIBS makele variable which you may set on the Macros tab of the project build specications properties sheet (see next section).

Unresolved External References

demo (param) { printf (...) taskIdSelf (...) taskName (...) }

% nm68k Demo.out ... 00000000 T _demo U _printf U _taskIdSelf U _ taskName ... %

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-35

nm68k is the version of nm supplied with the GNU toolkit for 68k targets.

The symbols in a module can also be displayed with the Browser.

Note the symbols _printf, _taskIdSelf, and _taskName remain unresolved because they refer to functions which are dened in VxWorks and not Demo.out.

The references to these symbols will be resolved when Demo.out is downloaded to the target and linked with VxWorks.

Downloading the Project File


Use the context menu to download projName.out after selecting the appropriate target server. Loads projName.out into the target servers memory pool on the target. Adds only global symbols to host-resident symbol table (default). Other load options can be set using Tools -> Options...-> Download. Resolves undened symbols as module is loaded. If any unknown symbols are encountered, then a warning is issued. However, the load does not "fail," in that the module is present on target. Unloads old version of module if it exists.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-36

Downloading can also be done with the build toolbar button Project -> Download... menu command.

or the

Unresolved references within a loaded module will not be xed up by later downloads of other modules! Further, if you reload a module which is referenced by other loaded modules, you should reload the others as well; otherwise, they may contain obsolete references.

Lower level, host-resident module loading is provided via wtxObjModuleLoad; see the Tornado API Guide. Target-resident module loading and unloading is provided in loadLib and unldLib.

Downloading modules can also be done from the WindSh shell using the ld() command, or from the Crosswind debugger.

Executing downloaded code from the shell will be discussed next chapter.

Showing Modules
Downloaded project modules can be displayed from the browser by: Selecting Module Information and the proper module (Windows). Clicking on module name (UNIX).
q q

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-37

The data symbols __ctors and __dtors are artifacts of munching.

OMF refers to the object module format, which denes the internal format of object les.

The group number is used internally by the target server symbol handling facilities to associate symbols with modules.

The module Demo.out does not have a bss segment.

The WindSh command moduleShow() may also be used to list the modules loaded.
-> moduleShow MODULE NAME MODULE ID GROUP # TEXT START DATA START BSS START --------------- ---------- ---------- ---------- ---------- ---------vxWorks 0x302c90 1 0x20000 0x7bccc 0x84fc0 A.o 0xeb8008 2 0xc4730 0xc479c 0xc47a4 B.o 0xeb8270 3 0xc46d0 value = 0 = 0x0

Unloading Modules
Modules can be unloaded using the context menu Unload lename item.
q

Frees target memory occupied by text, data and bss segments. Removes symbols dened by this module from the symbol table.

Used if board does not have enough memory to hold code for all projects. Make sure that no tasks are executing functions which could reference the module you are unloading. If other loaded modules reference symbols dened by the code you are unloading, unload them as well.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-38

The WindSh built-in function unld() may also be used to unload modules:

-> unld "Demo.out"


STATUS unld (moduleNameOrId)

Syntax of WindSh unld() command:

moduleNameOrId can be either a module name (e.g. "foo.o") or a (hostbased) module ID.

Common symbols are considered to be dened by the rst module loaded which references them, and are unloaded when that module is unloaded.

Projects
Projects Overview Bootable Projects and VxWorks Conguration Integrated Simulator Downloadable Projects 2.5 Build Specications

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-39

Build Settings
A build specication selects toolchain programs (compiler, linker, assembler, ...) and the ags for each; it also species makele macros and the default rule used in building your project. A project can have several build specications. For example, a production spec and a debug spec; or build specs for different target architectures (downloadable projects only). To access the build specications for your project, select the Builds tab in the workspace window.

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-40

Build Specication Property Sheet

Double clicking on a projects build spec icon brings up the specications property sheet, where you can change build settings.
Tornado Training Workshop Copyright Wind River Systems Wind River Systems

2-41

Compiler Settings

The C/C++ compiler pane allows you to set compiler ags.


2-42

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

The Include debug info checkbox sets the debug ag (-g).

Optimization level selector sets compiler aggressiveness in optimizing (O, -O1, -O2 ags).

Flags vary with CPU architecture. Some ags shown here are: -O0 -g -ansi -m68040 -nostdinc -fvolatile -fno-builtin -I dirName -DCPU=... No optimization Source debugging support ANSI function declarations and prototypes Generate output for a MC68040 Dont use usual UNIX include directories Variables referenced through pointers assumed volatile Dont use compiler built-in functions Location of header les Preprocessor denition of CPU type

Rule Denitions

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-43

The Rules pane in the build spec properties sheet allows you to edit existing rules or dene new rules. The rule selected in the drop-down list on the Rules tab is the build specs default rule. Any custom rules you dene are shared by all build specs.

Other panes allow setting linker and assembler ags, project link order (possibly important for C++), and macro denitions.

Project link order is independent of the particular build spec used.

Build Specication Notes


You can build a project using any build specication dened for that project. Set the active build spec for the selected project using the Build Spec drop-down list at the top of the project workspace. A folder containing object les for the projects active build spec, labeled with the build spec name, is shown in the workspace Files pane. Caveat: If you edit a build spec without touching any project source les, you must Rebuild All... to see the new specication used.

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-44

Summary
The Project Wizard allows you to create
q q

downloadable Projects bootable Projects project les build specications VxWorks conguration (bootable projects) build a custom-congured VxWorks image statically link application code to VxWorks (Reconguration chapter)

The project workspace window allows access to:


q q

A bootable project can be created to:


q q

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-45

Summary
VxWorks conguration
q q

Components can be included or excluded Dependencies determined and reported to you Selections indicate a choice among component versions. Component parameters can be set

Custom VxWorks image built in .../projDir/ buildSpecName/vxWorks (or imageName) Tornado includes an integrated simulator that runs on host OS. Allows development of software prior to hardware availability.

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-46

Summary
Downloadable projects speed up cross-development
q

Object code dynamically linked to running VxWorks image. Old version unloaded Download uses host-based symbol table

The build specication properties dialog allows setting compiler, assembler, and linker programs and ags macro denitions the build specs default rule as well as link order custom rules
q q q q q

Tornado Training Workshop

Copyright Wind River Systems Wind River Systems

2-47

You might also like