Cross-development
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.
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.
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);
}
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.
qcc -V