wiki:Yocto/SDK

Yocto Software Development Kit (SDK)

Gateworks provides a Software Development Kit (SDK) compatible with the Yocto Board Support Package (BSP). This SDK provides a cross-toolchain and libraries compatible with the gateworks-gui-image that we provide as a pre-built downloadable disk image so that you can build applications that will run on top of Yocto installed on a Ventana board without having to have build the entire BSP yourself.

Cross Compile SDK Downloads:

  • Yocto 2.3.1 SDK - (sha256sum: b60308cdb1653727054cdb09ef06300d163c283a4128ab57953f69a5dcdae509)
  • Yocto 1.8.2 SDK - (sha256sum: 9dd9b5a2174ad139ccd566596e5ede83071665b5c00d47c9cfab9fa88d88ba8f)

You can build your own SDK compatible with a filesystem image of your choice using information here.

Using the SDK

To use the SDK you need to source the setup-environment* script in the installation directory. This script will augment your path and set several env variables useful for cross-compiling:

  • PKG_CONFIG_SYSROOT_DIR PKG_CONFIG_PATH (for pkg-config)
  • CC CXX CPP AS LD GDB STRIP RANLIB OBJCOPY OBJDUMP AR NM CFLAGS CXXFLAGS LDFLAGS CPPFLAGS ARCH CROSS_COMPILE (for make and cmdline use)
  • M4 CONFIGURE_FLAGS (for aclocal/autoconf/autoheader/automake/autoreconf/autoupdate use)
  1. Run the downloaded/built .sh file and specify an install path:
    /bin/sh ventana-yocto-2.3-sdk-*.sh -d ~/sdk
    
    • Note that you need write access to the directory you wish to install to. By default this is /opt/poky/ but you can change it when prompted or via the -d <dir> parameter
    • do not run the install script as root - if you do, you will need to adjust some directory permissions
  1. cd into extracted toolchain:
    cd ~/sdk
    
  1. Activate the environment:
    source environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
    
    • You will need to do this per new shell
    • The toolchain executables and various support apps will be in your path, but you need to make sure you are using them by using the env vars above in your build instructions and Makefiles.
    • pkg-config is in the SDK path and will provide valid results based on PKG_CONFIG_SYSROOT_DIR PKG_CONFIG_PATH env vars
    • autoconf/automake etc are in the SDK path and will provide valid results based on M4 CONFIGURE_FLAGS env vars
  1. Build:
    • to build a standalone single source app (ie hellowworld.c) use variables defined by the environment such as CC, LD, AR, etc:
      cat << EOF >> helloworld.c
      #include <stdio.h>
      
      int main (int argc, char** argv)
      {
         printf("Hello World\n");
         return 0;
      }
      EOF
      
      $ ${CC} helloworld.c -o helloworld
      $ file helloworld
      helloworld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=6f867176027322dff8c2fbd469cdff804547e2d7, not stripped
      
    • to build using a Makefile which properly uses CC/CFLAGS/LDFLAGS/LIBS etc:
      make
      

For more complete examples see:

Last modified 3 weeks ago Last modified on 10/30/2017 04:01:38 PM