Home/Support / Knowledge Base / Cross-compiling a simple C program in Digi embedded Yocto

Cross-compiling a simple C program in Digi embedded Yocto

To cross-compile a simple C program in Digi embedded Yocto you would need to generate a toolchain first:
# cd ~/workspacedey/cc6sbc

# bitbake dey-image-graphical -c populate_sdk
-----OR-----
# bitbake meta-toolchain

Question: what is the difference between the two above?

·         Use bitbake meta-toolchain. This method requires you to still install the target sysroot by installing and extracting it separately. For information on how to install the sysroot, see the "Extracting the Root Filesystem" section.
·         Use bitbake <image> -c populate_sdk. This method has significant advantages over the previous method because it results in a toolchain installer that contains the sysroot that matches your target root filesystem.

NOTE: Started PRServer with DBfile: /home/leonidm/workspace/tst/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 54266, PID: 9624
Parsing recipes: 100% |###############################################################| Time: 00:01:45
Parsing of 1512 .bb files complete (0 cached, 1512 parsed). 1942 targets, 77 skipped, 6 masked, 0 errors.
NOTE: Resolving any missing task queue dependenciesls
Build Configuration:
BB_VERSION        = "1.22.0"
BUILD_SYS         = "i686-linux"
NATIVELSBSTRING   = "Ubuntu-12.04"
TARGET_SYS        = "arm-dey-linux-gnueabi"
MACHINE           = "ccimx6sbc"

DISTRO            = "dey"

DISTRO_VERSION    = "1.6.5"
TUNE_FEATURES     = "armv7a vfp neon callconvention-hard cortexa9"
TARGET_FPU        = "vfp-neon"
meta             
meta-yocto       
meta-yocto-bsp    = "(nobranch):efde5a130397c597e6464a4e547774b6e600abfa"
meta-oe          
meta-networking  
meta-webserver    = "(nobranch):d3d14d3fcca7fcde362cf0b31411dc4eea6d20aa"
meta-fsl-arm      = "(nobranch):0c4de80867c3ab4e9682dd7802d3fd907d1e1a23"
meta-fsl-demos    = "(nobranch):f141c7d1158b8addbd6f1ed047a1b47c2ed85f8f"
meta-digi-arm    
meta-digi-dey     = "(nobranch):efb7b35e378e2ea458fe197292c7e03a431404f0"
…………………………….
 


# tmp/deploy/sdk/dey-eglibc-i686-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.6.5.sh
Enter target directory for SDK (default: /opt/dey/1.6.5):
You are about to install the SDK to "/opt/dey/1.6.5". Proceed[Y/n]? Y
Extracting SDK...done
Setting it up...done
SDK has been successfully set up and is ready to be used.


We have the toolchain, now we need to setup environment in a particular shell. You have to do it once for every new shell window you open:
# source /opt/dey/1.6.5/environment-setup-cortexa9hf-vfp-neon-dey-linux-gnueabi

Now we are ready to compile HelloWorld.c:

# ${CC} hello_world.c  -o hello_world.out

# file hello_world.out

hello_world.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, BuildID[sha1]=5e5897e6bcfc8cf7fdf6833ec3c16414edd28e51, not stripped

 
Last updated: Aug 08, 2017

Recently Viewed Articles

No recently viewed articles
Contact a Digi expert and get started today! Contact Us