VxWorks 7 SDK for Microchip Polarfire SoC Icicle Kit (RISC-V)

Introduction

The VxWorks 7 SDK is a development environment dedicated to VxWorks application developers which includes the following features:

This guide helps you get up and running with developing applications for platforms running VxWorks. You can use it for creating new applications, or just exploration of VxWorks capabilities.

Setting up the development environment

You should start by downloading a VxWorks SDK for your platform of choice from https://labs.windriver.com and unpacking it. Refer to the documentation in docs in the unpacked SDK for additional information on creating and debugging applications.

OS requirements

The SDKs are meant to run on Linux hosts. Some of the examples in this document are specific to Debian derivatives.

Prerequisite(s)

Host dependencies

On Debian derivatives, the following packages need to be installed:

$ sudo apt install build-essential libc6:i386 uml-utilities nfs-kernel-server

Having an FTP server installed on your development host will make application deployment easier and allow you to access the host file system from a VxWorks target.

To accommodate for the varying runtime configurations of the VxWorks kernel images included in the SDKs, you may be interested in using an FTP server option based on pyftpdlib.

Install pyftpdlib:

$ sudo apt install python-pip
$ sudo pip install pyftpdlib

Booting VxWorks

Prebuilt VxWorks binaries can be located in bsps/microchip_pfsoc_1_0_0_0.

Refer to the "Target Boot Procedure" section in bsps/microchip_pfsoc_1_0_0_0/readme/microchip_pfsoc_readme.md for instructions on booting and running VxWorks on the Microchip® PolarFire SoC ICICLE Kit.

Booting VxWorks for Microchip® PolarFire SoC ICICLE Kit on QEMU

This BSP has been verified with the QEMU RISC-V 'microchip-icicle-kit' machine using QEMU version v5.2.0.

Preparing HSS and SD Card Image

Follow the instructions on https://wiki.qemu.org/Documentation/Platforms/RISCV#Microchip_PolarFire_SoC_Icicle_Kit to prepare the BIOS image (HSS) as well as the SD card image to be used by QEMU. Rename the HSS image to hss.bin and SD card image to sdcard.img.

Command Line Options

Create a tap interface to enable networking for the VxWorks guest:

$ sudo -- sh -c "tunctl -d tap0 >/dev/null; tunctl -u $USER -t tap0; ifconfig tap0 192.168.200.1 up"

The following command line options can be used to boot a VxWorks kernel with a default VIP configuration.

$ qemu-system-riscv64 -M microchip-icicle-kit -smp 5 \
      -bios hss.bin -sd sdcard.img \
      -nic user -nic tap,ifname=tap0,script=no,downscript=no \
      -display none -serial stdio \
      -chardev socket,id=serial1,path=serial1.sock,server,wait \
      -serial chardev:serial1

The current terminal session will be used for the first serial port. Open another terminal window and use minicom to connect the second serial port.

$ minicom -D unix\#serial1.sock

HSS output is on the first serial port (stdio) and U-Boot outputs on the second serial port. As soon as the U-Boot prompt is displayed, press "enter" to stop the auto-boot and follow the instructions in section "Target Boot Procedure" from bsps/microchip_pfsoc_1_0_0_0/readme/microchip_pfsoc_readme.md to boot VxWorks.

Application development

Start by opening a Linux terminal window and going to the location of your unpacked VxWorks SDK.

Source the SDK environment file to update your PATH and environmental variables, gaining direct access to the tools included within the SDK.

$ source <SDK_DIR>/toolkit/wind_sdk_env.linux 

Building applications

Sample applications are available in /examples.

A "hello world" C application can be built as:

$ $CC hello.c -static -o hello

Running applications

After you have started VxWorks on your target, start an FTP server on port 21 with user "target" and password "vxTarget" and FTP root in the current user's home.

$ sudo python -m pyftpdlib -p 21 -u target -P vxTarget -d $HOME &

Switching to the "cmd" shell will allow you to navigate to the location of your application with greater ease.

-> cmd
[vxWorks *]# 

Assuming the application is located in $HOME/opt:

[vxWorks *]# cd opt
[vxWorks *]# ls
opt/./hello
opt/./hello.c
[vxWorks *]# more hello.c
#include <stdio.h>

int main(int argc, char **argv) {
    printf("Hello World\n");
    return 0;
}
[vxWorks *]# hello
Launching process 'hello' ...
Process 'hello' (process Id = 0xffff8000004bb6e0) launched.
Hello World

Creating and deploying Python applications

Prerequisites

Setup an NFS server in order to allow the VxWorks target to access the Python sysroot included in the VxWorks SDK.

Adapt the SDK path and add the following line to /etc/exports.

/home/dan/opt/wrsdk-vxworks7-polarfire-icicle/bsps/microchip_pfsoc_1_0_0_0/sysroot *(rw,no_root_squash,no_subtree_check)

Restart the NFS server.

$ systemctl restart nfs-server.service

Prepare the environment on your running VxWorks target. Replace 192.168.200.1 with the IP address of the NFS server.

[vxWorks *]# C
->
-> hostAdd "dl","192.168.200.1"
-> nfsMount "dl", "/home/dan/opt/wrsdk-vxworks7-polarfire-icicle/bsps/microchip_pfsoc_1_0_0_0/sysroot", "/sysroot"
-> fsSymlinkConfig "<def>=/sysroot;/lib=<def>/lib;/usr=<def>/usr"
-> cmd
[vxWorks *]# 

Launch Python from the cmd shell to print the Hello World! string:

[vxWorks *] python3
Launching process 'python3' ...
Process 'python3' (process Id = 0x805a9ad0) launched.
Python 3.8.0a4+ (default, Jun 122019, 10:59:47)
[Clang 8.0.0.1 (ssh://diabuild@stash.wrs.com:7999/llvm/clang.git 0a578b9ee67aa4 on vxworks
Type "help", "copyright", "credits" or "license"for more information.

>>> import sys
>>> print("Hello World!")
Hello World!
>>> print (sys.platform)
vxworks

Python scripts can be executed as

[vxWorks *] python3 helloworld.py

Hello World!

Note:

If you launch Python from the shell, you may need to set the value of rtpSpStackSize before starting Python (for example, set the rtpSpStackSize to 0x1000000). For more information, see rtpSp( ) in the API reference.

Refer to the documentation in docs for additional information on creating and debugging applications.