Kinetis-L Compiler in the iMX6Q

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Kinetis-L Compiler in the iMX6Q

Kinetis-L Compiler in the iMX6Q

1  Introduction

 

This document explains how to configure a cross compiler running in iMX6Q. The target is the Kinetis L family.  For the iMX6Q, Yocto is used to generate the iMX6Q image.

2 Requirements

 

Basic knowledge of Yocto and Linux is required. The steps explained were performed for the iMX6Q SABRE-SD and the Freedom KL25.  Installation of Yocto in your host system is needed too.

3 Procedure

 

The chosen method to configure the cross compiler for the Kinetis L, needs a native compiler that will run in the iMX6Q. Below are the general steps:

 

  • Generate native compiler for the iMX6Q and adding the needed packages for the configuration.
  • Get and extract the source packages of the compiler.
  • Configure, build and install the packages
  • Test the generated cross compiler

 

3.1 Generating packages and native compiler for the iMX6Q

 

The iMX6Q image needs certain packages in order to configure and generate correctly the cross-compiler. After setting up the environment and chose the MACHINE the below lines added in the local.conf file to install those packages in our rootfs:

 

IMAGE_INSTALL_append = " gcc g++ binutils libgcc libgcc-dev libstdc++ libstdc++-dev libstdc++-staticdev gawk gzip perl autoconf automake libtool gettext gperf tcl guile gmp mpfr make m4 texinfo flex bison git"

 

The image to generate is the core-image-minimal:

 

bitbake core-image-minimal

 

Once the building is finished, a native compiler for the iMX6 and other packages needed to configure the Kinetis Compiler should be added to the Yocto image.

3.2 Getting and Extracting the Kinetis L compiler

 

The arm cross compiler version was gotten from CodeSourcery. arm-2011.03-42-arm-none-eabi is used in this document.

You can get the source code by:

 

wget https://sourcery.mentor.com/sgpp/lite/arm/portal/package8736/public/arm-none-eabi/arm-2011.03-42-arm...

 

Once the image was built, boot the imx6 board with this image. Copy the source code (arm-2011.03-42-arm-none-eabi.src.tar.bz) in your target that is running Linux and extract the files.

 

For example, a new folder was created in /home/root directory:

 

$ mkdir gcc_test

$ cd gcc_test

 

And extract the files in this folder:

 

$ tar –jxvf  arm-2011.03-42-arm-none-eabi.src.tar.bz2

$ cd arm-2011.03-42-arm-none-eabi

 

Create a source and a build folder:

 

$ mkdir source build

 

Move all the files to the source folder:

 

$ mv *.tar.bz2 source/

 

Create a new folder in /opt where the kinetis cross compiler will be installed

 

$ cd /opt             

$ mkdir arm-none-eabi

 

3.3 Configure, Build and Install Kinetis Compiler on the iMX6

 

To configure, build and install the compiler these general steps are followed for certain packages:

 

  1. Extract the package
  2. Configure the package
  3. Build and Install the package

 

Create an environment variable that will specify where the cross compiler will be installed:

 

$ export INSTALL_PREFIX=/opt/arm-none-eabi

 

3.3.1 GMP Package

 

Extract the gmp files:

$ cd ~/gcc_test/arm-2011.03-42-arm-none-eabi/source

$ tar –jxvf gmp-2011.03-42.tar.bz2

 

Create a new folder in build directory. This folder will contain a generated Makefile that will be used to build and install the package:

 

$ cd ../build

$ mkdir gmp

$cd gmp

 

Configure the package:

$ ../../source/gmp-2011.03/configure --prefix=$INSTALL_PREFIX --build=arm-poky-linux-gnueabi CC=arm-poky-linux-gnueabi-gcc CXX=arm-poky-linux-gnueabi-g++  --disable-newlib-supplied-syscalls --disable-libgloss --disable-nls --disable-shared

 

Build and Install the package

$make

$make install

3.3.2 MPFR Package

 

Extract the mpfr files:

$ cd ~/gcc_test/arm-2011.03-42-arm-none-eabi/source

$ tar –jxvf mpfr-2011.03-42.tar.bz2

 

Create a new folder in build directory. This folder will contain a generated Makefile that will be used to build and install the package:

 

$ cd ../build

$ mkdir mpfr

$cd mpfr

 

Configure the package:

$ ../../source/mpfr-2011.03/configure --prefix=$INSTALL_PREFIX  --build=arm-poky-linux-gnueabi --target=arm-none-eabi CC=arm-poky-linux-gnueabi-gcc CXX=arm-poky-linux-gnueabi-g++ --with-gmp=$INSTALL_PREFIX --disable-shared

 

Build and Install the package

