Cross-development

QNX SDP8.0Programmer's GuideDeveloper

In this section, we'll describe how to compile and debug a QNX OS system. Your QNX OS system might be anything from a deeply embedded turnkey system to a powerful multiprocessor server. You'll develop the code to implement your system using development tools running on a supported cross-development platform.

QNX OS supports cross-development, where you develop on your host system and then transfer and debug the executable on your target hardware.

Note:
You can choose how you wish to compile and link your programs: you can use tools with a command-line interface (via the qcc command) or you can use our Integrated Development Environment (see the IDE User's Guide). Our samples here illustrate the command-line method.
Let's look at the spectrum of methods available to you to run your executable:
If your environment is: Then you can:
Cross-development, network filesystem link Compile and link, load over a network filesystem, and then run on the target
Cross-development, debugger link Compile and link, use a debugger to transfer the executable to the target, and then run on the target
Cross-development, rebuilding the image Compile and link, rebuild the entire image, and then reboot the target.

Which method you use depends on what's available to you. All the methods share the same initial step—write the code, then compile and link it for QNX OS on the platform that you wish to run the program on.

Let's go through the steps necessary to build a simple QNX OS program that displays the text Hello, world!—the classic first C program. The program itself is very simple:
#include <stdio.h>

int main (void)
{
    printf ("Hello, world!\n");
    return (0);
}
You compile it for AArch64 with the single line:
qcc -V gcc_ntoaarch64le hello.c -o hello

This executes the C compiler with a special cross-compilation flag, -V gcc_ntoaarch64le, that tells the compiler to use the gcc compiler, QNX OS-specific includes, libraries, and options to create an AArch64 executable using the GCC compiler. At this point, you should have an executable called hello.

To see a list of compilers and platforms supported, simply execute the command:
qcc -V
Page updated: