VxWorks is a leading real-time operating system (RTOS) developed by Wind River Systems, widely used in embedded systems that require deterministic performance. With the release of VxWorks 7, the operating system has been redesigned with a focus on modularity, scalability, and support for modern hardware, including advanced graphics capabilities. Although WindML (a graphics library common in earlier versions of VxWorks such as 5.x and 6.x) has been replaced by modern standards like OpenGL ES and OpenVG in VxWorks 7, it can still run WindML-based graphics demos under appropriate configurations. This article provides a step-by-step guide to running the WindML graphics demo (specifically the classic uglteapot demo) on VxWorks 7, leveraging its backward compatibility and development tools like Wind River Workbench 4.
Prerequisites
Before you begin, ensure you have the following:
- • VxWorks 7 Installation: A licensed version of VxWorks 7 installed on your host (Windows or Linux).
- • Wind River Workbench 4: An Eclipse-based IDE for VxWorks 7 development.
- • Target Hardware or Emulator: A target board with graphics hardware (e.g., Intel x86 or ARM-based boards) or the VxWorks simulator (vxsim) for testing.
- • WindML Source Files: Access to the WindML demo source code (e.g., uglteapot.c) and libraries, typically found in older VxWorks distribution packages or archived documentation.
- • Graphics Support: Ensure the VxWorks 7 image includes graphics components (e.g., framebuffer drivers, OpenVG, or ported legacy WindML support).
- • Development Environment: A configured VxWorks Source Build (VSB) and VxWorks Image Project (VIP) that includes the necessary graphics libraries.
Setting Up the VxWorks 7 Environment
VxWorks 7 uses a layered build system (VSB and VIP projects) to create custom kernel images. To run the WindML demo, you need to ensure graphics support is included.
- 1. Launch Wind River Workbench 4:
- • Start Workbench and select or create a workspace (e.g., C:\Users\YourName\vxworks_workspace on Windows).
- • Ensure your VxWorks 7 installation is registered in Workbench (check under Preferences > Wind River > VxWorks).
- 2. Create a VxWorks Source Build (VSB) Project:
- • In Workbench, go to File > New > VxWorks Source Build Project.
- • Name the project (e.g., vsb_graphics) and select the target architecture (e.g., x86_64 or SIMNT for the emulator).
- • In the configuration wizard, include the following components:
- • INCLUDE_FBDEV (framebuffer driver)
- • INCLUDE_WINDML (if available in your VxWorks 7 distribution; otherwise, you may need to manually port the legacy WindML library)
- • INCLUDE_OPENGL or INCLUDE_OPENVG (as alternative options for modern graphics support).
- • Right-click the project and select Build Project to build the VSB project. This will generate library files for your kernel image.
- 3. Create a VxWorks Image Project (VIP):
- • Go to File > New > VxWorks Image Project.
- • Name the project (e.g., vip_graphics) and link it to your vsb_graphics project.
- • Configure the kernel:
- • Open the kernel configuration editor (double-click kernel_config.c in the VIP project).
- • Confirm that graphics components (e.g., INCLUDE_FBDEV, INCLUDE_WINDML) are enabled.
- • If using the emulator, add INCLUDE_VXSIM.
- • Build the VIP project to generate a bootable VxWorks image (e.g., vxWorks in the default directory).
Obtaining and Preparing the WindML Demo
The uglteapot demo is a classic WindML example that showcases a rotating teapot. Since WindML is an older technology, you may need to obtain it from an older VxWorks installation (e.g., VxWorks 6.x) or from online archives.
- 1. Locate the demo source code:
- • Check your VxWorks installation directory (e.g., /vxworks-7/target/src/Mesa/windmldemos).
- • If not found, consult Wind River documentation or forums for uglteapot.c. Alternatively, if it cannot be found, use the following minimal example:
#include <ugl/ugl.h>
#include <ugl/ugluc.h>
void windMLTeapot(UGL_BOOL animate, int argc, char *argv[]) {
UGL_ID gc = uglGcCreate(UGL_DEFAULT_DISPLAY);
uglGcClear(gc, 0, 0, 640, 480, UGL_RGB(255, 255, 255));
uglTeapot(gc, 200, 200, 100, animate);
uglGcDestroy(gc);
}
void uglteapot(void) {
taskSpawn("tTeapot", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTeapot, UGL_TRUE, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
- • Save it as uglteapot.c.
- 2. Create a Downloadable Kernel Module (DKM) Project:
- • In Workbench, go to File > New > VxWorks Downloadable Kernel Module Project.
- • Name the project (e.g., uglteapot_demo) and link it to your vsb_graphics project.
- • Add uglteapot.c to the project, either by dragging it into the project explorer or using Import > File System.
- • Modify the build settings:
- • Right-click the project, select Properties > Build Properties.
- • Under ‘Paths’, add the include path for WindML headers (e.g., /vxworks-7/target/h/ugl).
- • Under ‘Libraries’, add the WindML library (e.g., libwindml.a), if available, or link to Mesa/OpenGL libraries as an alternative.
- 3. Build the DKM:
Right-click the project and select Build Project. This will generate a target file (e.g., uglteapot_demo.out).
Running the Demo on the VxWorks Simulator
For simplicity, we will use the VxWorks simulator (vxsim) to test the demo.
- 1. Start the simulator:
- • In Workbench, go to Run > Debug Configurations.
- • Create a new VxWorks simulator connection:
- • Select your VIP image (e.g., vip_graphics/default/vxWorks).
- • Click Apply and then Debug to start the simulator.
- • The simulator console should display the boot process of VxWorks.
- 2. Load and run the demo:
- • In the simulator console, load the DKM:
ld < uglteapot_demo.out
- • Start the demo task:
uglteapot
- • If successful, a graphics window should pop up displaying the rotating teapot. If no window appears, ensure the simulator is configured to support graphics output (see troubleshooting below).
Running on Target Hardware
To run on actual hardware (e.g., Intel x86 boards with graphics cards):
- 1. Configure the VIP for hardware:
- • Update the VIP to match your board support package (BSP), rather than the emulator.
- • Rebuild the VIP and transfer the image to the target (e.g., via TFTP or USB).
- 2. Connect to the target:
- • Use the Target Manager in Workbench to connect to the board via the target server.
- • Load and run the DKM following the emulator steps.
- 3. Verify output:
- • Connect a monitor to the graphics output port of the target. The teapot should render on the screen.
Troubleshooting Common Issues
- 1. Graphics window does not appear:
- • Ensure INCLUDE_FBDEV and graphics drivers are included in the kernel.
- • For the simulator, verify that the host supports graphics output (e.g., X11 on Linux or a compatible display server on Windows).
- 2. WindML not found:
- • If VxWorks 7 lacks native WindML support, you can port libraries from older versions or adapt the demo to use OpenGL ES (consult Wind River support for legacy compatibility).
- 3. Linker errors:
- • Check library paths and ensure all dependencies (e.g., ugl, uglic) are linked. Use nm or objdump to check the .out file to ensure all required libraries are present.
- 4. Runtime crashes:
- • If crashing due to stack overflow, increase the task stack size in taskSpawn (e.g., from 100000 to 200000).
Modern Alternatives in VxWorks 7
While demos like uglteapot are educational, VxWorks 7 encourages the use of modern graphics APIs:
- • OpenGL ES: Hardware-accelerated 3D graphics.
- • OpenVG: Vector graphics for 2D interfaces.
- • Tilcon UI: A commercial UI framework for advanced GUIs.
To adapt uglteapot for OpenGL ES, you would replace WindML calls with OpenGL equivalents (e.g., glClear, glRotatef), but this requires more extensive code changes.
Conclusion
Running the WindML graphics demo on VxWorks 7 is a process of integrating legacy code with a modern RTOS environment. By carefully configuring VSB and VIP projects, integrating the demo into a DKM, and testing on the simulator or hardware, you can successfully visualize the teapot demo. This process not only showcases the flexibility of VxWorks 7 but also connects its historical capabilities with modern graphics standards. For further assistance, please refer to the VxWorks 7 documentation or Wind River’s support resources.
Original article link: Please click “Read the original”