QNX Getting Started Guide

Published on December 9, 2015

Archived Notice

This article has been archived and may contain broken links, photos and out-of-date information. If you have any questions, please Contact Us.

This post intends to gather all the information you need to start a project based on QNX Neutrino Real-Time Operating System. It will provide instructions to build your own BSP and/or application.


Introduction

As Wikipedia says: QNX is a commercial Unix-like real-time operating system, aimed primarily at the embedded systems market.

As this RTOS is based on a micro-kernel architecture, it offers a very high stability and robustness which is why it is mainly used for critical applications in medical, defense or automotive industries.

Here is a quick video that shows our QNX6.6 BSP running on our Nitrogen6X platform:

Requirements

Either for BSP or App debugging, QNX Momentics IDE must be installed on your host machine:

Then the BSP can be found on QNX website:

From there can be download either our QNX6.5 or QNX6.6 BSP:

BSP development

In order to build the BSP, you can either do it in command line:

~$ mkdir qnx-bsp && cd qnx-bsp ~/qnx-bsp$ unzip BSP_boundary-imx6q-nitrogen_br-660_be-660_786740.zip ~/qnx-bsp$ make

Or you can use the Momentics IDE:

  • File > Import > QNX > QNX Source Package & BSP > Local archive

qnx_bsp_import

Once imported you can browse the source code:

qnx_bsp_dev

The result of the build will be located under the images/ folder.

Flashing procedure

After either manual or IDE build, the output file will be images/qnx-ifs (orimages/ifs-*.raw on older BSP).

At this point you simply need to copy this IFS image along with images/bootscript/6x_bootscript to an SDCard or USB drive previously formatted in FAT32 or ext2/3/4.

~/qnx-bsp$ cp -v images/qnx-ifs images/bootscript/6x_bootscript

App development

Application development is actually going to be pretty similar as it is based on the same tool:

  • File > New > QNX C/C++ project

qnx_app_creation

Once the application is set up, you can specify the target architecture which is ARMv7 in our case.

qnx_app_creation2

Then a sample C file will be created, from there you can start developing/debugging the application.

  • Run > Debug As > QNX C/C++ application

qnx_app_debugging

System Profiling

On top of an excellent debugging capability, this IDE also offers many profiling features which allow to fine tune your system, making sure the process are running as expected.

First, an Eclipse perspective offers many information about every process memory consumption:

  • Window > Open Perspective > QNX System Information perspective
  • On the left panel: right click > New QNX Target (enter the IP of the board)

qnx_memory

From that same perspective, you can start a profiling of several seconds on the target. This will record every interrupt occurring on the target, every task-switching, every instructions, allowing to discover is using the CPU too much or too often for instance.

  • On the left panel: right click > Log With... > Kernel Event Trace
  • Output log will be a .kev file that can be opened with the IDE

qnx_profiling2

Tips & Tricks

This section will give a few tips for those coming from the Linux world, the equivalent of very famous/useful Unix tools.

System logs

If you are looking for dmesg and /var/log/syslog you will see that those do not exist. Instead every log is centralized in sloginfo:

# sloginfo Time Sev Major Minor Args Jan 01 00:00:00 2 19 1800 devb-sdmmc-mx6_generic 1.00A (Dec 2 2015 22:43:33) Jan 01 00:00:00 2 5 0 libcam.so (Feb 22 2014 18:44:02) bver 6060109 ...

Then your application must use the slogf function in order to have the log appear the standard way.

Processes list

Unix systems usually rely on the ps command in order to list the running processes, QNX has another tool called pidin.

# pidin pid tid name prio STATE Blocked 1 1 /procnto-smp-instr 0f READY 1 2 /procnto-smp-instr 0f RUNNING 1 3 /procnto-smp-instr 0f RUNNING 1 4 /procnto-smp-instr 0f RUNNING ...

Refer to the documentation to know about the different options of the tool.

Manual

Unix users are familiar with the man command which displays the manual pages of a command, instead QNX has use.

# use dvfsmgr-imx6 dvfsmgr-imx6 - DVFS Manager dvfsmgr-imx6 [vwp:i:c:d:u:s] Options: -c cfg_file DVFS config file path (default: /etc/system/config/dvfs.conf) -o cfg_pwrtable DVFS config Power Table file path (default: /etc/system/config/dvfs_pwrtbl.conf) -v Increase verbosity ...