$make

$make install

 

3.3.3 MPC Package

 

Extract the mpc files:

$ cd ~/gcc_test/arm-2011.03-42-arm-none-eabi/source

$ tar –jxvf mpc-2011.03-42.tar.bz2

 

Create a new folder in build directory. This folder will contain a generated Makefile that will be used to build and install the package:

 

$ cd ../build

$ mkdir mpc

$cd mpc

 

Configure the package:

$ ../../source/mpc-0.8.1/configure --prefix=$INSTALL_PREFIX --target=arm-none-eabi --build=arm-poky-linux-gnueabi CC=arm-poky-linux-gnueabi-gcc CXX=arm-poky-linux-gnueabi-g++ --with-gmp=$INSTALL_PREFIX --with-mpfr=$INSTALL_PREFIX --disable-shared

 

Build and Install the package

$make

$make install

 

3.3.4 Binutils Package                    

                                                           

Extract the binutils files:

$ cd ~/gcc_test/arm-2011.03-42-arm-none-eabi/source

$ tar –jxvf binutils--2011.03-42.tar.bz2

 

Create a new folder in build directory. This folder will contain configure the package:

 

$ cd ../build

$ mkdir binutils

$cd binutils

 

Configure the package:

$ ../../source/binutils-2011.03/configure --prefix=$INSTALL_PREFIX --target=arm-none-eabi --build=arm-poky-linux-gnueabi CC=arm-poky-linux-gnueabi-gcc CXX=arm-poky-linux-gnueabi-g++ --with-gmp=$INSTALL_PREFIX --with-mpfr=$INSTALL_PREFIX --with-mpc=$INSTALL_PREFIX --disable-nls --disable-werror

 

Build and Install the package

$make MAKEINFO=true

$make install MAKEINFO=true

 

3.3.5 GCC Package

 

Extract the gcc files:

$ cd ~/gcc_test/arm-2011.03-42-arm-none-eabi/source

$ tar –jxvf 

 

Create a new folder in build directory. This folder will contain configure the package:

 

$ cd ../build

$ mkdir gcc

$cd gcc

 

Configure the package:

$ ../../source/gcc-4.5-2011.03/configure --prefix=$INSTALL_PREFIX --target=arm-none-eabi   --build=arm-poky-linux-gnueabi  --host=arm-poky-linux-gnueabi  CC=arm-poky-linux-gnueabi-gcc CXX=arm-poky-linux-gnueabi-g++ --enable-languages="c" --with-gnu-ld --with-gnu-as --with-newlib --disable-nls --disable-libssp --with-newlib --without-headers --disable-shared --disable-threads  --disable-libmudflap --disable-libgomp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-libffi  --enable-extra-sgxxlite-multilibs  --with-gmp=$INSTALL_PREFIX --with-mpfr=$INSTALL_PREFIX --with-mpc=$INSTALL_PREFIX

 

Build and Install the package

$make

$make install

 

 

3.4 Testing the Cross Compiler

 

To test the Cross compiler it is necessary to add the path of the installation to the PATH variable.

 

$ export PATH=/opt/arm-none-eabi/bin/:$PATH

 

To check the version of the cross compiler:

 

$ arm-none-eabi-gcc –version

arm-none-eabi-gcc (GCC) 4.5.2

Copyright (C) 2010 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

 

Attached you can find a folder that contains a simple KL25 example that can be compiled in the iMX6 and then flash the Freedom KL25 with the OpenSDA. This means that you have to attach the USB OpenSDA to the OTG port of the iMX6 board.

 

Type the next in the hello folder (/Kinetis  GNU/KL25_TEST/KL25/hello)

 

$make clean

$make

 

This will generate a main.srec file that can be copied to the USB MSD device featured by the OpenSDA.

 

$cp main.srec /meida/sda1

$sync

 

After this, the RGB LED in the Freedom KL25 will toggle.

Original Attachment has been moved to: KL25.tar.zip

Comments

gusarambula​, CarlosCasillas​, jamesbone​, jimmychan​ would you be nice enough to skim through the document and share your comments?

The document looks very good! I think it's very well structured although I would add an index just to have an easier way to jump to a particular package installation for example.

What is the main idea for doing this "Kinetis-L Compiler in the iMX6Q" ?  I think it is better to point out why need to make the Kinetis-L Compiler in i.MX6Q.

Thanks Jimmy you have a good point. We have seen many development tools like Udoo and other that use the imx6 even as host to program a smaller device like Kinetis-L.

Nice document Alex, good structure and content. Have you considered adding some "graphical attractive" like pictures or videos of demo applications working?

No ratings
Version history
Last update:
‎06-10-2015 11:02 AM
Updated by: