SDK Documentation 4.14 - WinSystems/c444-manifest GitHub Wiki

SDK Documentation 4.14

Background

The SDK (Software Development Kit) is a bundle of tools, libraries, and drivers which are used to support development and deployment of applications on the ITX-P-C444 product.

Yocto can build an SDK for the target platform, allowing developers to build and deploy applications, uboot, and the kernel remotely. The SDK is built automatically with every image build (ex: fsl-image-validation-imx). Here are the steps for setting it up on a development machine.

Build and install SDK with Yocto / bitbake

  1. Build the toolchain in Yocto:
    bitbake meta-toolchain-qt5

  2. From the build directory in yocto, change directories to the sdk directory:
    cd tmp/deploy/sdk

  3. Run the file ending in .sh in the directory that was opened in the previous step:
    ./fsl-imx-ipk-xwayland-glibc-x86_64-meta-toolchain-qt5-aarch64-toolchain-4.14-sumo.sh

  4. It will prompt for a directory to be installed to. By default it gets installed under /opt/

  5. Once it has finished installing you can run the following to set up your environment:
    source /opt/fsl-imx-ipk-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux
    (path may be different depending on installation directory selected in step 4)

  6. After that run the following: unset LDFLAGS

From there you should be good to build for your target from your development machine. You will have to run steps 5 and 6 every time you open a new terminal that you would like to build for the target in. You can use tools like scp and ssh to send files over the network to your target and run commands.

Building Linux Kernel on a Development Machine

The kernel and device tree can be rebuilt using the SDK. The source can be cloned from the WinSystems GitHub like so:
git clone https://github.com/WinSystems/linux-imx8m.git

After it is done cloning, cd into the folder it pulls down. Here are some steps for building and modifying your own kernel.

Setup config file for building kernel:
make defconfig
From this point the drivers built can be modified by editing the .config file in this folder.

Build the kernel:
make Image -j[Number of threads available on build machine]

Build the device tree:
make dtbs
The path to the device tree source is arch/arm64/boot/dts/freescale/fsl-imx8mq-picoitx.dts if changes are desired.

Build kernel modules:
make modules

Copy all kernel modules to a folder:
export INSTALL_MOD_PATH=[insert path to destination folder for modules]
make modules_install

Copy the new kernel to a target (make sure target is on same network as build machine):
scp ./arch/arm64/boot/Image root@[ip of target]:/run/media/mmcblk0p1
May not be root if you set up a user account. Also may not be mmcblk0p1 if you aren’t booting from the eMMC
Copy the new device tree
scp ./arch/arm64/boot/dts/freescale/fsl-imx8mq-picoitx.dts root@[ip of target]:/run/media/mmcblk0p1
May not be root if you set up a user account. Also may not be mmcblk0p1 if you aren’t booting from the eMMC

Any of the make steps can be accelerated by using more threads. Add the argument -j[number of threads].
Example command for building the kernel on a machine with 16 threads available
make -j16 Image

Using the SDK in QT Creator

QT Creator is the IDE provided by QT. Here are the steps to set up remote deployment and debug to the 444 from a development machine using QT Creator after the SDK has been installed.

Configuring QT Kit using the SDK

  1. Install and open QT Creator
  2. Open the settings window by selecting Tools->Options from the top bar.
  3. Select Kits from the menu on the left side of the window
  4. Select the Qt Versions tab and click Add...
  5. Navigate to /opt/fsl-imx-ipk-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake (Path may vary if SDK was installed somewhere else)
  6. Select the Compilers tab
    a. Select Add and GCC/C
    b. Set the name to C444_GCC and the path to:
    /opt/fsl-imx-ipk-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc
    c. Click Apply
    d. Select Add and GCC/C++
    e. Set the name to C444_G++ and path to:
    /opt/fsl-imx-ipk-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++
    f. Click Apply
  7. Select the Debuggers tab
    a. Click Add
    b. Name it C444_GDB
    c. Set the path to:
    /opt/fsl-imx-ipk-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gdb
    d. Click Apply
  8. Select the CMake tab a. Click Add
    b. Name it C444_CMake
    c. Set the path to:
    /opt/fsl-imx-ipk-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/cmake
    d. Click Apply

Setting up Remote Debug and Deployment

  1. Connect C444 to the network
  2. Get the board's IP (can be done with ifconfig or ip addr)
  3. Add the Device to Qt Creator a. In Qt Creator open the settings from the top bar Tools->Options b. Select Devices in the left portion of the Options Dialog Box c. Click Add... d. Pick Generic Linux Device e. Name the device, such as C444, and provide the ip address and user name f. Authentication via Keys can be set up via Qt g. If password access (winsys/winsys) is preferred, this can be changed after the wizard completes.
  4. Select Kits from the side bar
  5. Under the Kits tab, click Add
    a. Set the name to C444
    b. Set the Device type to Generic Linux Device, and Start Wizard
    c. Set the Device Name, such as:C444
    d. Set the compilers to C444_GCC and C444_G++
    e. Set the Debugger to C444_GDB
    f. Set the Qt version to Qt 5.10.1 (qt5)
    g. Set CMake to C444_CMake