博文

目前显示的是 五月, 2017的博文

Developed the I2C driver for Beaglebone Black BSP

图片
My first part of GSOC project is finish the I2C driver left by GSOC 2016 student Punit Vara.
I reference the U-Boot and FreeBSD i2c code for develop.

1. We need register the i2c bus:

a) i2c_bus *i2c_bus_alloc_and_init(size_t size)

this function is use for alloc and init a new i2c bus.

i2c_bus *i2c_bus_alloc_and_init(size_t size)
{
  i2c_bus *bus = NULL;

  if (size >= sizeof(*bus)) {
    bus = calloc(1, size);
    if (bus != NULL) {
      int rv;

      rv = i2c_bus_do_init(bus, i2c_bus_destroy_and_free);
      if (rv != 0) {
        return NULL;
      }
    }
  }

  return bus;
}

b) configure the I2C clock and pinimux
there two pin we need to configure:
static void am335x_i2c0_pinmux(bbb_i2c_bus *bus) {   REG(bus->regs + AM335X_CONF_I2C0_SDA) =   (BBB_RXACTIVE | BBB_SLEWCTRL | BBB_PU_EN);
  REG(bus->regs + AM335X_CONF_I2C0_SCL) =   (BBB_RXACTIVE | BBB_SLEWCTRL | BBB_PU_EN); }
the pin we need configure to be pull and rx enable

c) install the i2c interrupt handle

rtems_status_code…

How to generate image file and dd to SD card

图片
We use the sdcard.sh shellScript to build a image file, which is contain in the RTEMS source code.
The file is at   rtems-src/c/src/lib/libbsp/arm/beagle/simscripts

sdcard.sh
# we store all generated files here.TMPDIR=tmp_sdcard_dir.$$  FATIMG=$TMPDIR/bbxm_boot_fat.img  SIZE=65536  OFFSET=2048  FATSIZE=`expr $SIZE - $OFFSET`  UENV=uEnv.txt  rm -rf $TMPDIR  mkdir -p $TMPDIR  if [ $# -ne 2 ]  then    echo "Usage: $0 <RTEMS prefix> <RTEMS executable>"    exit 1  fi  PREFIX=$1

Compiling RTEMS for Beaglebone Black BSP

图片
1. Setting the PATH

cd $HOME/development/rtems
export PATH=$HOME/development/rtems/4.12/bin:$PATH

the path is the RTEMS toolchain

2.Git RTEMS source code

git clone git://git.rtems.org/rtems rtems-src

3.Configure the source code

cd rtems-s
./bootstrap; ./bootstrap -prc

4.Compiling the code


cd ..  

mkdir build ;mkdir image;cd build

../rtems-src/configure --target=arm-rtems4.12 --enable-rtemsbsp=beagleboneblack  --prefix=........./image

//the --prefix is use for store the compiled mirror elf file, we choose the image folder

//then
make

make install

then the Success tips are as follows:



you can see the image folder contain these file as follow:

Building RTEMS4.11 toolchain on Ubuntu16.04

图片
1.Make a new installation directory, such as $ HOME / development / rtems /

mkdir -p development/rtems/sources
cd development/rtems/sources

Then in this directory using Git to get RSB source package
git clone -b 4.11 https://github.com/rtems/rtems-source-builder.git

2. then carry out environmental testing, type the following command:

./rtems-source-builder/source-builder/sb-check 
If the prompt indicates that an application is not installed, you can manually install the install apt-get
for example: 

sudo apt-get install makeinfo
After check, you will get the follow hint:

RTEMS Source Builder - Check, v0.3.0 Environment is ok
3.Start installing toolchain
cd rtems-source-builder/rtems ../source-builder/sb-set-builder --log=beagle.txt --prefix=$HOME/development/rtems/4.11 4.11/rtems-arm.bset
you may get some error:



Reason is the following package needs to be installed:

sudo apt-get build-dep binutils gcc g++ gdb unzip git python2.7-dev

And you may build failed again, because your current…

Project Introduction

This summer, i will working for RTEMS.
My project name is Beagleboard BSP projects: Improvement of I2C, USB and wireless BSP for Beaglebone Black.

Project Abstract:
  This project aims to improve the Beaglebone Black BSP support on RTEMS. Project intends
to add the following supports to the Beaglebone Black BSP: I2C support, USB device
support, Wireless network card support, USB dongle support. The wireless network support
make the RTEMS can apply on many application scenarios such as the four rotor unmanned
aerial vehicle. makes RTEMS more attractive for the user community.

Project Description:
  RTEMS is a open source embedded hard real-time operating system, It good at real-time,
stability, development speed and multi-processor support. And compare with VxWorks,
open source is the advantage of RTEMS. Now RTEMS is already working on Beaglebone
Black, As so far, the ADC, PWM, GPIO is supported on BBB, But the BSP support is not
enough, The users have limited capabilities available for …