RTEMS GSoC 2020 Final Report: BSP Buildset for EPICS

What an amazing summer — filled with a lot of moments to cherish — whether those buggy nights or those silly beginner mistakes(that I still make :p) – is coming to an end but of course with the promise of a new beginning :-)

Image for post
Image for post
Image for post
Image for post
GSoC 2020 with RTEMS

Project Overview:

The development of the freely available, open-source, RTEMS, solved one of the biggest obstacles that beamline researchers used to face in buying commercial Real-Time operating systems that used EPICS base software.

However, with both EPICS and RTEMS gearing up for their latest stable releases, i.e, EPICS7 and RTEMS5 respectively, they should be made fully compatible to ensure continuous support in the newer versions.

This project aims to solve this problem and create a vertically integrated BSP Build Set which will be able to create a bootable BSP image with EPICS7+RTEMS 5 that can run in a simulator. RTEMS provides RTEMS Source Builder which is a tool to build packages from source and adding packages like EPICS to the RSB as libraries is called vertical integration. This project will create build sets that stack library dependencies vertically to create a stack. The main goals of this project are to make progress for some low-barrier simulation approaches like qemu/i386, qemu/xilinx_zynq and powerpc/psim used by EPICS community and then later on move to real hardware systems.


  • Chris Johns

Project Objectives:

  1. Building qemu/xilinx_zynq by hand for EPICS7+RTEMS5

Summary of the work :

The entire span of work was divided into three phases. Let’s discuss each one of them.

Phase 1:

The first phase started with a minor change in goal for Phase 1. Working upon the advice of Heinz, I, initially started with adding PTP support to RTEMS RSB. The purpose behind this was to add libbsd network stack support to EPICS instead of the old legacy stack.

To do so, I made the following changes in code:

  1. Written .cfg and .bset files for ptp daemon in rtems/rsb

It was later suggested that we should try the intitally decided path of building the EPICS package for RTEMS by hand and then move on to making RSB recipes. This laid the foundation of things to be done in Phase 2.

Phase 2:

The first step to vertically integrate any third-party package in RTEMS RSB begins by building that package by hand (manually). This made me work to build EPICS7 for RTEMS4.10 for pc386 BSP by hand. We deliberately chose initially RTEMS4.10 as it was stable with the upstream branch of EPICS.

After learning this process for RTEMS4.10, I tried to build it for RTEMS5. Few bugs were encountered and fixed and the build of EPICS7 for RTEMS5 with pc386 BSP was successful.

The entire process is documented in these two blogs:

The next task was to use this documentation to write RSB recipes which will work towards vertical integration of EPICS7.

I worked out on it and eventually, this is how they came out in the form of code commits:

  • The first commit for RSB recipes that were not able to cd inside the directory of EPICS package installed.

As the second phase was about to end, I had to take a little break to take part in the Grand Finale of Smart India Hackathon -2020 (August 1st-August 4th), in which my team became a Winner.

The next steps for Phase 3 were very clear — to find out the alternative of using Patches and making the process of selecting the RTEMS_BASE and CROSS_COMPILER_TARGET_ARCHS dynamic for EPICS.

Phase 3:

In order to implement the goals set by the end of Phase 2, we decided to go with ‘xilinx_zynq_a9_qemu’ BSP instead of pc386 BSP.

The initial steps were almost the same as in Phase 2 of building the BSP by hand. However, this time we used libbsd instead old legacy network stack and so configuration has --disable-networking option and I followed this blog of a previous GSoC to build libbsd network stack for ‘xilinx_zynq_a9_qemu’ BSP.

What followed next was a series of commits in the process to build the RSB recipe that can be merged:

  • The initial recipe commit that used the earlier inefficient patch method.
Image for post
Image for post
RTEMS RSB using sedpy.
  • However, we found out that in EPICS base we can use of make utility to play with the variables and so I did the same in this commit
../source-builder/sb-builder --with-rtems-bsp="xilinx_zynq_a9_qemu" --log=log_epics epics/epics-base  --trace --prefix=$HOME/development/rtems/5-arm --host=arm-rtems5
Image for post
Image for post
EPICS Building Successfully using RTEMS RSB.

Links to all my commits and patches:

Future Scope:

  • Though the Build is working fine with sb-builder , however, RSB recipe need improvements to make it completely compatible with sb-set-builder .

Completing these future goals will be a major part of my post GSoC involvement. At the same time, I will try to improve the documentation and introduce more and more people to RTEMS and EPICS community to help both these projects grow further.

I will also express my gratitude and thanks to all my mentors and other members of both RTEMS and EPICS community for their regular support and feedback. It could have never been possible without them✨

It was a summer full of learning and fun with code that I will cherish forever 😃

Written by

GSoC ’20@RTEMS, Learner, Poet.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store