Project

General

Profile

QNX Board Support Package

This page the instructions for using the board support package for the MityDSP-L138 family of modules. The download consists of a zip file that can be imported into Momentics. The BSP is intended for QNX 6.5 but it should also work with QNX 6.4.1. The download files are available on the Files tab. (http://support.criticallink.com/redmine/projects/arm9-qnx-platforms/files)

Using the Board Support Package

Follow these steps to use the Board Support Package in Momentics.

  • File->Import->QNX->QNX Source Package and BSP and hit Next
  • Select Import from local archive file, browse to the board support package zip file and hit Finish

This will create two projects:

  • bsp-mitydsp-omap-l138
  • bsp-mitydsp-omap-l138-src

Build the first project to get an image suitable for downloading.

Starting the tftp server on the host

If you are using Momentics on a PC host, you can start a tftp server by opening the QNX System Builder Perspective. You can also just open the TFTP Server view. (Window -> Show View -> QNX System Builder -> TFTP Server)

The TFTP Server is configured to point to the directory where the built image is located in the bsp-mitydsp-omap-l138 project.

Downloading an image using U-Boot

Environment variables should be set in U-Boot to specify the IP address for the board and the IP address for the host providing the TFTP service.

For example:

U-Boot > setenv serverip 192.168.0.151  (use your host address)
U-Boot > setenv ipaddr 192.168.0.57     (use your target address)

It will probably be convenient to create the following environment variables in U-Boot.

U-Boot > setenv qnxbootfile bsp-mitydsp-omap-l138.ifs
U-Boot > setenv qnxloadaddr 0xc0008000
U-Boot > setenv bootqnxtftp 'tftpboot ${qnxloadaddr} ${qnxbootfile}; go ${qnxloadaddr}'

After setting all the environment variables, be sure to save the environment so the settings are available after the next reboot of the target. You can use the "printenv" command to verify the variable settings.

U-Boot > saveenv

To download the QNX image, enter the following command:

U-Boot > run bootqnxtftp

To make the target download the QNX image by default, try the following:

U-Boot > setenv bootcmd run bootqnxtftp
U-Boot > saveenv

QNX Ethernet Initialization

The starting script has three options for Ethernet initialization:

  • Specify a hard-coded IP address. Changing the IP address requires rebuilding the image.
  • Read the U-Boot environment and use the value of the "ipaddr" environment variable as the target IP address. If the "ipaddr" variable is not set, use dhcp.
  • Use dhcp

By default, the second method is used. The first method requires a different image for each target. The second and third methods can use the same image for multiple targets. If you use dhcp, you will probably want to use dhcp in U-Boot as well. In this case, the "bootqnxtftp" environment variable should be set as:

U-Boot > setenv ipaddr
U-Boot > setenv bootqnxtftp 'dhcp; tftpboot ${qnxloadaddr} ${qnxbootfile}; go ${qnxloadaddr}'
U-Boot > saveenv

The second method will use dhcp if the environment variable is not found. This method uses a utility named "lsconf" to access the U-Boot environment. The U-Boot environment is stored in the NOR flash and requires the spi driver to be loaded for SPI-1.

Change the bsp-mitydsp-omap-l138.bsh file in the bsp-mitydsp-omap-l138 project to select the desired option.

For the first method, change these lines from:

###############
##  Option 1. Using Hard-coded IP address
###############
# display_msg Using hard-coded IP address: 1.2.3.4
# ifconfig emac0 1.2.3.4/16 up

to:

###############
##  Option 1. Using Hard-coded IP address
###############
display_msg Using hard-coded IP address: 1.2.3.4
ifconfig emac0 1.2.3.4/16 up

and replace 1.2.3.4 with the desired IP address. Comment out the lines used for method 2.

For the second method, make sure these lines are uncommented:

##############
##  Option 2. Using IP address from uboot environment
##
## Must be after the SPI interfaces are set up since lsconf reads the spi-flash for the uboot parameters.
#####################################################################################################################
PATH=/bin:/proc/boot
LD_LIBRARY_PATH=/proc/boot
ksh /proc/boot/start_network.sh

For the third method, make sure these lines are uncommented:

##############
##  Option 3. Using dhcp
##
#####################################################################################################################
display_msg Using DHCP to get IP address
dhcp.client -i emac0 -u

The lines for just one of the methods should be uncommented. The other lines should all be commented out.

Debugging and qconn

If you want to do debugging from Momentics, you will need to start the debug agent on the target. This can be done by changing the bsp-mitydsp-omap-l138.bsh file in the bsp-mitydsp-omap-l138 project.

Change the lines toward the end to look like this:

#######################################################################
## REMOTE_DEBUG (gdb or Momentics)
##  - refer to the help documentation for the gdb, qconn and the IDE
##    for more information on remote debugging
##  - the commands shown require that NETWORK is enabled
#######################################################################
# Need ptys for telnet/ftp/debugger
devc-pty -n16 &

# first device create by devc-pty is /dev/ptyp0. wait for it.
waitfor /dev/ptyp0

# qconn is what the QNX IDE needs to attach to this system.
# port=8000 is the default value.
qconn

These commands will create pseudo-ttys and start the debug agent. The pseudo-ttys allow the debugger to connect to stdin and stdout for the processes being debugged so the input/output is available in a Momentics console view.

Loading the fpga from QNX

The fpga-omapl1xx driver can be used to load an fpga image into the fpga after QNX is running. The driver makes the following devices:

/dev/fpga/cmd
/dev/fpga/image
/dev/fpga/state
/dev/fpga/version
/dev/fpga/devices

The "cmd" device is used to send different commands to control the loading process. The available commands are:

echo 1 >/dev/fpga/cmd           Reset the fpga. This is the first step in loading a new image.
echo 2 >/dev/fpga/cmd           Put the fpga into programming mode
echo 3 >/dev/fpga/cmd           Finish the programming mode

The "image" device is used to receive an actual image. This is used after the fpga is in programming mode.

cat IndustrialIO.bin >/dev/fpga/image

The "state" device is used to display the current programming state. The possible states are:

UNKNOWN         This is the initial state for the driver before any commands have been given.
                If the fpga was programmed from u-Boot (using the loadfpga command), the current driver
                will not be aware of it.
RESET           This is the state after sending a 1 to /dev/fpga/cmd
PROGRAMMING     This is the state after sending a 2 to /dev/fpga/cmd
PROGRAMMED      This is the state after a good download and sending a 3 to /dev/fpga/cmd
PROGRAM_FAIL    This is the state after a failed download and sending a 3 to /dev/fpga/cmd

The "version" device is used to display the version of the base module.

The "devices" device is used to list the cores that are in the fpga.

A sample fpga programming session is shown below:

# echo 1 >/dev/fpga/cmd
# echo 2 >/dev/fpga/cmd 
# cat /QNX650/IndustrialIO.bin >/dev/fpga/image
# echo 3 >/dev/fpga/cmd
# cat /dev/fpga/version
PROGRAMMED
FPGA Version        : 01.00
FPGA Date           : 0010-04-20
Base Module Version : 01.00
Base Module Date    : 0010-04-20
# cat /dev/fpga/state
PROGRAMMED# 
# cat /dev/fpga/devices
Enumerating Devices
Found Device ID 00-Base Module (01.00) at 66000000
Found Device ID 23-ADS7843 Touch Screen (01.02) at 66000080
Found Device ID 07-I2C Interface (01.00) at 66000100
Found Device ID 02-LCD Settings Controller (01.00) at 66000180
Found Device ID 01-TFP410 DVI Controller (01.00) at 66000200
# 

These commands could be put into a script for more convenience.

Shared QNX files

By default, the BSP starts the fs-cifs driver. This driver can be used to mount a samba share drive. This can be very convenient from the target since it can make many files available on the target without having to include each of them in the target image.

The BSP includes a mount point at /QNX650 and a shell script (/proc/boot/share_qnx.sh) to mount a shared drive on your host PC. Currently, the script needs to be modified to reflect the actual server name and host IP address.

To set up the shared drive, perform the following steps:

mkdir c:\cl_qnx650
xcopy /s /I c:\QNX650\target\qnx6\usr\photon c:\cl_qnx650\usr\photon
xcopy /s /I c:\QNX650\target\qnx6\usr\bin c:\cl_qnx650\usr\bin
xcopy /s /I c:\QNX650\target\qnx6\usr\lib c:\cl_qnx650\usr\lib
xcopy /s /I c:\QNX650\target\qnx6\armle\* c:\cl_qnx650

Use Windows File Explorer to share the c:\cl_qnx650 directory as QNX650.

On the host, enable the "guest" user account with no password

The share_qnx.sh script just puts together a mount command which looks like this:

mount -t cifs -o user=guest,password=none //jp_laptop:10.0.102.18:/QNX650 /QNX650

where jp_laptop is the host PC name, 10.0.102.18 is the host IP address, and QNX650 is the samba share name.

After doing the mount, all the QNX commands are available from the target. By using the share, you do not have to include each command in the target image.

Photon

By default, the BSP starts the USB driver so you can attach a mouse and keyboard. (use the "usb" command to see the attached devices.) The DVI is configured for use as the display monitor interface. (SVGA 640x480)

To use the DVI interface, you need an FPGA image loaded if your target has an FPGA. The FPGA image for the indio board can be found at LCD Configuration. Copy the image (IndustrialIO_dvi_revC-D.bin assuming you have a rev C or rev D board) to the Images directory in the bsp-mitydsp-omap-l138 directory. Copying the file to this directory makes the file available to the target through tftp. Download the FPGA image to the target using these commands:

U-Boot > tftp 0xc0000000 IndustrialIO_dvi_revC-D.bin; loadfpga 0xc0000000 0x71544

After mounting the QNX650 samba share to get access to all the QNX commands, it is fairly easy to try Photon if you have an SVGA (640x480) monitor attached. After mounting the drive, try these commands:

# start_photon.sh
# pterm &

If all goes well, you should see a shell on the monitor.

There is also a stop_photon.sh script to stop all the photon processes. Currently, if you use stop_photon.sh and then use start_photon.sh again, the display is not correctly initialized. If you again use stop_photon.sh and again use start_photon.sh, the display will then work.

Booting the QNX image from flash

To boot the QNX image from flash, first create the following environment variables:

U-Boot > setenv flashqnxtftp 'tftpboot ${qnxloadaddr} ${qnxbootfile}; sf probe 0; sf erase 0x100000 0x580000; sf write ${qnxloadaddr} 0x100000 ${filesize}'
U-Boot > setenv bootqnxflash 'sf probe 0; sf read ${qnxloadaddr} 0x100000 0x580000; go ${qnxloadaddr}'
U-Boot > setenv flashfpga 'tftpboot 0xc0000000 IndustrialIO_dvi_revC-D.bin; sf probe 0; sf erase 0x680000; sf write 0xc0000000 0x680000 ${filesize}'
U-Boot > setenv loadqnxfpga 'sf probe 0; sf read 0xc0000000 0x680000 0x71544; loadfpga 0xc0000000 0x71544'
U-Boot > saveenv

To download the QNX image and write it into flash:

U-Boot > run flashqnxtftp

To download an FPGA image and write it into flash from U-Boot:

U-Boot > run flashfpga

To make the FPGA image automatically be loaded when the target boots:

U-Boot > setenv bootfpga run loadqnxfpga
U-Boot > saveenv

To make the target read the QNX image from flash and boot the target:

U-Boot > setenv bootcmd run bootqnxflash
U-Boot > saveenv

Running at 456MHz

In order to run the module at 456MHz, a couple of changes will be needed.

  • Startup code
    • In src/hardware/startup/boards/mitydsp-omapl138/main.c, change the line #define USE456MHZ 0 to #define USE456MHZ 1
  • bsp-mitydsp-omap-l138.bsh
    • The lines that start the serial port drivers need to change to reflect the higher clock speed. The clock rate for the uart peripherals is 1/2 the processor clock speed. When running at 300MHz, the clock speed needed is 150000000. At 456MHz, the new value is 228000000. Example of old and new lines:
      300MHz:
      devc-ser8250 -M -e -F -S -b115200 -c150000000/16 0x01d0c000^2,53
      
      456MHz:
      devc-ser8250 -M -e -F -S -b115200 -c228000000/16 0x01d0c000^2,53
      
    • Entries starting other drivers (I2C, SPI, etc.) may also need adjustments for the higher processor clock speed.

Releases

Go to top
Add picture from clipboard (Maximum size: 1 GB)