Deploying Kanzi applications to i.MX6/INTEGRITY¶
Here you can find how to deploy your Kanzi application to i.MX6 SABRE platform running the INTEGRITY real-time operating system. Kanzi supports this platform since version 2.7.1 and is tested to work with MULTI IDE version 6.1.4 running under Debian GNU/Linux version 6.0.7.
i.MX6/INTEGRITY libraries required for deploying Kanzi applications to i.MX6/INTEGRITY are supplied with Kanzi on request.
Contact Rightware sales at sales@rightware.com to find out more.
Note
You can use JavaScript only on Windows operating system and only for prototyping.
Prerequisites¶
Before you can build and deploy Kanzi applications you need a working INTEGRITY development environment for i.MX6 SABRE including:
MULTI integrated development environment
INTEGRITY system development kit
INTEGRITY ARM compiler toolchain
i.MX 6 SABRE board support package
Vivante GPU support package
For information on how to set up the INTEGRITY development environment, see i.MX6 SABRE Lite BSP User’s Guide provided by Green Hills Software.
In addition to the working INTEGRITY development environment, you need:
TFTP server for deploying binary images to the target
Target with the U-Boot bootloader installed
FAT-formatted memory card for transferring the kzb file to the target
Before you start deploying Kanzi applications to i.MX6/INTEGRITY, make sure you can successfully deploy and run one of the OpenGL examples provided with the GPU support package.
Note that the examples here assume that your development environment is installed in /opt/sdk/ghs/ and that the TFTP server is serving files from the directory /srv/tftp/.
Preparing a memory card¶
Kanzi application reads the assets and scene description exported from Kanzi Studio from the file system of a memory card. This can be the same memory card that hosts the U-Boot bootloader. Prepare a FAT- formatted memory card and make sure you can easily swap the card between your desktop computer and the target board.
Preparing for the Kanzi application development¶
Kanzi development files are provided as a compressed archive. If you received the i.MX6/INTEGRITY support files as a separate package, copy the contents of the package to <KanziWorkspace>/Engine.
The package contains a minimal example project called kzb_player you can use as a template for new Kanzi applications. To load this example project to the appropriate default project for your i.MX6 target, add to openGL.gpj:
../kzb_player/configs/platforms/integrity-arm/kzb_player.gpj [INTEGRITY Application]
Open kzb_player_as0.gpj and edit the macro KZ_ENGINE_DIR to point to your Kanzi Engine installation directory. For example:
macro KZ_ENGINE_DIR=/home/buildserver/workspace/v2_7/Kanzi/Engine
The project compiles without errors when you load it correctly.
Special code considerations¶
When developing Kanzi applications for i.MX6/INTEGRITY, keep in mind that you must call these INTEGRITY-specific functions no later than the onConfigure():
kzsFileBaseSetResourceDirectory("/")function call tells Kanzi where in the file system the kzb file is.VivanteInit()function initializes the GPU subsystem. You need to call it explicitly when linking the GPU libraries statically.WaitForFileSystemInitialization()function call solves a race condition that stems from the way processes are started in parallel under INTEGRITY.
The kzb_player example calls these functions by default.
Compiling and creating a U-Boot image¶
If you are deploying your Kanzi application for the first time, or if you made changes to the program code:
In the MULTI IDE compile the application and kernel by selecting kzb_player.gpj and clicking the compile button (crossed wrench and hammer).
Prepare the image using gmemfile. This produces a file called kzb_player.bin.
Create the final U-Boot image using mkimage. This produces a file called kzb_player.uimage in the TFTP server directory.
You can achieve the last two steps by using this script:
#!/bin/sh
/opt/sdk/ghs/comp_201314/gmemfile kzb_player && \
mkimage -A arm -O linux -C none -a 10800000 -n INTEGRITY -d kzb_player.bin /srv/tftp/kzb_player.uimage
If your target device supports compressed images, you can save some time by creating a zimage instead:
#!/bin/sh
/opt/sdk/ghs/comp_201314/gmemfile kzb_player && \
gzip -f kzb_player.bin && \
mkimage -A arm -O linux -C gzip -a 10800000 -n INTEGRITY -d kzb_player.bin.gz \
/srv/tftp/kzb_player.zimage
Exporting to the Memory Card¶
When you change your Kanzi application in Kanzi Studio, export a new kzb binary to the memory card. Before you deploy your Kanzi application, the memory card must contain:
my_project.kzb you need to update only after exporting a new kzb binary in Kanzi Studio
binaries.cfg you need to update after renaming the kzb binary
application.cfg you need to include and update only if you are using optional parameters to configure your Kanzi application. See Application configuration reference.
Connect the memory card to the target board before powering up the board.
Deploying your Kanzi application¶
You can deploy and boot a U-boot image by executing these commands in the U-Boot bootloader:
tftp 70000000 kzb_player.uimage
bootm 70000000
To save time, you can store these commands to the U-Boot environment to be issued at power up. The exact deployment address (in this case 0x70000000) is target specific. Contact your hardware vendor for more information.
While the kernel is booting, look for these important log messages:
Log message |
Meaning |
|---|---|
|
The USB subsystem is initialized. Kanzi uses USB for mouse and keyboard input. |
|
The graphics driver is initialized |
|
Shows where the SD card is mounted. The path shown (in this case |
Starting the debugger¶
Once the image is booted, to attach the debugger using the rtserv2 protocol in the MULTI IDE go to Main > Connect > rtserv2.
The debugger window opens when the connection is established.
Start the application by selecting the newly created initial process under kzb_player_as0 and clicking the green arrow button.
Switching between debug and release builds¶
You can set whether to use debug or release build in the kzb_player_as0.gpj:
For a debug build define the
_DEBUGpreprocessor macro and link with the debug libraries:-D_DEBUG -L$(KZ_ENGINE_DIR) /lib/integrity-arm/ES2_Debug
For a release build, omit the
_DEBUGmacro and link with the release libraries:-L$(KZ_ENGINE_DIR)/lib/integrity-arm/ES2_Release
After switching the builds, you have to recompile and redeploy the application.
Note that Kanzi documentation refers to Kanzi libraries by names libsystem, libcore, libuser and libapplicationframework. These are renamed to libkzsystem, libkzcore, libkzuser and libkzapplicationframework for the i.MX6/INTEGRITY port to avoid name clashes with existing libraries.