Contents:
Part1 : Environment setup and initial build
Part2 : Build u-boot using Yocto
Part3 : Build Kernel using Yocto
Part4 : Package Development using Yocto
Part5 : Application Development using ADT <-- You are here
Previously we build a package in yocto and managed to get it bundled with sdcard image.
Users developing apps for a target hardware need a development platform.
The development platform consists of primarily Toolchain & IDE.
For developing apps we need to get the toolchain first.
The toolchain can be either a pre-built tarball or build manually using yocto
As usual : we will start with yocto environment set-up:
~$ cd fsl-arm-yocto-bsp
~/fsl-arm-yocto-bsp$ MACHINE=riotboard source fsl-setup-release.sh -b build -e fb
~/fsl-arm-yocto-bsp/build$
Using pre-built ADT tarball:
In my previous blog we had built a helloworld package using the yocto sources available locally.
but everyone may not be interested in wasting at-least 30GB disk space just for developing a Riotboard app.
Its better to use a pre-built toolchain from Yocto repositories:
http://downloads.yoctoproject.org/releases/yocto/yocto-1.5.2/toolchain/i686/
we will download the one for armv7a :
Once downloaded run the installer with defaults.
./poky-eglibc-i686-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.5.1.sh
accepting the defaults will install toolchain to /opt/poky/1.5.1
We will verify the downloaded toolchain by compiling a c code.
setting up toolchain in environment .
cross compile and test a simple code.
myapp.c
#include <stdio.h> void main() { printf("Hello Riot \n"); }
~$ mkdir riot_apps
~$ cd riot_apps/
~/riot_apps$
~/riot_apps$ source /opt/poky/1.5.2/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
~/riot_apps$ arm-poky-linux-gnueabi-gcc myapp.c
Now copy the generated binary to Riotboard and execute .
Build toolchain using Yocto:
The toolchain we used above is nice and good (thanks to yocto guys), but what if you have a custom package or a newly introduced library to integrate to toolchain.
Well we need to build one.
The build process is fairly simple.
Fetch all sources to build the toolchain:
bitbake -c fetchall meta-toolchain
Build the toolchain:
bitbake meta-toolchain
enter toolchain SDK directory:
cd /home/tushar/fsl-arm-yocto-bsp/build/tmp/deploy/sdk
Install the toolchain we just build:
./poky-eglibc-i686-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.5.2.sh
accepting the defaults will install toolchain to /opt/poky/1.5.2
Time to test the toolchain.
compiling c source used earlier in this blog.
cd riot_apps
source /opt/poky/1.5.2/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
arm-poky-linux-gnueabi-gcc myapp.c
Now copy the generated binary to yocto and verify the working status..
Next we will try to compile and test a i2c user space driver .
you can use the xtrinsic driver i wrote earlier.
using the previous settings
arm-poky-linux-gnueabi-gcc xtrinsic_driver.c
It works..
Plz check ADT Manual for more information.
I hope you liked the blog, let me know by comments if any challenges.
I will do my best to answer them.