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

 



     

 

    Introductions and the Summer of Code

    Soon it will be a month since my proposal got accepted by RTEMS into Google Summer of Code. Somehow or the other, writing a blog was something I was not able to do. Though, now that I have started, it will remain active and up to date in the time to come. 

    Now with brief introductions. 

    Me : I am Sujay Raj. A student who recently completed the 4th year of a 5 year integrated master's course. My course is Mathematics and Computing, and I consider myself as a part-time mathematician, and a full time programmer. In the time I am not working, I read Manga and novels, watch Anime or think about philosophical aspects of life. I am a GNU/Linux evangelist, and have helped many people switch from other operating systems (usually MS Windows) to a flavor of Linux.

    GSoC : The Google Summer of Code (GSoC) is a program in which Google awards stipends to all students who successfully complete a requested free and open-source software coding project during the summer (which I think is better, compared to Google Code Jam as it will hopefully help people focus on creating something, instead of giving all their time to competitive programming).

    RTEMS : Real-Time Executive for Multiprocessor Systems, is a free and open source real-time operating system designed for embedded systems. It is the parent organization under which I am to work the whole summer. I first stumbled across RTEMS while searching around the web for study materials for my Operating Systems course. Though at that time I had no idea that I would end up working with them. :)

    Monkey : Monkey is a lightweight and powerful web server and development stack for GNU/Linux. It forms the gist of my summer of code project, as well as, the title of the blog. My project is "Porting Monkey HTTP server to RTEMS", which is self-explanatory (though in the later part I will be dealing with some reorganization of RTEMS's network stack too).  My mentors for GSoC are Chris Johns, Joel Sherril ( both from RTEMS ) and Eduardo Silva (from the Monkey Project ). 





     The title of the blog :  Mon-Key , phonetically in Hindi means "Mind's" and Shantih stands for "peace". So, Monkey shantih will phonetically in Hindi will mean Mind's Peace.




    Now being done with introductions, my next post will cover setting up RTEMS development environment and its networking. 

    References : 

    Google Summer of Code : 
    http://www.google-melange.com/gsoc/homepage/google/gsoc2015
    RTEMS : 
    https://www.rtems.org/
    RTMES Wiki: 
    https://devel.rtems.org/
    Monkey HTTP server :
    http://www.monkey-project.com/