Professional Documents
Culture Documents
2
Projects
2-1
Projects
2.1 Projects Overview Bootable Projects and VxWorks Conguration Integrated Simulator Downloadable Projects Build Specications
2-2
Project terminology
Project Files
[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.
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.
(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
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.
2-5
All these terms will be elaborated upon in following sections of this chapter.
Workspace Window
Workspace tabs display:
Files -- Project source
2-6
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).
2-7
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.
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
2-10
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
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.)
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.
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
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.
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.
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.
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
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:
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!
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.)
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.
Projects
Projects Overview Bootable Projects and VxWorks Conguration 2.3 Integrated Simulator Downloadable Projects Build Specications
2-23
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.
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
Pressing the simulator button Pressing the VxSim button (UNIX hosts).
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
2-26
A simulated console window will appear. It is associated with the VxWorks process -- do not close this window during simulator use!
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
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.
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.)
A downloadable project is based on: A toolchain (CPU architecture dependent), or An existing project.
q q
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.
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.
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.
2-32
demo.c
2-33
All VxWorks programs must include vxWorks.h before any other VxWorks header les.
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).
2-35
nm68k is the version of nm supplied with the GNU toolkit for 68k targets.
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.
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
2-37
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 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:
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
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.
2-40
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
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
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.
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)
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.
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
2-47