MicroZed Chronicles: Get RTEMS Up and Running on the Ultra96!

How to build the RTEMS toolchain and Kernel before creating a BSP for the Ultra96 and running on the U96.

Adam Taylor
4 years agoRobotics / Security / Automotive / Drones / FPGAs

Many of our MicroBlaze, Zynq and Zynq MPSoC applications are deployed in applications which require real time operation. Indeed many of these require hard real time capabilities where a failure to meet a deadline is seen as a failure of the system.

On popular real time operating system which is used on many aerospace, defense and space applications is RTEMS or Real Time Executive for Multiprocessor Systems.

RTEMS was originally developed in the 1980's as the Real Time Executive for Missile Systems and has been ported to many architectures including ARM, MIPS, MicroBlaze, PowerPC and of course SPARC.

For our Xilinx devices RTEMS is supported on the Zynq, Microblaze and more recently the ZynqMP thanks to DornerWorks recent porting.

In this blog we are going to look at how we can set up the RTEMS build tools and kernel such that we can begin to develop applications for out Zynq and ZynqMP devices.

To do this we will need a Linux machine, I am using a Ubuntu virtual machine and the process may take a little while.

Installing RTEMS is a little bit of a pain and the documentation is not to clear however the steps we need to take are

  • Install the tool chain - RTEMS Source Builder
  • Install and Bootstrap the kernel
  • Compile the BSP for the target board

To get started we are going to first create a directory strucutre called

$home/development/rtems

Into this directory we are going to clone the RTEMS Source Builder using the command

git clone git://git.rtems.org/rtems-source-builder.git rsb

This will clone the RTEMS source builder under

$home/development/rtems/rsb

Once it is installed we can cd into the RSB directory and check the environment by issuing the command.

./source-builder/sb-check

Knowing the build environment is OK we can build the course by changing directory into the rtems directory and running the sb-builder.

When we do this we need to give it a prefix this where the binaries etc will be installed. If you have root access then /opt/rtems/5 is a commonly used location. However, if you do not have root access anywhere is fine I decided to use

$home/rtems/5

When we run the source builder we also need to state which of the tool chains this is required for. As we are targeting a Arm processor the correct selection is 5/rtems-arm

../source-builder/sb-set-builder --prefix=/home/training/rtems/5 5/rtems-arm

This will take a little while to build, in my case it took about an hour.

Once this has built the tool chain we desire the next step is to update the path with the location of our new tool chain.

export PATH=/home/training/rtems/5/bin:$PATH

The next step is to install the kernel, this is very simple. Navigate back to $home/development/rtems and create a new directory called kernel then enter the newly created kernel directory

cd ~
cd development/rtems
mkdir kernel
cd kernel

In to this library we will clone the source of the RTEMS Kernel

git clone git://git.rtems.org/rtems.git rtems

Once successfully cloned we can then bootstrap the kernel

./bootstrap -c && /home/training/development/rtems/rsb/source-builder/sb-bootstrap

Bootstrapping may take several minutes.

Once bootstrapping is completed if you look under the kernel/rtems/c/src/lib/libbsp/arm directory you will see the Zynq and Zynq MPSoC BSPs which are available for our use.

Currently there are BSPs for Xilinx boards

  • Zynq QEMU
  • ZC702 Development board
  • ZC706 Development Board
  • ZedBoard Development Board
  • Ultra96 Development Board

Now we have the tool chain, the kernel and BSPs we need to configure and build a BSP so we can actually use it on the Ultra96.

To do this in the kernel directory we need to create a new directory to contain our BSP, I called mine xilinx_zynqmp_ultra96

We can then enter this directory and run the command

/home/training/development/rtems/kernel/rtems/configure --prefix=/home/training/rtems/5 --target=arm-rtems5 --enable-rtemsbsp=xilinx_zynqmp_ultra96 --enable-posix --disable-networking

Notice the prefix is the installation path of the tools we built using the RTEMS Source Builder and the target is the arm-rtems5 finally I have selected the BSP for the Ultra96.

Once the BSP has been configured we can make the BSP using the make command.

Once the BSP is generated if you look under it arm-rtems5 directory you will see several example applications under the directory

$home/development/rtems/kernel/xilinx_zynqmp_ultra96/arm-rtems5/c/xilinx_zynqmp_ultra96/testsuites/samples

Under here you will also see several elf files ready for execution on the target.

The final step is to install the BSP with the tool chain we can do this using the command

make install

Once this has been completed you will see the BSP we just created for the Ultra96 under the prefix directory where we installed the tools using the RTEMS System Builder.

We are now ready to begin application development for our Ultra96!

See My FPGA / SoC Projects: Adam Taylor on Hackster.io

Get the Code: ATaylorCEngFIET (Adam Taylor)

Access the MicroZed Chronicles Archives with over 300 articles on the FPGA / Zynq / Zynq MpSoC updated weekly at MicroZed Chronicles.

Adam Taylor
Adam Taylor is an expert in design and development of embedded systems and FPGA’s for several end applications (Space, Defense, Automotive)
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles