Following section provides the steps on:

  • How to build your own openPOWERLINK Zynq Linux master?
  • How to convert your X86 Linux PC into a simple openPOWERLINK slave device?
  • How to test POWERLINK operation with the openPOWERLINK master and slave?
1.Hardware requirements

The hardware items required to run openPOWERLINK Linux MN demo on Zynq ZC702 are as follows:

  • 1 Zynq ZC702 board to act as the openPOWERLINK Master
  • 1 Linux development PC
  • 2 Linux PC to act as the openPOWERLINK Slave
  • 1 Micro SD Card Reader
  • 1 Micro SD Card
  • 4 Ethernet Cables
  • 1 Network switch
  • 1 Mini USB serial cable
2. Software requirements

Following are the software packages and its dependencies to be downloaded to run openPOWERLINK Linux Master demo on Zynq ZC702.

  • Ubuntu 12.04/14.04
  • Xilinx ISE v14.7 – click here
  • CMake v2.8.7 or higher version – click here
  • Xilinx Linux – click here
  • openPOWERLINK stack – click here
  • libncurses5-dev (NOTE: Used with Linux menuconfig)
    • sudo apt-get install libncurses5-dev
  • uboot-mkimage (Note: To create uimage without any issue install uboot-mkimage)
    • sudo apt-get install uboot-mkimage on Ubuntu
    • sudo apt-get install u-boot-tools on Lubuntu
3. Environment setup on the Linux PC

This section describes the steps to be carried out to install Xilinx ISE v14.7 and to download the Xilinx Linux repository.

  • Installing Xilinx ISE v14.7
    • Download Xilinx ISE v14.7 from here or use the Xilinx installation DVD to install the Xilinx ISE v14.7 software
    • While installing the Xilinx ISE v14.7 in Ubuntu 12.04/14.04, the following message may be displayed “The cable driver installation failed” as shown below,

Xilinx S/W setup - driver installation failed

Error message for cable driver installation

    • Click ok to continue the installation and finish it
    • To install cable driver refer here
  • Clone the Xilinx Linux repository from here
  • After cloning, the required branch based on the used toolchain version needs to be checked out. Use following command to check out the required branch
    • git checkout -b zynq-build xilinx-v14.7

NOTE: This toolchain used across this document is Xilinx ISE 14.7 and Xilinx Linux branch used is xilinx-v14.7

4. Compile Linux kernel sources for Zynq ZC702

This section describes the steps to be carried out on the Linux PC to compile Linux kernel source for Zynq ZC702 in order to create kernel image file.

    • Export the cross compilation environment variables using following command:
      • export CROSS_COMPILE=arm-xilinx-linux-gnueabi

    • Configure the Linux kernel parameters using the default Zynq configuration file
      • make ARCH=arm xilinx_zynq_defconfig

    • Reconfigure the default settings as per requirement
      • make ARCH=arm menuconfig
    • Major settings which should be changed for executing openPOWERLINK Linux demo are:
      • In Device Drivers/Network Device Support/Ethernet driver support
        • Set the Zynq Ethernet driver to be compiled as modules
          • Enable all the Xilinx devices by pressing (Space key)
          • It will be enabled as [M]
          • Exit and save the configuration
    • Configure the changes as shown

  • Now compile the kernel using the following commands
      • sudo make ARCH=arm CROSS_COMPILE=/opt/Xilinx/14.7/ISE_DS/EDK/gnu/arm/lin/bin/arm-xilinx-linux-gnueabi-

  • To create uImage file:
      • make ARCH=arm UIMAGE_LOADADDR=0x8000 uImage CROSS_COMPILE=/opt/Xilinx/14.7/ISE_DS/EDK/gnu/arm/lin/bin/arm-xilinx-linux-gnueabi-

  • Compile and install the modules for kernel using following commands
  • Compile modules:
    • make ARCH=arm CROSS_COMPILE=/opt/Xilinx/14.7/ISE_DS/EDK/gnu/arm/lin/bin/arm-xilinx-linux-gnueabi-modules
  • Install modules:
      • sudo make ARCH=arm CROSS_COMPILE=/opt/Xilinx/14.7/ISE_DS/EDK/gnu/arm/lin/bin/arm-xilinx-linux-gnueabi-modules_install INSTALL_MOD_PATH=<path to linux kernel for zynq>

5. Cross compile openPOWERLINK 2.x for Linux Zynq

This section describes the steps to be carried out to cross compile the openPOWERLINK for Linux on Zynq

  • Download openPOWERLINK stack from sourceforge (version-2.3.0) – click here
  • Extract the folder using following command
    • tar -xvf openPOWERLINK_v2.3.0.tar.gz
  • To set the Xilinx environment paths, execute the below commands from a terminal
    • cd /opt/Xilinx/14.7/ISE_DS/
    • sudo chmod +x settings32.sh
    • sudo ./settings32.sh /opt/Xilinx/14.7/ISE_DS
  • Export cross compiler bin path:
    • export PATH=$PATH:/opt/Xilinx/14.7/ISE_DS/EDK/gnu/arm/lin/bin/

NOTE: If separate terminals are used, this steps should be repeated in all the terminal instances.

    • Open cmake-gui to cross compile openPOWERLINK

    • To compile stack libraries
        • Point the “Where is the source code” to the stack source folder <openPOWERLINK_Directory>/stack
        • Point the “Where to build the binaries” to the stack build folder <openPOWERLINK_Directory>/stack/build/linux

    • Click the “Configure” button
    • In Specify the Generator for this project dialog, select “Unix Makefiles” generator and “Specify toolchain file for cross-compiling”

    • Point the “Specify the Toolchain file” to the path, “<openPOWERLINK_Directory>/cmake/toolchain-xilinx-arm-linux-eabi-gnu.cmake”

    • Stack should be build in both Release and Debug mode, change build mode using “CMAKE_BUILD_TYPE” parameter and select the “CFG_COMPILE_LIB_MNAPP_KERNELINTF” library

  • Click “Configure” to change the settings and click “Generate” to create makefile with changed configuration
  • Close cmake
  • Change directory to the stack build path – “< openPOWERLINK_Directory>/stack/build/linux”
  • Use following commands to compile the stack
    • make all
    • make install

NOTE: Configure makefile for Debug in cmake-gui and click Generate with changed configuration and compile the stack in build folder with above commands.

  • To compile kernel module
      • Point the “Where is the source code” to the kernel source folder “<openPOWERLINK_Directory>/drivers/linux/drv_kernelmod_edrv”
      • Point the “Where to build the binaries” to the kernel build folder “<openPOWERLINK_Directory>/drivers/linux/drv_kernelmod_edrv/build”

    • Click the “Configure” button
    • In Specify the Generator for this project dialog, select “Unix Makefiles” generator and “Specify toolchain file for cross-compiling”
    • Point the “Specify the Toolchain file” to the path, “<openPOWERLINK_Directory>/cmake/toolchain-xilinx-arm-linux-eabi-gnu.cmake”
    • Set “CFG_KERNEL_DIR” to “/<Xilinx_Zynq_directory>/linux-xlnx” and set “CFG_POWERLINK_EDRV” to emacps

  • Click “Configure” to change the settings and click “Generate” to create makefile with changed configuration
  • Close cmake
  • Change directory to kernel driver build path, “<openPOWERLINK_Directory>/drivers/linux/drv_kernelmod_edrv/build”
  • Use following commands to compile the driver
      • make all
      • make install

  • To compile application:
      • Point the “Where is the source code” to the application source folder “<openPOWERLINK_Directory>/apps/demo_mn_console”
      • Point the “Where to build the binaries” to the application linux build folder “<openPOWERLINK_Directory>/apps/demo_mn_console/build/linux”

    • Click the “Configure” button
    • In “Specify the Generator for this project dialog”, select “Unix Makefiles” generator and “Specify the toolchain file for cross-compiling”
    • Point the “Specify the Toolchain file” to the path, “<openPOWERLINK Directory>/cmake/toolchain-xilinx-arm-linux-eabi-gnu.cmake”
    • Set “CFG_BUILD_KERNEL_STACK” to Linux Kernel Module

  • Click “Configure” to change the settings and click “Generate” to create makefile with changed configuration
  • Close cmake
  • Change directory to the stack build path, “<openPOWERLINK_Directory>/apps/demo_mn_console/build/linux”
  • Use following commands to compile the application
      • make all
      • make install

    "

6. Compile openPOWERLINK 2.x Linux slave in user-daemon configuration

This section describes the steps to be carried out to compile the Linux slave in user-daemon configuration.

  • To download openPOWERLINK source code click here in the PC to be configured as Linux slave
  • Open cmake-gui to cross compile openPOWERLINK
    • To compile stack libraries
        • Point the “Where is the source code” to the stack source folder “<openPOWERLINK_Directory>/stack”
        • Point the “Where to build the binaries” to the stack build folder “<openPOWERLINK_Directory>/stack/build/linux”

  • Click the “Configure” button
  • In “Specify the Generator for this project” dialog, select “Unix Makefiles” generator

  • Stack should be built in both Release and Debug mode, change build mode using “CMAKE_BUILD_TYPE” parameter and select the “CFG_COMPILE_LIB_CNAPP_USERINTF”and “CFG_COMPILE_LIB_CNDRV_PCAP”

 

  • Click “Configure” to change the settings and click “Generate” to create makefile with changed configuration
  • Close cmake
  • Change directory to the stack build path, “<openPOWERLINK_Directory>/stack/build/linux”
  • Use following commands to compile the stack
    • make all
    • make install

