Project

General

Profile

Cross Compiling Hello World (C/C++) for the MitySOM-QC6490

An SDK is provided for creating custom applications to run on the MitySOM-QC6490 Devkit. This page will provide steps for compiling and running a C Hello World executable.

Setup the SDK

  • Download and unzip the latest BSP Release from Repositories_and_Pre-built_Images
  • Change into the downloaded directory and run the installer:
    ./qcom-wayland-x86_64-qcom-multimedia-image-armv8-2a-qcs6490-mitysom-devkit-toolchain-1.5-ver.1.1.sh
    
  • You will be prompted to choose the install location. Choose your desired location or accept the default.
  • Once the installation is complete, the toolchain environment setup script will be available for sourcing:
    source {YOUR_INSTALL_DIRECTORY}/environment-setup-armv8-2a-qcom-linux
    
    Note: This must be done each time you wish to use the SDK in a new shell session.
  • The toolchain is now ready to be used. You can verify the toolchain is setup by ensuring the CC environment variable has been set to the cross compiler:
    echo ${CC}
    
    should output
    aarch64-qcom-linux-gcc -march=armv8.2-a+crypto -mbranch-protection=standard -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2
    -Wformat -Wformat-security -Werror=format-security --sysroot=/usr/local/oecore-x86_64/sysroots/armv8-2a-qcom-linux
    

Create and Compile the Program

  • Open your favorite text editor and create a file named "hello.c" with the following contents
    #include <stdio.h>
    
    int main() {
        printf("Hello, World!\n");
        return 0;
    }
    
  • The toolchain can be used directly with Makefile based projects. Lets create a Makefile to compile our hello.c program.
  • In the same location as the hello.c file, download this Makefile with the following contents:
    all: hello.o
        ${CC} hello.o -o hello
    hello.o: hello.c
        ${CC} -I . -c hello.c
    clean:
        rm -rf *.o
        rm hello
    
    Note: The CC environment variable is the gcc cross compiler targeting the MitySOM-QC6490. For C++ projects, the CXX variable should be substituted in its place to use the g++ cross compiler.
  • Source the toolchain setup script if you have not already done so, and run the Makefile:
    make all
    
  • You should now have an executable named "hello" in the current directory.

Load and Run a Program

There are numerous methods for moving files onto the MitySOM-QC6940 Devkit file system. We will use adb for this example.

  • See Using Android Debug Bridge (adb) for Remote Access and File Transfers for details on setting up and using adb on the MitySOM-QC6490.
  • Move the "hello" executable created in the previous step to the MitySOM-QC6490:
    adb push hello /root/hello
    
  • In a terminal on the MitySOM-QC6490, run the program:
    ./hello
    
    You should see the output Hello, World!

Additional Information

The provided SDK is a Yocto Standard SDK, not an Extensible SDK (eSDK).
https://docs.yoctoproject.org/sdk-manual/

Go to top
Add picture from clipboard (Maximum size: 1 GB)