Saturday, May 23, 2015

Setting up RTEMS development environment

Setting up the development environment involves :

RTEMS Tools From Source

RTEMS Source Builder (RSB) is a tool that is used to create a tool-chain that is used to compile RTEMS applications. Usually ( as is my case ) it will be a cross development environment. I am developing for the i386 processor on an x86_64 Debian Linux system.
RSB creates the tool-chain, debuggers among other things that are used to compile and test RTEMS ( in all called a tool-set ).
the whole development system in my case has been set up in
    ~/development/rtems

Steps:

1. Setup a development work space:
$ cd
$ mkdir -p development/rtems/src
$ cd development/rtems/src
 
2. Clone the RTEMS Source Builder into the 'src' directory
 
$ git clone git://git.rtems.org/rtems-source-builder.git 
$ cd rtems-source-builder
 
3. Checking if the host is set up correctly,using the sb-check tool

$ ./source-builder/sb-check 

if the output is "RTEMS Source Builder environment is ok" then we are good to go. Else we will have to install the required package, specified in the output of sb-check.
( Note: dev package of python2.7 would have to be installed to compile gdb ) 


4. Build Set

Now getting to create the build set of rtems4.11 for i386.  We create a environment variable PREFIX_COMPILER which will be the default location where our compiler and tools will be installed.

$ cd rtems
$ export PREFIX_COMPILER=$HOME/development/rtems/4.11 
$ ../source-builder/sb-set-builder --log=1-pc386.txt --prefix=$PREFIX_COMPILER 4.11/rtems-i386 
 
It will download and compile the required tools and install them in the directory in $PREFIX_COMPILER. 
After this, the tools have to be put in front of the path variable so that bash searches them first. 

export PATH=$PREFIX_COMPILER/bin:$PATH


Configure and Build RTEMS

1. Clone rtems from the rtems git repository in the     ~/development/rtems directory . 

$ cd ~/development/rtems
$ git clone git://git.rtems.org/rtems.git
$ cd rtems
$ ./bootstrap

2. RTEMS builds out of the source tree. So we create a directory where it will be built.

$ cd ~/development/rtems
$ mkdir pc386
3. Make a directory where it is to be installed and create an environment variable pointing to it

$ mkdir bsp-install 
$ export PREFIX=$HOME/development/rtems/bsp-install 

4. Configure RTEMS.

$ cd pc386 
$ ../rtems/configure --target=i386-rtems4.11 \
--prefix=$PREFIX --enable-tests=samples \
--enable-networking --enable-rtemsbsp=pc386
$ make 
$ make install

Building Sample Applications 

1. Clone examples-v2 from the repository
$ git clone git://git.rtems.org/examples-v2.git examples-v2
2. Create an RTEMS_MAKEFILE_PATH environment variable 
$ export RTEMS_MAKEFILE_PATH=$PREFIX/i386-rtems4.11/pc386
3. Compile 
$ cd examples-v2
$ make
 
Note: The environment variables created here could (and should, for convenience) be put into the bashrc file especially the RTEMS_MAKEFILE_PATH, so that it avoids the trouble of creating them again and again.


References:
1. RTEMS Source Builder :
  https://ftp.rtems.org/pub/rtems/people/chrisj/source-builder/source-builder.html
2. RTEMS Git repository : 
  git.rtems.org

 



     

 

    No comments:

    Post a Comment