Setting up an RTEMS development environment for the Raspberry Pi
For this tutorial, I’m going to use Ubuntu 12.10 64 bit (updated to 14.10 LTS on April 2014). It is possible to do RTEMS development on almost any recent version of Linux, OS X, FreeBSD, and Windows. The RTEMS project provides pre-built compilers for all RTEMS architectures for a number of different development hosts including Fedora, CentOS, Suse, and Windows.
In addition to the pre-built compilers provided, there is a tool called RTEMS Source Builder that can download, patch, build, and install the compiler for you. This is what we will use for our Ubuntu setup.
|
Install Ubuntu prerequisites:
|
Decide where the RTEMS tools and projects will reside
Here is the directory structure we will be using:
Path | Description |
---|---|
$HOME/development/rtems |
The base directory for all RTEMS work |
$HOME/development/rtems/compiler |
Where the compiler is installed |
$HOME/development/rtems/rtems-git |
Where the RTEMS source code is checked out |
$HOME/development/rtems/bsps |
Where the RTEMS board support packages/libs are installed |
$HOME/development/rtems/rtems-source-builder |
The RTEMS source builder tool |
Table 1. Directory Structure
Lets get started on this:
|
Build the RTEMS ARM cross compiler
The RTEMS Source builder documentation is located here:
http://www.rtems.org/ftp/pub/rtems/people/chrisj/source-builder/source-builder.html
1. Check out the RTEMS source builder tool
|
2. Double check that all source builder dependencies are present:
|
This command should return the following:
|
The separate autotools build is no longer needed. The source builder will install them for you. |
3. Build and install the toolchain
|
After the full download and build process, the toolchain is installed in:
$HOME/development/rtems/compiler/4.11
This whole process can take about 10 to 30 minutes depending on your computer specs. This has been run on a Raspberry Pi: Expect that to take all day! |
4. Add the toolchain bin directory to your path, and you are ready to download and build RTEMS:
|
Using your favorite editor, edit the .profile file and add the following line at the end of the file
|
5. Now, logout and log back in. Open a terminal and type:
|
You should see the compiler version message. The compiler is installed and ready to use!
Hi, alan
ReplyDeleteI'm try to build on debian (fresh installation into a VMWare machine).
after:
$ ../source-builder/sb-set-builder --log=build-log.txt --prefix=$HOME/development/rtems/compiler/4.11 4.11/rtems-arm
shell returned:
Traceback (most recent call last):
File " ../source-builder/sb-set-builder", line 26, in
setbuilder.run()
File " ../source-builder/sb/setbuilder.py", line 364, in run
log.default = log.log(opt.logfiles())
File " ../source-builder/sb/defaults.py", line 594, in logfiles
return self.opts['log'].split(',')
AttributeError: 'NoneType' object has no attribute 'split'
You know how to fix it.
Thank you.
try running ../source-builder/sb-check
DeleteThis will let you know if all of the required tools are installed
Also, what version of debian are you running? And what version of python?
Also, the RTEMS project has debian packages for the tools:
Deletehttp://www.rtems.org/ftp/pub/rtems/linux/4.11/debian/
If you use these, you will have to change the arm-rtems4.11 prefix to arm-rtemseabi4.11 when configuring and building rtems.
-the debian mount 2.6.32-5-amd64 kernel;
ReplyDelete-the python version is 2.6;
-I made the check after git cloning and the result was ok;
Ok ... may be I fix it.
ReplyDeleteUnder Debian the requirements are:
$ sudo apt-get install autoconf automake bison flex binutils gcc g++ gdb \
texinfo unzip ncurses-dev python-dev git.
Then we must add autoconf automake bison flex texinfo ncurses-dev python-dev to the list above!
I hope the build will finish without error.
The build was gone fine!
ReplyDeletein my macbookpro 5.5 and the Debian VM the time elapsed was 1h 17min;
In this moment I'm doing the same thing on my macBookPro the requirements for building process:
from official chrisj reference:
MacOS X:
The RTEMS Source Builder has been tested on Mountain Lion. You will need to install the Xcode app using the App Store tool, run Xcode and install the Developers Tools package within Xcode.
But I've tryed ...and not work. Then I installed the Debian requirements on MacOS using homebrew.
I've used others tool-chains, in past, in my system then installing packages listed below (that I have installed throught homebrew) worked fine for me:
$ brew install autoconf automake binutils texinfo xz
In general I suppose that in a fresh install we need of Xcode, DevelopesTools and all Debian requirements.
The time elapsed for this building was 1 hour and 08 minutes.
A bit surprisly, the time in DebVM is similar for both building process...
The VM was created using only one of the two processor present in the laptop.....
Yes Debian have a fresh install, and yes Debian is Debian... ( :) ) but ..... o_O
Question:
ReplyDeleteIn ypur opinion, can I install in this way also RTEMS running in MacOSX (i386 for a MBPro5.5)??
if yes can I follow this tutorial modifying it in this way:
1:SettingUp RTEMS dev-env for MacOsX:
a.
satisfy requirements;
b.
$ cd $HOME
$ mkdir -p development/rtems/compiler
$ cd development/rtems/compiler
(skip this point if another RTEMS build is present in the sys.
and jump to point e)
c.
$ cd $HOME/development/rtems
$ git clone git://git.rtems.org/chrisj/rtems-source-builder.git
d.
$ cd rtems-source-builder
$ source-builder/sb-check
e.
$ cd rtems (you should be in $HOME/development/rtems/rtems-source-builder/rtems )
$ ../source-builder/sb-set-builder --log=build-log.txt \
--prefix=$HOME/development/rtems/compiler/4.11 \
4.11/rtems-i386
f.
$ ../source-builder/sb-set-builder \
--log=autotools-log.txt \
--prefix=$HOME/development/rtems/compiler/4.11 \
4.11/rtems-autotools
I think that I can skip this point if another build is present.
Is true???
g.
$ cd $HOME
and set the path with a persistent environment system variable.
I think that I can skip this point if another build is present.
Is true???
h.
after logout & login I will find i386-rtems4.11-gcc ???
then I can move to the next step….
Yes, it should work as you describe. The same PATH will work for any number of RTEMS architecture toolchains. I often have m68k, sparc, and arm on one system.
DeleteWhile I'm tryng to port to powerpc G3 lombard I read that there is the
ReplyDeleteGDB ARM Simulator -- gdbarmsim support.
You think that including this in the building of gdb I can debugg into RaspPi & into MacOS ??
Step 3 in the instructions is missing the following as the first line:
ReplyDelete$ cd $HOME/development/rtems/rtems-source-builder/rtems
Updated.. Thanks!
DeleteHi,
ReplyDeleteI see that this blog is about rtems-raspberry, but a have an issue with arm-rtems same arhitecture .
I am trying to build the rtems for arm and I have an issue on the asm part in file armv7m-context-restore.c in function:
void __attribute__((naked)) _CPU_Context_restore(
Context_Control *heir
the error is : rtems_stm32f4/cpukit/score/cpu/arm/armv7m-context-restore.c:29:3: error: impossible constraint in ‘asm’
I'm using gcc-4.8.0-rtems4.11-20130502
Has someone a good idea how to solve this ?
I'm using gcc-4.8.0-rtems4.11-20130502
Have someone a good idea how to solve this ?
Hi, I'm not quite sure how to solve this one..
DeleteA couple of days ago, I installed arm-rtems4.11 4.8.1 20130531 ( for windows ) and compiled the latest rtems git head for the raspberry pi.
I have not tried building a armv7 target for RTEMS. I suspect you might need a more recent GCC/newlib combination.
I would try posting the question on the RTEMS users mailing list, or perhaps asking on the RTEMS IRC.
http://rtems.org/wiki/index.php/RTEMSMailingLists
http://www.rtems.org/wiki/index.php/RTEMS_IRC
hope this helps,
Alan
New to git, and the operation generated the following:
ReplyDelete~/development/rtems> git clone git://git.rtems.org/chrisj/rtems-source-builder.git
Cloning into 'rtems-source-builder'...
fatal: remote error: access denied or repository not exported: /chrisj/rtems-source-builder.git
Thanks!
Sorry, the directions are getting old. I really need to update.
DeleteTry:
git clone git://git.rtems.org/rtems-source-builder.git
When you build the tools using RSB, make sure you substitute 4.12 for 4.11 in my instructions. The RTEMS git repository defaults to RTEMS 4.12 now and you need to build the 4.12 tools to make RTEMS compile correctly. I recently did this and tested it on my Raspberry Pi ( Model A+ and Zero )
Same applies to building RTEMS itself, substitute 4.11 with 4.12 like this:
../rtems-git/configure --target=arm-rtems4.12 \
--enable-rtemsbsp="raspberrypi2 raspberrypi" \
--enable-tests=samples \
--enable-networking \
--enable-posix \
--prefix=$HOME/rtems/4.12
I'm going to try to work on updating all of the instructions soon.
hello sir
ReplyDeletehttp://www.rtems.org/ftp/pub/rtems/people/chrisj/source-builder/source-builder.html
The above link to the source builder documentation you provided is not working.It would be great help if u provide the source builder documentation link.
Hi,
DeleteSorry my instructions are out of date. The new RTEMS master is now called 5 instead of 4.12, and here is the link to the RSB docs:
https://docs.rtems.org/branches/master/rsb/index.html
Also, note that the latest Raspberry Pi firmware on the SD card is not compatible with RTEMS. I had to use a tag of the RPI firmware that is about 1 year old. I'll try to dig up the exact tag, but you can try this one:
https://github.com/raspberrypi/firmware/tree/1.20160523/boot
hello sir,
ReplyDeleteI am new to rtems RTOS but very much interested in learning about rtems and how to port it onto raspberry pi board. If you could guide me with steps for building a rtems kernel image for pi board, it would be a great help for me.
Thank you
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteSorry I missed your question. I had been meaning to get back to you. The best way to build for windows is to follow the latest guide:
Deletehttps://docs.rtems.org/branches/master/user/index.html
They have Windows specific info here:
https://docs.rtems.org/branches/master/user/hosts/windows.html
But I have just been trying Windows Subsystem For Linux 2 (WSL2) on Windows 10 and other than fixing the PATH environment variable, it builds the RTEMS tools just like Ubuntu.
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete