Posts

Featured posts

Building FreeBSD for BeagleBone Black

What you’ll need:
• BeagleBone Black.
• 5v power supply or Mini-USB cable.
• Micro-SDHC card 4GB or larger.
• FTDI cable

Steps:
1) Download current FreeBSD image for BBB to working directory

wget ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv7/ISO-IMAGES/12.0/FreeBSD-12.0-CURRENT-arm-armv7-BEAGLEBONE-20180215-r329338.img.xz

2) Uncompress the img.xz file and burn it to the sd card
xzcat FreeBSD-12.0-CURRENT-arm-armv7-BEAGLEBONE-20180215-r329338.img.xz | dd of=/dev/sdb

Note that you might need admin rights for above command. Also, verify that your sd card is at /dev/sdb change it if it's other then sdb. In caes of unavailability of xzcat command, just install it by installing xz utils.

GSoC Project Introduction : Importing SDIO stack and Benchmarking

Hi all, This post is basically an introduction of my GSoC 2018 project under RTEMS. It marks the beginning of a series of blog posts that will be put on ( under the tag 'GSoC' ) for documenting my work throughout the time span.

Before moving on, I would like to thank RTEMS project and Google for giving me this opportunity of working on a highly fruitful Open source project, whose proposal can be found here ,under the mentorship of Christian Mauderer and punit vara. It would be great working with you both :).



Some important links:

Wiki page: https://devel.rtems.org/wiki/GSoC/2018/Porting_SDIO_and_Benchmarking

Project Github Repo: https://github.com/madaari/GSoC-Porting-SDIO-driver-and-benchmarking

Issues targeted : ticket#3429 , ticket#3430 , ticket#3428

Project proposal: Google doc

GSoC acceptance letter(To whom it may concern): here



Starting with the project description, so the project objective is divided into two sections:
First part of this project is intended to add SDIO support t…

Building FreeBSD's SDIO driver for BeagleBone Black

Hi all, This post mainly concern with building FreeBSD's SDIO driver for BeagleBone Black by cross compiling it on AMD platform. I had few unresolved issues with the master branch of current FreeBSD tree. So, for this i used another unofficial branch: https://github.com/kibab/freebsd/tree/mmcam-new . It does have the required KERNCONF file with stable SDIO driver.

A lot of steps below are similar to the one given on: https://forums.freebsd.org/threads/cross-compiling-beaglebone-on-amd64.64718/#post-384835  with slight but inevitable changes.

Procedure:

 Before proceeding you need to first install git.
sudo pkg update -f sudo pkg install git
 Setup project directory by mkdir /BBB
 Clone the repository to /BBB/src by
git clone -b mmcam-new https://github.com/kibab/freebsd.git /BBB/src
Setup environment variables as
setenv BASEDIR /BBB setenv MAKEOBJDIRPREFIX $BASEDIR/obj setenv TARGET arm setenv TARGET_ARCH armv6
Note that sometime it shows an error like: Undefined command setenv, in that …

Setting up FreeBSD environment on virtualbox

Image
Hi all, In this post we will review the procedure of setting up FreeBSD environment on virtualbox along with setting up Internet on the guest OS(this was pretty tricky!).BTW, my host OS is Ubuntu 14.04

So, i am assuming you have already installed virtualbox as per your host OS and has downloaded the FreeBSD amd64 iso image(If not you can do it from here and extract it appropriately to get a .iso file.
Installing FreeBSD on virtualbox
Installing FreeBSD on virtual box is pretty straight forward, just insert use the downloaded iso to boot up the VM with default hardware settings for 64 bit FreeBSD OS. Following will be the bootup window:



Just press enter and follow default procedure. Don't attempt to configure network adapter at this stage ww'll do it later after complete installation.



Note: Please don't forget to remove the installation disc from virtual machine settings after complete installation. Otherwise, every time during bootup it will recall the install procedure.
Setting…

Effect of file-system on sd card's performance

Image
I had a task to compare different protocols( and their different implementations) like SD, SPI, SDIO(in FreeBSD's MMCCAM implementation) by accessing SD Card. Now, for unbiased comparison, i must eliminate file system type in sd card from the equation.

In this blog post, i'll discuss/share my findings about how file-system on a card(SD and MMC) affect its performance.

So, let's start with a very quick introduction to some basic concepts:
Introduction

MMC- Multimedia Card is a memory card unveiled in 1997 by SanDisk and Siemens based on NAND flash memory. eMMC is a regular MMC in a BGA package.

SD Card: SecureDigital Card was introduced in 1999 based on MMC but adding extra features such as security.

INSIDE MMC
[caption id="" align="alignright" width="321"] https://www.ibm.com/developerworks/linux/library/l-flash-filesystems/figure1.gif[/caption]

MMC is made up of broadly 3 parts:

MMC interface - Responsible for handling communication
FTL(Flash Transitio…

Implementing a MMC/SD/SDIO stack using CAM framework(Part 2)

Image
Hi, In the next part lets look at other files which makes up the SDIO stack within mmccam framework. Please have  a look at previous part for more info: http://81.4.107.225/wordpress/index.php/2018/03/19/implementing-a-mmc-sd-sdio-stack-using-cam-framework/

mmc_sdio.c
+void sdio_fill_mmcio_rw_direct(union ccb *ccb, uint8_t f, uint8_t wr, uint32_t adr, uint8_t *data) {
+ struct ccb_mmcio *mmcio;
+
+ CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE,
+ ("sdio_fill_mmcio(f=%d, wr=%d, adr=%02x, data=%02x)\n", f, wr, adr, (data == NULL ? 0 : *data)));
+ mmcio = &ccb->mmcio;
+
+ mmcio->cmd.opcode = SD_IO_RW_DIRECT;
+ mmcio->cmd.arg = SD_IO_RW_FUNC(f) | SD_IO_RW_ADR(adr);
+ if (wr)
+ mmcio->cmd.arg |= SD_IO_RW_WR | SD_IO_RW_RAW | SD_IO_RW_DAT(*data);
+ mmcio->cmd.flags = MMC_RSP_R5 | MMC_CMD_AC;
+ mmcio->cmd.data->len = 0;
+}
sdio_fill_mmcio_rw_direct is basically a wrapper for CMD_52 that's needed to read/write d…

Detailed SDIO protocol Implementation

Image
Reference: Wikipedia, https://www.sdcard.org/developers/overview/sdio/sdio_spec/Simplified_SDIO_Card_Spec.pdf 

SDIO cards are intended to provide high speed data Input/Output on our regular sd card slot. SDIO cards are compatible with any sd card slot and will not cause any physical damage to the host if it's not compatible with SDIO. When SDIO is plugged in a SDIO compatible host, in its early stage it is in low power mode and consumes very little current. Host identifies the SDIO card ,it's power requirement, it's I/O capabilities etc. If host finds that power requirement is manageable and there is driver for the I/O functionality card is offering it allows the SDIO card to power up completely and start it's I/O functions.  SDIO card allows up to 7 different I/O functions along with 1 memory function. It's available in market in 2 form factors: miniSDIO and full size SDIO. For example http://www.spectec.com.tw/sdw-822..html is a miniSDIO wifi card by spectec.
Types…