beaglebone black, rtems,

Getting started with RTEMS on Beaglebone black - part II

Vijay K. Banerjee (thelunatic) Vijay K. Banerjee (thelunatic) May 10, 2019 · 3 mins read
Getting started with RTEMS on Beaglebone black - part II
Share this

In the part I of this Getting started walkthrough, we have seen the steps of building the rtems source for the beagleboneblack Board Support Package (BSP). In this part we’ll use the hello.exe from the testsuite, make it into an SD card image and run it in original BBB hardware.

Using U-Boot

Firstly, we’ll need u-boot to boot the image into the hardware. We’ll be using a recent version of U-Boot for the process. We need to use the mkimage from u-boot to create the bootable image.

Once we have the hello.exe from beagleboneblack/arm-rtems5/c/beagleboneblack/testsuite/samples/hello.exe

we’ll make an image from it in the following steps.

arm-rtems5-objcopy hello.exe -O binary app.bin
gzip -9 app.bin
mkimage -A arm -O linux -T kernel -a 0x80000000 -e 0x80000000 -n RTEMS
-d app.bin.gz rtems-app.img

The options are for :

  • -A : Architecture
  • -O : OS
  • -T : Type of image
  • -a : load address
  • -e : entry point
  • -n : image name
  • -d : The image data file and finally the rtems-app.img is the name of the image

The uEnv.txt file

After this we can copy this img file to the Fat formatted SD card and include a uEnv.txt in the root directory with the following content

setenv bootdelay 5
uenvcmd=run boot
boot=fatload mmc 0 0x80800000 rtems-app.img ; fatload mmc 0 0x88000000
am335x-boneblack.dtb ; bootm 0x80800000 - 0x88000000

The uEnv.txt file sets any variable BEFORE the image boots, so this is the right place to tell the bootloader which files to load and the memory addr of the boot image.

The Device Tree file

It is now compulsory to use a device tree blob (dtb) file to load the device tree during bootin. So we need the am335x-boneblack.dtb file. The simplest way is to get it from the linux sources.

We’ll use a mirror to the official device-tree rebasing. We can use this link device-tree-rebasing there’s a makefile provided, we’ll just build the am335x-boneblack.dtb the command will look something like this

make src/arm/am335x-boneblack.dtb

Once we have the dtb file, we’ll again copy it into the root of the SD card that we have.

Running it in BBB

Now that we have everything set, our final step is to run it in a REAl hardware. I’m using a USB TO UART TTL 3.3V FT232RL breakout board to connect it to my computer. This, I found was the cheapest option available, you just need a few jumber cables and it’s as good as an FTDI adapter cable.

Then we’ll install the SD card and power up everything. To access the console from computer, we’ll use screen tool for linux environment like this …

sudo screen /dev/ttyUSB0 115200

Running RTEMS hello world on BBB

And Voila! It’s running !!!

That’s the end of the Getting started tutorial, I hope that I have stated the steps clearly. In case of any doubt, or if you’d like to add or discuss some point. Please do comment below.

Thanks for stopping by!