NOTE: Configure makefile for Debug in cmake-gui and click Generate with changed configuration and compile the stack in build folder with above commands.

  • To compile Linux driver daemon for slave:
      • Point the “Where is the source code” to the driver daemon source folder “<openPOWERLINK_Directory>/drivers/linux/drv_daemon_pcap”
      • Point the “Where to build the binaries” to the driver daemon build folder “<openPOWERLINK_Directory>/drivers/linux/drv_daemon_pcap/build”

    • Click the “Configure” button
    • In “Specify the Generator for this project” dialog, select “Unix Makefiles” generator

  • Click “Configure” to change the settings and click “Generate” to create makefile with changed configuration
  • Close cmake
  • Change directory to the driver daemon build path, “<openPOWERLINK_Directory>/drivers/linux/drv_daemon_pcap/build”
  • Use following commands to compile the driver daemon
      • make all
      • make install

    • To compile application:
        • Point the “Where is the source code” to the slave application source folder “<openPOWERLINK_Directory>/apps/demo_cn_console”
        • Point the “Where to build the binaries” to the slave application linux build folder “<openPOWERLINK_Directory>/apps/demo_cn_console/build/linux”

    • Click the “Configure” button
    • In “Specify the Generator for this project” dialog, select “Unix Makefiles” generator
    • Set “CFG_BUILD_KERNEL_STACK” to “Linux Userspace Daemon”

  • Click “Configure” to change the settings and click “Generate” to create makefile with changed configuration
  • Close cmake
  • Change directory to the application build path, “<openPOWERLINK_Directory>/apps/demo_cn_console/build/linux”
  • Use following commands to compile the application
      • make all
      • make install

Note: The above compilation steps should be followed to compile slave on another Linux PC. Few changes which are required before compiling slave 2 (CN32):

    • Download openPOWERLINK stack from sourceforge on the second Linux slave PC (version-2.3.0) – click here
    • Change to the slave application source directory and open main.c, “<openPOWERLINK_Directory>/apps/demo_cn_console/src/main.c”
    • Change “#define NODEID 1” to “#define NODEID 32” and save

  • Repeat the steps to compile the second slave
7. Run openPOWERLINK master demo application on Zynq ZC702

This section describes the steps to be carried out to run openPOWERLINK Linux demo on Zynq ZC702 development board.

This section describes the steps to be carried out to run openPOWERLINK Linux demo on Zynq ZC702 development board.

  • To convert the SD card as bootable medium for Zynq – click here
  • To download the 14.7 pre-built binaries (Assuming cross compilation for the Linux is done using Xilinx ISE 14.7 toolchain) click here
    • Extract and copy the following contents from the downloaded folder into the boot partition of SD card
      • uramdisk.image.gz
      • u-boot.elf
      • fsbl.elf
      • devicetree.dtb
      • boot.bin
      • openPOWERLINK binaries (driver and application) from <openPOWERLINK_Directory>/bin
        • demo_mn_console
        • oplkdrv_kernelmodule_edrv
      • uImage (Replace the existing uImage with the cross compiled uImage from path: <Xilinx_zynq_directory>/linux-xlnx/arch/arm/boot).

Note: This is only to quickly boot the Linux binaries. The user is free to create their own bootable binaries for Zynq. Please refer http://www.wiki.xilinx.com/Zynq+linux for detailed steps.

  • To run the openPOWERLINK MN demo application
      • Insert the SD card into the Zynq ZC702 board and power up the board
      • Install minicom (sudo apt-get install minicom) on the development PC
      • From the PC terminal run minicom (sudo minicom -s)

      • Go to Serial port setup
      • Change the Serial Device as per the USB name (/dev/ttyUSB0)
      • Keep the hardware flow control settings to “NO”
    • Save setup as dfl and exit

  • Once autoboot finishes, enter the zynq login and password as “root”

 

  • mount the sd card using the following command
    • # mount /dev/mmcblk0p1 /mnt/card
  • Change to the kernel driver directory
    • # cd /mnt/card/oplkdrv_kernelmodule_edrv
  • Insert kernel driver using the following command
    • # insmod oplkemacpsmn.ko
  • Change to the demo_mn_console application directory
    • # cd /mnt/card/demo_mn_console
  • Run the application
    • # ./demo_mn_console -c /mnt/card/demo_mn_console/mnobd.cdc
8. Run openPOWERLINK slave demo application on Linux PC

This section describes the steps to be carried out to run openPOWERLINK Linux CN demo

Open a new terminal on the Linux PC to run openPOWERLINK slave:

  • Change to the driver daemon install directory on slave PC
    • cd <openPOWERLINK_Directory>/bin/linux/i686/oplkd-pcap/
    • Run the PCAP driver daemon using the following command
      • sudo ./oplkcnd-pcap

Open another terminal:

  • Change to the slave application install directory on slave PC
    • cd <openPOWERLINK_Directory>/bin/linux/i686/demo_cn_console
    • Run the slave application using following command
      • sudo ./demo_cn_console
  • Repeat the openPOWERLINK slave demo application steps on the slave 2 (CN32) Linux PC