|
|
|
# RTEMSBuild
|
|
|
|
|
|
|
|
To be able to build RTEMS applications, you need to build a
|
|
|
|
cross-development toolchain as well as RTEMS itself. Other tools might
|
|
|
|
also be useful, especially for debugging purposes. Hopefully, we provide
|
|
|
|
scripts that automate the installation of both cross-development
|
|
|
|
toolchain and RTEMS itself. The following tools would be installed:
|
|
|
|
automake/autoconf (configuration tools), binutils and GCC with newlib
|
|
|
|
(compiler), GDB (for debugging).
|
|
|
|
|
|
|
|
The following sections provide guidance to build everything and use
|
|
|
|
RTEMS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div id="toc" class="toc">
|
|
|
|
|
|
|
|
<div id="toctitle" class="toctitle">
|
|
|
|
|
|
|
|
## Contents
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
- [<span class="tocnumber">1</span> <span class="toctext">Getting our
|
|
|
|
scripts</span>](#getting_our_scripts)
|
|
|
|
- [<span class="tocnumber">2</span> <span class="toctext">Configuring
|
|
|
|
your environment</span>](#configuring_your_environment)
|
|
|
|
- [<span class="tocnumber">3</span> <span class="toctext">Building the
|
|
|
|
toolchain</span>](#building_the_toolchain)
|
|
|
|
- [<span class="tocnumber">4</span> <span class="toctext">Example:
|
|
|
|
build RTEMS 4.11 for the i386
|
|
|
|
target</span>](#example:_build_RTEMS_4.11_for_the_i386_target)
|
|
|
|
- [<span class="tocnumber">5</span> <span class="toctext">Testing your
|
|
|
|
installation</span>](#testing_your_installation)
|
|
|
|
- [<span class="tocnumber">6</span> <span class="toctext">Other
|
|
|
|
resources</span>](#other_resources)
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
# <span id="Getting_our_scripts" class="mw-headline">Getting our scripts</span>
|
|
|
|
|
|
|
|
You can get the scripts on our current subversion repository at the
|
|
|
|
following address :
|
|
|
|
<https://tecsw.estec.esa.int/svn/taste/trunk/misc/rtems-scripts>
|
|
|
|
|
|
|
|
To checkout the scripts, issue the following command
|
|
|
|
|
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr">
|
|
|
|
|
|
|
|
svn co https://tecsw.estec.esa.int/svn/taste/trunk/misc/rtems-scripts
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
The README file in the repository is a good start to get information
|
|
|
|
about the build process.
|
|
|
|
|
|
|
|
# <span id="Configuring_your_environment" class="mw-headline">Configuring your environment</span>
|
|
|
|
|
|
|
|
Then, edit the env file related to your environment. Change the
|
|
|
|
following variables in the file: - **BUILD\_DIR** - **INSTALL\_DIR** -
|
|
|
|
**INSTALL\_DIR** - **ARCH** - **BUILD\_ARCH** - **BUILD\_BSP** -
|
|
|
|
**USE\_BSP**
|
|
|
|
|
|
|
|
Once it is done, source the files in your environment to define the
|
|
|
|
variables. You have to do that for each shell that will use your
|
|
|
|
cross-compilation toolchain later.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# <span id="Building_the_toolchain" class="mw-headline">Building the toolchain</span>
|
|
|
|
|
|
|
|
Then, you have to invoke the scripts in the following order:
|
|
|
|
|
|
|
|
- fetch\_rtems\_source.sh
|
|
|
|
- build\_autoconf.sh
|
|
|
|
- build\_automake.sh
|
|
|
|
- build\_binutils\_rtems.sh
|
|
|
|
- build\_gmp.sh
|
|
|
|
- build\_mpfr.sh
|
|
|
|
- build\_mpc.sh
|
|
|
|
- build\_gcc\_native.sh
|
|
|
|
- build\_gcc\_rtems\_c\_only.sh
|
|
|
|
- build\_rtems.sh
|
|
|
|
- build\_gcc\_rtems.sh
|
|
|
|
- build\_gdb.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# <span id="Example:_build_RTEMS_4.11_for_the_i386_target" class="mw-headline">Example: build RTEMS 4.11 for the i386 target</span>
|
|
|
|
|
|
|
|
1. Edit the rtems\_4.11.env file and change the **INSTALL\_DIR** and
|
|
|
|
**BUILD\_DIR** variables to match your system configuration
|
|
|
|
2. Edit the rtems\_4.11.env file and set the variable values:
|
|
|
|
ARCH="i386" ; BUILD\_BSP="pc386" ; USE\_BSP="pc386" ;
|
|
|
|
BUILD\_ARCH=i386
|
|
|
|
3. Source the file
|
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr">
|
|
|
|
source rtems_4.11.env
|
|
|
|
</div>
|
|
|
|
4. Make a checkout of the current RTEMS revision in
|
|
|
|
**BUILD\_DIR**/rtems-4.11/rtems:
|
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr">
|
|
|
|
cd $BUILD_DIR/rtems-$RTEMS_VERSION/ && git clone http://git.rtems.org/rtems rtems
|
|
|
|
</div>
|
|
|
|
5. Invoke the scripts
|
|
|
|
|
|
|
|
Finally, you should have the directory **INSTALL\_DIR** with the
|
|
|
|
toolchain. You should at least have a file called
|
|
|
|
**$INSTALL\_DIR/i386-rtems4.11/pc386/Makefile.inc**.
|
|
|
|
|
|
|
|
To use RTEMS, you should first set the RTEMS\_MAKEFILE\_PATH to
|
|
|
|
**$INSTALL\_DIR/i386-rtems4.11/pc386/Makefile.inc**. You can do that
|
|
|
|
using the following command :
|
|
|
|
|
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr">
|
|
|
|
|
|
|
|
export RTEMS_MAKEFILE_PATH=$INSTALL_DIR/i386-rtems4.11/pc386/Makefile.inc
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# <span id="Testing_your_installation" class="mw-headline">Testing your installation</span>
|
|
|
|
|
|
|
|
You can test your installation by compiling a small example from the
|
|
|
|
RTEMS tests. To do so, please perform the following procedure:
|
|
|
|
|
|
|
|
1. Checkout RTEMS examples from RTEMS repository
|
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr">
|
|
|
|
git clone http://git.rtems.org/examples-v2 examples
|
|
|
|
</div>
|
|
|
|
2. Make sure the RTEMS\_MAKEFILE\_PATH variable is defined. For
|
|
|
|
example, for the pc386 BSP, this can be set by performing the
|
|
|
|
following command:
|
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr">
|
|
|
|
export RTEMS_MAKEFILE_PATH=$INSTALL_DIR/i386-rtems4.11/pc386/Makefile.inc
|
|
|
|
</div>
|
|
|
|
3. Go to the **hello/hello\_world\_c** directory and invoke make. If
|
|
|
|
successful, the build process would produce an o-optimize directory
|
|
|
|
with files called **hello.exe and** **hello.bin**. This corresponds
|
|
|
|
to the complete application code with RTEMS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr">
|
|
|
|
|
|
|
|
[julien@minerva]/home/julien/tmp/examples/hello/hello_world_c#make 20:49:36
|
|
|
|
test -d o-optimize || mkdir o-optimize
|
|
|
|
i386-rtems4.11-gcc --pipe -B/home/julien/local/packages/rtems-4.11/i386-rtems4.11/pc386/lib/ -specs bsp_specs -qrtems -g -Wall -O2 -g -g -mtune=i386 -c -o o-optimize/test.o test.c
|
|
|
|
i386-rtems4.11-gcc --pipe -B/home/julien/local/packages/rtems-4.11/i386-rtems4.11/pc386/lib/ -specs bsp_specs -qrtems -g -Wall -O2 -g -g -mtune=i386 -Wl,-Ttext,0x00100000 -mtune=i386 -o o-optimize/hello.exe o-optimize/test.o
|
|
|
|
i386-rtems4.11-nm -g -n o-optimize/hello.exe > o-optimize/hello.num
|
|
|
|
i386-rtems4.11-size o-optimize/hello.exe
|
|
|
|
text data bss dec hex filename
|
|
|
|
182341 10288 10692 203321 31a39 o-optimize/hello.exe
|
|
|
|
i386-rtems4.11-objcopy -O elf32-i386 --remove-section=.comment --remove-section=.note --strip-unneeded o-optimize/hello.exe o-optimize/hello.nxe
|
|
|
|
i386-rtems4.11-objcopy -O binary o-optimize/hello.nxe o-optimize/hello.bin
|
|
|
|
/home/julien/local/packages/rtems-4.11/i386-rtems4.11/pc386/build-tools/bin2boot -v o-optimize/hello.ralf 0x00097E00 /home/julien/local/packages/rtems-4.11/i386-rtems4.11/pc386/lib/start16.bin 0x00097C00 0 o-optimize/hello.bin 0x00100000 0
|
|
|
|
header address 0x00097e00, its memory size 0x00000200
|
|
|
|
first image address 0x00097c00, its memory size 0x00000200
|
|
|
|
second image address 0x00100000, its memory size 0x00030200
|
|
|
|
rm -f o-optimize/hello.nxe
|
|
|
|
[julien@minerva]/home/julien/tmp/examples/hello/hello_world_c
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# <span id="Other_resources" class="mw-headline">Other resources</span>
|
|
|
|
|
|
|
|
- RTEMS git repository: <http://git.rtems.org>
|
|
|
|
- RTEMS documentation for building the cross-development toolchain:
|
|
|
|
<http://rtems.com/onlinedocs/releases/rtemsdocs-4.10.2/share/rtems/html/started/started00030.html>
|
|
|
|
- RTEMS isntructions build:
|
|
|
|
<http://rtems.com/onlinedocs/releases/rtemsdocs-4.10.2/share/rtems/html/started/started00024.html> |