| Contents | Index |
This tutorial shows you how to use the XMakefile feature in your MathWorks software to build and run embedded software for VxWorks. For more information about XMakefile, see Makefiles for Software Build Tool Chains.
Set up VxWorks software and hardware on your host and target:
Install Wind River Workshop on the host.
Set up host-to-target communications.
Create a VxWorks operating system kernel image on the host.
Boot the embedded target with the kernel image.
For detailed instructions, consult your Wind River Workshop and VxWorks documentation.
Each time you use VxWorks with your MathWorks software, start by:
Setting the VxWorks environment variables
Starting MATLAB
The XMakefiles feature in your MathWorks software uses standard input/output (command line) to start and communicate with the tool chain in Wind River Workbench. Wind River recommends that you set environment variables using the wrenv utility each time you start those tools from the command line. For more information, read the readme.txt file in the Wind River installation folder, and search the Wind River Workbench help for "Setting Environment Variables With wrenv".
Set the VxWorks environment variables, and then start MATLAB:
Open a command-line session in Windows or Linux.
Change folders to the Wind River installation folder. For example, at the Windows command line, enter:
cd C:\WindRiver
Run the wrenv utility, including -p followed by the relative path to the VxWorks platform you are using.
For example, in Windows, enter:
wrenv.exe -p vxworks-6.7
For example, in Linux, enter:
./wrenv.sh -p vxworks-6.7
Start MATLAB. For example, enter:
C:\Program Files\MATLAB\R2010a\bin\matlab.exe
The XMakefile feature tells your MathWorks software how to create makefiles for a "configuration", which is a specific combination of tool chain and embedded target processor. Some configurations require additional information before you can use them.
Select and complete a configuration for VxWorks:
Enter xmakefilesetup at the MATLAB command prompt. This action opens the XMakefile User Configuration dialog box.
Clear Display operational configurations only. This displays all of the configuration files, including ones that need updated path information.
Set Configurations to a choice that starts with wrs and contains vxworks, and click Apply.
If the configuration is incomplete, the software displays a series of Browse For Folder dialog boxes that include instructions to provide missing information.
Examine the Tool Directories tab to see if the paths are valid.
When you have supplied the missing information and the configuration is complete, click OK to close the XMakefile User Configuration dialog box.
For example, to generate code for VxWorks and an ARM9 processor:
Enter xmakefilesetup on the command line.
In the XMakefile dialog box, clear Display operational configurations only, set Configurations to wrsdiab_arm9_vxworks67_rtp, and click Apply.
When the Browse For Folder dialog box appears, stating "Select the Wind River Diab compiler binary directory...", browse and select a path.
For example, you can select a path such as C:\WindRiver\diab\5.7.0.0\WIN32\bin.
When another Browse For Folder dialog box appears, stating "Select the Wind River root installation directory...", browse and select a path.
For example, you can select a path such as C:\WindRiver.
Examine the Tool Directories tab to see if the paths are valid.
After you complete the update of configuration information, click OK to save the updated configuration and close the dialog box. The wrsdiab_arm9_vxworks67_rtp configuration is now operational.
Create a customized XMakefile configuration that automatically builds and downloads your embedded software to the VxWorks target.
Enter xmakefilesetup at the MATLAB command prompt. This action opens the XMakefile User Configuration dialog box.
Verify that Configurations displays the right configuration, such as wrsdiab_arm9_vxworks67_rtp configuration.
Click New, and name the new configuration.
On the Post-build tab:
For Post-build tool, enter echo
For Arguments, enter the following text as a single line:
rtpSp \"host:[|||MW_XMK_GENERATED_TARGET_REF[E]|||]\">" [|||MW_XMK_OUTPUT_PATH_REF[E]|||]vxscript.txt"
On the Execute tab:
For Execute tool, enter the complete path to the VxWorks simulator executable. For example:
C:\WindRiver\vxworks-6.7\host\x86-win32\bin\vxsim.exe
For Arguments, enter the following string. Substitute vxworksimage with the complete path to the VxWorks operating system kernel image you created earlier:
-f vxworksimage -s "[|||MW_XMK_OUTPUT_PATH_REF[E]|||]vxscript.txt" &
When you enter the path, use double back-slashes. For example:
-f C:\\WindRiver\\workspace\\test_img\\default\\vxWorks -s "[|||MW_XMK_OUTPUT_PATH_REF[E]|||]vxscript.txt" &
The Target Preferences block contains information that your MathWorks software needs to generate code for a specific combination of tool chain and embedded target processor.
Configure your model to generate code VxWorks by updating the Target Preferences block.
If your model does not contain a Target Preferences block:
Open the Simulink Library Browser and search for "Target Preferences". Copy the Target Preferences block from the search results to your model.
In the Target Preferences: Initialize Configuration Parameters dialog box, set IDE/Tool Chain to Wind River Diab/GCC (makefile generation only), and set Board to one of the supported processors.
Click Yes. This action updates the Target Preferences block and model Configuration Parameters. Among other changes, it sets the Operating system parameter in Target Preferences to VxWorks.
If your model already contains a Target Preferences block, open the block and update the parameters described in step 3 and 4.
In your model, build your embedded software by entering CTRL+B. This action causes your MathWorks software to generate code and makefiles. Then the Wind River tool chain loads and runs the embedded software on the VxWorks target.
![]() | Overview of Support for Wind River VxWorks | Working with Other Processors | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |