Skip to main content

Integrate Python With VxWorks 7

·486 words·3 mins
Python VxWorks 7
Table of Contents

This guide walks you through building and deploying the Python runtime in Wind River VxWorks 7.

Overview
#

VxWorks is a real-time operating system (RTOS) developed by Wind River. Python is a widely-used open-source programming language maintained by the Python Software Foundation.

Wind River provides Python support for PowerPC, ARM, and Intel architectures.

Prerequisites
#

Ensure you have the following before starting:

  • Wind River VxWorks 7 SR0620
  • Intel target with UEFI BIOS boot support
  • USB flash drive (minimum 4 GB)

Step 1: Create and Build the VSB (VxWorks Source Build) Project
#

Open a DOS shell and set up your environment:

cd <WIND_HOME>              # Your VxWorks installation directory
wrenv -p vxworks-7
cd <YOUR_WORKSPACE>         # Your workspace directory
vxprj vsb create python_vsb -bsp itl_generic -smp -force -S
cd python_vsb
vxprj vsb add PYTHON        # Add the Python layer
make -j 32                  # Build the VSB

After the build, verify that the Python runtime exists:

<YOUR_WORKSPACE>/python_vsb/usr/3pp/deploy

Step 2: Create and Build the VIP (VxWorks Image Project)
#

Now create the VIP:

cd ..
vxprj create -smp itl_generic python_vip -profile PROFILE_INTEL_GENERIC -vsb python_vsb
cd python_vip
vxprj vip component add INCLUDE_MULTI_STAGE_WARM_REBOOT
vxprj vip bundle add BUNDLE_STANDALONE_SHELL
vxprj parameter set DOSFS_COMPAT_NT TRUE
vxprj build

Note: At this stage, Python support has not yet been added to the image.

Step 3: Boot VxWorks on the Target
#

Deploy the Bootloader and Kernel
#

Follow the itl_generic BSP readme for bootloader deployment:

<WIND_HOME>/vxworks-7/pkgs_v2/os/board/intel/itl_generic-a.b.c.d/itl_generic_readme.md

Files expected on USB:

  • EFI/
  • BOOT/
  • bootapp.sys
  • BOOTIA32.EFI
  • BOOTX64.EFI

Prepare the Target
#

  1. Configure BIOS to boot from USB.
  2. Insert the USB flash drive.
  3. Power on the target to enter the kernel shell:
->

Step 4: Identify the USB Device in VxWorks
#

Run the following:

-> devs
-> cd "/bd0a"
-> ls

Note the USB device path (e.g., /bd0a). Power off and return the USB drive to your workstation.

Step 5: Copy Python Runtime to USB
#

Copy this directory to the root of the USB drive:

<YOUR_WORKSPACE>/python_vsb/usr/3pp/deploy

Step 6: Add Python to the VxWorks Image
#

Return to your VIP project and configure Python support:

cd <YOUR_WORKSPACE>/python_vip
vxprj component add INCLUDE_PYTHON_SUPPORT
vxprj component add INCLUDE_FILESYSTEM_SYMLINK_CONFIG
vxprj parameter setstring FILESYSTEM_SYMLINK_CONFIG_STR "<def>=/bd0a/deploy;/bin=<def>/bin;/usr=<def>/usr;/etc=<def>/etc;/lib=<def>/lib;"
vxprj build

Step 7: Update the Boot Image
#

Copy the new VxWorks image to your USB drive:

<YOUR_WORKSPACE>/python_vip/default/vxWorks → EFI/BOOT/bootapp.sys

Step 8: Create a Python Hello World Script
#

Save the following as helloworld.py at the root of the USB flash drive:

# helloworld.py
import os
import sys
print("Hello World!")

Step 9: Run Python on the Target
#

Reboot the target and run the script:

-> cd "/bd0a"
-> ls
-> cmd
[vxWorks *]# python3 helloworld.py
Launching process 'python3' ...
Process 'python3' (process Id = 0x809aa340) launched.
Hello World!

You may also run Python interactively:

[vxWorks *]# python3
Python 3.8.0 (default, Apr 27 2020)
>>> import os
>>> import sys
>>> print("Hello World!")
Hello World!
>>>

This completes the Python deployment process on a VxWorks 7 target.

Related

Configuring a VxWorks 7 System With Secure User Authentication
·605 words·3 mins
VxWorks 7 User Authentication
Deploying a VxWorks RTP as a Container to DockerHub and Raspberry Pi 4
·757 words·4 mins
VxWorks 7 RTP Container Raspberry Pi 4
Why Upgrade to VxWorks 7
·551 words·3 mins
VxWorks 7