Hardware, RTEMS, RTOS, Software

Building and testing RTEMS-libbsd for BeagleBone Black BSP

————————————————————————
Building and testing libbsd for BeagleBone Black BSP
————————————————————————

== Installation overview ==

=== Initial setup ===

– Jump into your workspace and make a directory named sandbox
This folder will contain all our project files
– cd sandbox/
– export sandbox=$PWD
– git clone git://git.rtems.org/rtems-source-builder.git
– git clone git://git.rtems.org/rtems.git
– git clone git://git.rtems.org/rtems-libbsd.git

=== Building desired toolset for ARM ===

– cd rtems-source-builder/rtems/
– ../source-builder/sb-check
– ../source-builder/sb-set-builder –prefix=$sandbox/5 5/rtems-arm
– cd $sandbox
– export PATH=$PWD/5/bin:$PATH

After having required toolchain, we can now proceed towards building our Board Support Package(BSP)

=== Building Beagleboneblack BSP ===

– cd $sandbox
– mkdir beagleboneblack
– cd rtems
– ./bootstrap -c &&  ./bootstrap
– ../rtems-source-builder/source-builder/sb-bootstrap
– cd ..
– cd beagleboneblack/
– ../rtems/configure –prefix=$sandbox/5 –target=arm-rtems5 –disable-networking –enable-      rtemsbsp=beagleboneblack
– make
– make install
– cd $sandbox

BeagleBone black  BSP is now ready, and we should start building libbsd now

=== Building libbsd ===

Before moving forward, we have to install waf(https://waf.io/)

– cd $sandbox
– curl -o waf https://waf.io/waf-2.0.6
– chmod +x waf

Adding it to path,

– export PATH=$PWD:$PATH

Verify installment by,

– waf –version

Now, let’s start by configuring and initializing libbsd module

– git submodule init
– git submodule update rtems_waf
– waf configure –prefix=”$sandbox/5″ –rtems-bsps=arm/beagleboneblack
– waf
– waf install

Libbsd installation is done, now we can move on to testing and building test suite examples

== Testing and Building Examples ==

Default libbsd test examples can be found under $sandbox/rtems-libbsd/build/arm-rtems5-beagleboneblack/

=== Building selectpollkqueue01 example ===

By now, under the example directory ( $sandbox/rtems-libbsd/build/arm-rtems5-beagleboneblack/ )
you can find selectpollkqueue01.exe file. We need to convert this file to its image file
i.e. selectpollkqueue01.img. There are several ways to do that, few of them are:

1)  Direct method: Here, binary of the executable is directly converted into its image file via mkimage tool.
STEPS:
# arm-rtems4.11-objcopy selectpollkqueue01.exe -O binary selectpollkqueue01.bin
# gzip -9 selectpollkqueue01.bin
# mkimage -A arm -O rtems -T kernel -a 0x80000000 -e 0x80000000 -n RTEMS -d selectpollkqueue01.bin.gz selectpollkqueue01.img

Here, selectpoolkqueue01.img is the image file, that need to be loaded via uboot.
Please note that this method is depreciated as it doesn’t incorporate bootloader and Device tree. So, for
loading it, one has to interrupt uboot’s(Which is already present in the EMMC) default setup and then load
the image file via fatload command (for this to work, you should have image in sd card with filesystem type as FAT) for example:

# fatload mmc :0 0x80800000 selectpollkqueue01.img
# bootm 0x80800000

2)  Via automated script: create-sdcardimage.sh script file takes the executable file as input and outputs the image file
after including uboot along with device tree. This method will be elaborated with next example.

=== Building media01 example ===

Note:- This example requires FDT! Missing FDT may give RTEMS_FATAL_SOURCE_EXCEPTION, while invalid/empty FDT will simply give a error and warnings while executing the test like:

err: no valid interfaces found

warning: no interfaces have a carrier

One way to provide FDT, is to pass it as a parameter to uboot during booting up, for example:

fatload mmc 0 0x80800000 rtems-app.img
fatload mmc 0 0x88000000 am335x-boneblack.dtb
bootm 0x80800000 – 0x88000000

Other easy way is to simply use this script: https://gitlab.com/c-mauderer/rtems-bbb/blob/master/build/create-sdcardimage.sh, 

 

Tagged , , , ,

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.