How to build the RTEMS cross tools
Configure directories
The installation base directory is given on the command line and RTEMS cross tools as a default will be installed in directory “crosstools/RTEMSVERSION” below this.
You may change the directories with entries in file CONFIG.COMMON.
Configure build options
Make options and the usage of “nice” (so compiling will run with low priority on your system) is also configured in CONFIG.COMMON.
Set the RTEMS version
You provide the RTEMS version by providing the matching file “CONFIG-RTEMS-NN” on the command line.
“NN” is the RTEMS version to be built.
Set the RTEMS architecture
There are many supported architectures. Currently tested is:
rtems-powerpc
The architecture is specified in variable RTEMS_ARCH in file CONFIG.COMMON.
Build the cross tools
Just enter:
bin/build-crosstools.sh CONFIGFILE
where CONFIGFILE is the file “CONFIG-RTEMS-NN” that specifies the RTEMS version.
Troubleshooting
If building the cross tools fails, the RTEMS_source_builder usually prints the name of it’s log file. Open the log file and see what the problem is like this:
less $(find . -name LOGFILE)
When you try fixing the problem restart the source builder manually, here this is shown for RTEMS 4.9:
source CONFIG.SITE
source CONFIG-RTEMS-4.9
PATH=$INSTALLTOP/python2/bin:$PATH
export LD_LIBRARY_PATH=$INSTALLTOP/python2/lib:$LD_LIBRARY_PATH
cd src/crosstools/$RTEMS_RFS_VERSION/rtems-source-builder/rtems
rm -rf sources build
nice ../source-builder/sb-set-builder --prefix=/$INSTALLTOP/crosstools/$RTEMS_RFS_VERSION $RTEMS_VERSION/$RTEMS_ARCH
In most cases you need to install an additional package on your system.
After fixing this problem re-run the build process with:
bin/build-crosstools.sh CONFIGFILE
When the program complains that the installation directory already exists and asks if it should be removed, answer “y”.
When the program complains that the source directory (“../src/..”) already exists, you may:
remove it for a clean start by entering “r”
re-use it, which is faster, by entering “k”
How to use a specific version of the cross tools
If you want to use the cross tools in your applications, source file setenv.sh which is placed in directory $RTEMS_CROSS_INSTALL_DIR as it is defined in file CONFIG.COMMON.
If for example, you defined INSTALLTOP <setup> as ‘/usr/local/rtems’, didn’t change RTEMS_CROSS_INSTALL_DIR in file CONFIG.COMMON and built the cross tools for RTEMS 5, the command would be:
. /usr/local/rtems/crosstools/5/setenv.sh
This redefines the PATH variable that the cross compiler and tools are found.
How to use the cross tools in rtems-build-tool
rtems-build-tool is the project that is used to build the RTEMS kernel and RTEMS libraries.
When you want to use the cross compiler tools in this project you need to set the environment variable ‘RTEMS_SITE_CROSSTOOLS’ to the location of the ‘crosstools’ directory which is placed just at your install directory.
If for example, you defined INSTALLTOP <setup> as ‘/usr/local/rtems’ and didn’t change RTEMS_CROSS_INSTALL_DIR in file CONFIG.COMMON and built the cross tools, RTEMS_SITE_CROSSTOOLS would be set like this:
RTEMS_SITE_CROSSTOOLS=/usr/local/rtems/crosstools
This setting would be the same and work for all RTEMS versions since they are all installed in version specific directories below this path.